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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-12-11 18:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('members', '0009_member_max_number_of_boards'),
('boar... | diegojromerolopez/djanban | src/djanban/apps/reports/migrations/0008_auto_20161211_1901.py | Python | mit | 1,474 |
"""PyAudio Example: Play a wave file."""
import pyaudio
import wave
import sys
CHUNK = 1024
if len(sys.argv) < 2:
print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0])
sys.exit(-1)
wf = wave.open(sys.argv[1], 'rb')
# instantiate PyAudio (1)
p = pyaudio.PyAudio()
# open stream (2)
stream = p.... | TheGentlemanOctopus/thegentlemanoctopus | octopus_code/examples/FFT/playwav.py | Python | gpl-3.0 | 711 |
from Message import *
from time import time
from config import config
class WakeupMsg (Message):
sender = Message.data
def __init__(self):
Message.__init__(self)
self.set16(Message.BCAST, Message.addr)
self.set8(120, Message.type)
self.set8(2, Message.length)
self.set16(config.local_id, self... | fresskarma/tinyos-1.x | tools/java/net/tinyos/task/field/motelist.py | Python | bsd-3-clause | 1,380 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.com>)
# Copyright (C)... | andrea4ever/l10n-italy | __unported__/account_vat_period_end_statement/__init__.py | Python | agpl-3.0 | 1,206 |
import imp
import os.path
from os import environ
import logging
__version__ = '0.3.17'
# ERROR = 40, WARNING = 30, INFO = 20, DEBUG = 10
LOG_LEVEL = int(environ.get('LOG_LEVEL', logging.INFO))
# logger: create here to only add the handler once!
LOGGER = logging.getLogger(__name__)
handler = logging.StreamHandler()... | emunsing/pyiso | pyiso/__init__.py | Python | apache-2.0 | 2,684 |
#!/usr/bin/python -OOOO
# vim: set fileencoding=utf8 shiftwidth=4 tabstop=4 textwidth=80 foldmethod=marker :
# Copyright (c) 2010, Kou Man Tong. All rights reserved.
# For licensing, see LICENSE file included in the package.
"""
BSON serialization and deserialization logic.
Specifications taken from: http://bsonspec.or... | hildjj/bson | bson/__init__.py | Python | bsd-3-clause | 1,019 |
# Catverbs - A portable Catalan conjugation reference for Android
# Copyright (C) 2014 Neil Roberts
#
# 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; version 2 of the License.
#
# This program ... | bpeel/catverbs | scripts/get-templates.py | Python | gpl-2.0 | 1,588 |
import time
def isPalindrome(a, b):
if a*b > 100000:
x = str(a*b)
# print str(a) + "*" + str(b) + "=" + x
if (x[0] != x[5]): return False
if (x[1] != x[4]): return False
if (x[2] != x[3]): return False
return True
return False
start = tim... | jannekai/project-euler | 004.py | Python | mit | 665 |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACCOUNT_SID"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)
number = client.lookups.phone_numbers("+15108675309... | teoreteetik/api-snippets | lookups/lookup-get-basic-example-1/lookup-get-basic-example-1.6.x.py | Python | mit | 406 |
# Copyright (c) 2011 OpenStack, LLC.
# 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 requi... | scrapinghub/keystone | keystone/policy/backends/rules.py | Python | apache-2.0 | 3,510 |
#!/usr/bin/env python
from data_iterator import *
from state import *
from session_encdec import *
from utils import *
import time
import traceback
import os.path
import sys
import argparse
import cPickle
import logging
import search
import pprint
import numpy
import collections
import signal
from theano.printing imp... | tscheepers/hred-qs | train.py | Python | bsd-3-clause | 7,485 |
import psycopg2 as dbapi2
from flask import current_app
from quiz import Quiz
from flask_login import current_user
class QuizList:
def __init__(self):
self.tag = {}
self.last_key = 0
def add_quiz(self, reciever, options, content, choice):
connection = dbapi2.connect(current_app.config[... | itucsdb1616/itucsdb1616 | quizList.py | Python | gpl-3.0 | 4,163 |
from django.shortcuts import render
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404
from django.utils.translation import ugettext
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from voting.website.helpers import formrenderer
def inde... | python-dirbtuves/internet-voting-django | voting/website/views.py | Python | agpl-3.0 | 392 |
from __future__ import absolute_import
from __future__ import print_function
from chains.commandline.commands import Command
class CommandManagerList(Command):
def main(self):
""" List managers """
self.setFormatter('managerList')
return self.rpc('oa.main.getManagers', [])
| ChainsAutomation/chains | lib/chains/commandline/commands/ManagerList.py | Python | gpl-2.0 | 303 |
# -*- coding: utf-8 -*-
#
# django-constance documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 25 19:38:51 2014.
#
# 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
# autogenerated fi... | pombredanne/django-constance | docs/conf.py | Python | bsd-3-clause | 8,738 |
import re
from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import orjson
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import ValidationError
from django.db import connection
from django.http import HttpRequest,... | eeshangarg/zulip | zerver/views/message_fetch.py | Python | apache-2.0 | 53,750 |
# -*- coding:utf-8 -*-
import sys
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def __init__(self):
self.pre = None
def flatten(self, root):
if root == None:
return
self.flatten(root.right)
self.flatten(root.left)
roo... | thydeyx/LeetCode-Python | Flatten_Binary_Tree_to_Linked_List.py | Python | mit | 458 |
#!/usr/bin/env python
# -*-coding:Utf-8 -*
from asserv_abstract import *
from asserv_real import *
from asserv_simu import *
from protocol_parser import *
| utcoupe/coupe18 | ros_ws/src/drivers_ard_asserv/src/asserv/__init__.py | Python | gpl-3.0 | 156 |
import parmed.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_angle_type import AbstractAngleType
class RestrictedBendingAngleType(AbstractAngleType):
__slots__ = ['theta', 'k', 'c']
@accepts_compatible_units(None, None, None,
... | shirtsgroup/InterMol | intermol/forces/restricted_bending_angle_type.py | Python | mit | 1,330 |
"""
Support for Z-Wave.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zwave/
"""
import asyncio
import copy
import logging
from pprint import pprint
import voluptuous as vol
from homeassistant.core import callback, CoreState
from homeassistant.loader... | persandstrom/home-assistant | homeassistant/components/zwave/__init__.py | Python | apache-2.0 | 38,560 |
from __future__ import absolute_import
import atexit
import copy
import logging
import socket
import threading
import time
import weakref
from kafka.vendor import six
import kafka.errors as Errors
from kafka.client_async import KafkaClient, selectors
from kafka.codec import has_gzip, has_snappy, has_lz4, has_zstd
fr... | DataDog/kafka-python | kafka/producer/kafka.py | Python | apache-2.0 | 37,775 |
import operator
import numpy as np
import pytest
import pandas._libs.sparse as splib
import pandas.util._test_decorators as td
from pandas import Series
from pandas.core.arrays.sparse import BlockIndex, IntIndex, _make_index
import pandas.util.testing as tm
TEST_LENGTH = 20
plain_case = dict(xloc=[0, 7, 15], xlen=... | GuessWhoSamFoo/pandas | pandas/tests/arrays/sparse/test_libsparse.py | Python | bsd-3-clause | 21,915 |
# -*- test-case-name: txweb2.dav.test.test_report -*-
##
# Copyright (c) 2005-2017 Apple Inc. All rights reserved.
#
# 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, inclu... | macosforge/ccs-calendarserver | txweb2/dav/method/report.py | Python | apache-2.0 | 4,469 |
class DefaultOnlyRouter:
@staticmethod
def allow_migrate(db, app_label, model_name=None, **hints):
"""
Make sure the auth app only appears in the 'auth_db' database.
"""
if 'target_db' in hints:
return db == hints['target_db']
if app_label == 'ws':
... | DavidCain/mitoc-trips | ws/routers.py | Python | gpl-3.0 | 443 |
#!/usr/bin/env python
#
# MCP320x
#
# Author: Maurik Holtrop
#
# This module interfaces with the MCP300x or MCP320x family of chips. These
# are 10-bit and 12-bit ADCs respectively. The x number indicates the number
# of multiplexed analog inputs: 2 (MCP3202), 4 (MCP3204) or 8 (MCP3208)
# Communications with this chi... | mholtrop/Phys605 | Python/DevLib/MCP320x.py | Python | gpl-3.0 | 11,971 |
"""events
Revision ID: 9c92c85163a9
Revises: 666668eae682
Create Date: 2016-05-09 19:04:44.498817
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '9c92c85163a9'
down_revision = '666668eae682'
def upgrade():
op.cre... | gazeti/aleph | aleph/migrate/versions/9c92c85163a9_events.py | Python | mit | 1,959 |
from __future__ import unicode_literals
import re
from .mtv import MTVServicesInfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_urlencode,
)
from ..utils import (
ExtractorError,
float_or_none,
unified_strdate,
)
class ComedyCentralIE(MTVServicesInfoExtractor):
_VALID_URL ... | dntt1/youtube-dl | youtube_dl/extractor/comedycentral.py | Python | unlicense | 12,131 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import webnotes
import webnotes.model
import json
from webnotes.utils import cint
import webnotes.defaults
from stock.doctype.purchase_receipt.test_... | gangadhar-kadam/sapphire_app | accounts/doctype/purchase_invoice/test_purchase_invoice.py | Python | agpl-3.0 | 13,512 |
"""
==================================================
Plot the decision boundaries of a VotingClassifier
==================================================
Plot the decision boundaries of a `VotingClassifier` for
two features of the Iris dataset.
Plot the class probabilities of the first sample in a toy dataset
pred... | chenyyx/scikit-learn-doc-zh | examples/zh/ensemble/plot_voting_decision_regions.py | Python | gpl-3.0 | 2,430 |
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2012, Polar Mobile.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# ... | polarmobile/polar.paywall.publisher | publisher/validate.py | Python | bsd-3-clause | 11,962 |
import inspect
import functools
import numpy as np
from statsmodels.compat.python import get_function_name, iteritems
class ResultsWrapper(object):
"""
Class which wraps a statsmodels estimation Results class and steps in to
reattach metadata to results (if available)
"""
_wrap_attrs = {}
_wra... | rgommers/statsmodels | statsmodels/base/wrapper.py | Python | bsd-3-clause | 4,128 |
import unittest
from . import base
class GifTestCase(base.ShellParserTestCase, unittest.TestCase):
extension = 'gif'
| deanmalmgren/textract | tests/test_gif.py | Python | mit | 124 |
# examples from http://linuxgazette.net/100/pramode.html
def foo():
yield 1
yield 2
g = foo()
assert next(g)==1
assert next(g)==2
def foo():
return
yield 1
assert [x for x in foo()]==[]
def foo(n):
for i in range(2):
if (n < 3):
yield 1
else:
return
... | kikocorreoso/brython | www/tests/test_generators.py | Python | bsd-3-clause | 21,216 |
# coding: utf-8
# Written by Wendo Sabée
# Automatically loads all tests from *_test.py files
import unittest
import os
if __name__ == '__main__':
# Import all *_test.py files
for file in os.listdir(os.getcwd()):
if file.endswith('_test.py'):
try:
modulename = file[:len(fil... | wtud/tsap | tribler-prototype/tsap-tests/TestAll.py | Python | gpl-3.0 | 616 |
# 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... | airbnb/airflow | chart/tests/test_git_sync_worker.py | Python | apache-2.0 | 3,235 |
"""
===============
Resampling data
===============
When performing experiments where timing is critical, a signal with a high
sampling rate is desired. However, having a signal with a much higher sampling
rate than is necessary needlessly consumes memory and slows down computations
operating on the data.
This exampl... | jniediek/mne-python | examples/preprocessing/plot_resample.py | Python | bsd-3-clause | 3,439 |
# urllib3/connectionpool.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import errno
import logging
from socket import error as SocketError, timeout as SocketT... | staranjeet/fjord | vendor/packages/urllib3/urllib3/connectionpool.py | Python | bsd-3-clause | 26,393 |
import getpass
import gtk
import os
import datetime
from time import sleep
import autopy
class CaptureScreen():
def __init__(self):
self.ip_entry_text = ""
self.port_entry_text = ""
self.initial_entry_text = ""
self.comment_entry_text = ""
response = self.save_shot()
... | ARL-UTEP-OC/ecel | plugins/collectors/manualscreenshot/takeshoot.py | Python | gpl-3.0 | 3,739 |
from django.contrib import admin
from .models import Group, Profile
@admin.register(Profile)
class ProfileAdmin(admin.ModelAdmin):
list_display = ('user', 'group', 'score')
list_filter = ('group',)
search_fields = ('user__username',)
ordering = ('user',)
@admin.register(Group)
class GroupAdmin(admi... | evonaut/bolzplatz | bolzplatz/users/admin.py | Python | gpl-2.0 | 524 |
#!/usr/bin/pypy
# -*- coding: UTF-8 -*-
__author__ = 'Qunfei Wu'
__version__ = '0.1'
__date__ = '14/12/14'
__copyright__ = """Copyright (c) 2014 Qunfei Wu"""
import unittest
import easyroman
import timeit
class RomanTestCase(unittest.TestCase):
known_values = ( (1, 'I'),
(2, 'II'),
... | wuqunfei/easyroman | src/unitests.py | Python | apache-2.0 | 2,978 |
# -*- encoding: utf-8 -*-
# Module iapad
from numpy import *
def iapad(f, thick=[1,1], value=0):
f, thick = asarray(f), asarray(thick)
g = (value * ones(array(f.shape)+2*thick)).astype(f.dtype.char)
g[thick[0]:-thick[0], thick[1]:-thick[1]] = f
return g
| robertoalotufo/ia636 | ia636/iapad.py | Python | bsd-3-clause | 274 |
# -*- coding: utf-8 -*-
'''
Created on 2014年7月23日
@author: fengzishiren
@mail: xiaoyaozi106@163.com
'''
import re
import MySQLdb
import os
import sys
from settings import *
__version__ = '0.1'
__date__ = '2014-07-23'
__updated__ = '2014-07-23'
FORMAT_ARGS = {'author': 'pysugar', 'date': __date__, 'version': __versio... | fengzishiren/pysugar | src/pysugar.py | Python | mit | 5,899 |
#!/usr/bin/env python
"""SeqAn code generation from templates / skeletons.
This module contains code to help the creation of modules, tests, apps etc.
It can be called directly or imported and the main() function can be called.
It will perform the following replacements:
%(AUTHOR)s will be replaced by the author'... | holtgrewe/seqan | util/py_lib/seqan/skel.py | Python | bsd-3-clause | 21,964 |
# Copyright (c) Mathias Kaerlev 2011-2012.
# This file is part of pyspades.
# pyspades 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... | infogulch/pyspades | feature_server/commands.py | Python | gpl-3.0 | 32,876 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | 0x0all/nupic | py/nupic/frameworks/prediction/postprocess/ngramstats.py | Python | gpl-3.0 | 19,759 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import re
import sys
import string
import sqlite3
import hashlib
import ImageSimilarity
def md5( fname ):
hash_md5 = hashlib.md5()
with open( fname, 'rb' ) as f:
for chunk in iter( lambda: f.read( 4096 ), b'' ):
hash_md5.update( chunk )
return sqlite3... | daign/daign-image-organizer | src/Database.py | Python | mit | 7,571 |
import collections
import re
from . import compat
def coerce_string_conf(d):
result = {}
for k, v in d.items():
if not isinstance(v, compat.string_types):
result[k] = v
continue
v = v.strip()
if re.match(r"^[-+]?\d+$", v):
result[k] = int(v)
... | pymedusa/SickRage | ext/dogpile/util/langhelpers.py | Python | gpl-3.0 | 3,586 |
# Copyright (C) 2011 Canonical Ltd.
# Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
#
# This file is part of cloud-init. See LICENSE file for license information.
"""
Growpart
--------
**Summary:** gro... | larsks/cloud-init | cloudinit/config/cc_growpart.py | Python | gpl-3.0 | 11,788 |
# -*- coding: utf-8 -*-
__license__ = 'GPL 3'
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import textwrap
from PyQt4.Qt import (QWidget, QListWidgetItem, Qt, QVariant, QLabel,
QLineEdit, QCheckBox, QComboBox)
from calibre.gui2 import error_dialog, ques... | nozuono/calibre-webserver | src/calibre/gui2/device_drivers/configwidget.py | Python | gpl-3.0 | 7,711 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2016 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | williamthegrey/swift | test/unit/proxy/test_server.py | Python | apache-2.0 | 428,797 |
"""
A variation on the local environment that uses mysql for the analytics database.
Useful for developers running both mysql ingress locally and the api locally
"""
from analyticsdataserver.settings.local import *
########## DATABASE CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#databases... | Stanford-Online/edx-analytics-data-api | analyticsdataserver/settings/local_mysql.py | Python | agpl-3.0 | 828 |
#!/usr/bin/python
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# 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 on... | AlexanderBrevig/Espruino | scripts/build_board_docs.py | Python | mpl-2.0 | 15,484 |
# encoding: utf-8
"""
Enable Gtk3 to be used interacive by IPython.
Authors: Thomi Richards
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2012, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the ... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/IPython/lib/inputhookgtk3.py | Python | mit | 1,035 |
import unittest
from django.conf import settings
from django.test import TestCase, RequestFactory
from cradmin_legacy import cradmin_testhelpers
from model_bakery import baker
from devilry.devilry_account.models import PermissionGroup
from devilry.devilry_admin.views.dashboard import overview
class TestOverviewSubje... | devilry/devilry-django | devilry/devilry_admin/tests/dashboard/test_overview.py | Python | bsd-3-clause | 18,818 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Contestant.gender'
db.add_column(u'contest_contestant', 'gender',
self... | artursmet/climbing-contest | contest/migrations/0004_auto__add_field_contestant_gender__add_field_contestant_shirt_size.py | Python | apache-2.0 | 2,866 |
import errno
import itertools
import os
import os.path
import pytest
import yaml
def pytest_addoption(parser):
parser.addoption("--rebaseline", action="store_true", help="output a new baseline instead of testing")
parser.addoption("--mark-failing", action="store_true", help="mark all failing tests as failing")... | Anty-Lemon/mgba | src/platform/python/conftest.py | Python | mpl-2.0 | 2,055 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#local imports
from modules.page_mount import Principal
page = Principal()
page.mount(
page='strains.detail',
category='main',
js=('ext.jquery', 'ext.json', 'loc','data_div_manipulation','feedback', 'form.strains.quality', 'form.strains... | cria/microSICol | py/strains.detail.py | Python | gpl-2.0 | 456 |
"""
Github Authentication
"""
import httplib2
from django.conf import settings
from django.core.mail import send_mail
from oauth2client.client import OAuth2WebServerFlow
from helios_auth import utils
# some parameters to indicate that status updating is not possible
STATUS_UPDATES = False
# display tweaks
LOGIN_ME... | benadida/helios-server | helios_auth/auth_systems/github.py | Python | apache-2.0 | 2,315 |
from django.core.exceptions import ImproperlyConfigured
from django.core.handlers.wsgi import WSGIHandler, WSGIRequest, get_script_name
from django.core.signals import request_finished, request_started
from django.db import close_old_connections, connection
from django.test import (
RequestFactory, SimpleTestCase, ... | edmorley/django | tests/handlers/tests.py | Python | bsd-3-clause | 8,520 |
import re
import json
import subprocess
import pexpect
ip_pattern = "(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})"
def find_public_ips():
args = ["ifconfig", "-a"]
output = subprocess.check_output(args)
ip_addresses = []
for line in output.splitlines():
if 'inet addr' in line:
ip_... | Oldkin/ROS | utilities/turtle/turtle_setup.py | Python | gpl-3.0 | 1,450 |
# -*- coding: utf-8 -*-
from fld_button_text import Button_text
from fld_checkbox import CheckBox
from fld_date import Date
from fld_date_or_empty import Date_or_empty
from fld_integer import Integer
from fld_numeric import Numeric
from fld_text import Text
from fld_textline import TextLine
from fld_textline import Te... | tedlaz/pyted | pymiles/pymiles.old/fld_selector.py | Python | gpl-3.0 | 1,133 |
import unittest
"""
Given a binary tree, we need to find maximum value we can get by subtracting
value of node B from value of node A, where A and B are two nodes of the binary tree
and A is ancestor of B. Expected time complexity is O(n).
"""
class Node:
def __init__(self, data, left=None, right=None):
s... | prathamtandon/g4gproblems | Graphs/max_difference.py | Python | mit | 1,915 |
# -*- coding: utf-8 -*-
from werkzeug.debug import DebuggedApplication
from types import GeneratorType
import sys
class SocketIODebugger(DebuggedApplication):
def __init__(self, app, **kwargs):
"""
The arguments are the same as for DebuggedApplication in werkzeug.debug, with
the only add... | aldanor/SocketIO-Flask-Debug | debugger.py | Python | mit | 2,720 |
import numpy as np
from silx import config
from silx import sx
from silx.gui.plot.ScatterView import ScatterView
from PyQt5.QtWidgets import QApplication
import sys
if __name__ == "__main__":
app = QApplication(sys.argv)
samps = 1000
levels = 100
fwhm = 50
cen = 500
x = np.random.rand(samps)... | srio/shadow3-scripts | alpha_channel_silx.py | Python | mit | 783 |
# Generated by Django 2.0 on 2017-12-06 09:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('profile', '0001_squashed_0005_auto_20170408_1400'),
]
operations = [
migrations.AlterField(
model_name='Profile',
name... | AlexandreDecan/Lexpage | app/profile/migrations/0002_auto_20171206_0943.py | Python | gpl-3.0 | 651 |
# Ben Puccio
# 2016-06-02
#
# parse log file for last entry that says time elapsed
import numpy as np
import glob
import time
import datetime
path='/home/bpuccio/BET/IBSR_nifti_stripped/log'
log_names=glob.glob(path+'*.log')
time=[]
splitter=[]
sec=[]
for i in log_names:
with open(i,'r') as f:
f=f.r... | preprocessed-connectomes-project/NFB_skullstripped | validation_scripts/parse_log.py | Python | mit | 819 |
# -*- coding: utf-8 -*-
#
# CAIRIS documentation build configuration file, created by
# sphinx-quickstart on Mon Dec 26 07:51:54 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
# autogenerated file.
#
# Al... | failys/CAIRIS | docs/conf.py | Python | apache-2.0 | 5,171 |
"""This module contains classes to transform inputs in a sequence.
For example, see the SeqXform class.
"""
class SeqXform:
"""
The SeqXform class provides a way to modify or transform results
of a TimeSeqSequence. Instances of SeqXform can be passed
to the AddField method of the TimeSeq clas... | garthee/pyvol | pyvol/tseries/Transforms.py | Python | mit | 13,987 |
# Copyright 2016 Measurement Lab
#
# 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 writi... | mtlynch/ndt-e2e-testmaster | testmaster/read_results.py | Python | apache-2.0 | 4,594 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-resource-settings | google/cloud/resourcesettings_v1/services/resource_settings_service/transports/grpc_asyncio.py | Python | apache-2.0 | 15,677 |
import sys
class Translator(object):
def __init__(self, max_iterations=10):
self.de_words = []
self.de_dict = []
self.en_words = []
self.en_dict = []
self.sent_pairs = []
self.probs = {}
self.transmissions = {} # this is t(e|f)
self.countef = {} ... | accraze/pymtranslate | pymtranslate/translator.py | Python | mit | 5,711 |
from osv import osv, fields
from tools.translate import _
import os
import base64, urllib
import netsvc
from datetime import datetime, timedelta,date
from dateutil.relativedelta import relativedelta
import time
from tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, float_compare
import cStringIO... | arpitb827/Salary-notifications | salary_payment/wizard/budget5.py | Python | agpl-3.0 | 14,644 |
import os
import textwrap
from pathlib import Path
from string import ascii_lowercase
from copy import copy
from selenium import webdriver
from IPython.display import HTML
from bibtexparser.customization import homogenize_latex_encoding
from snowballing import config
from snowballing.collection_helpers import define_... | JoaoFelipe/snowballing | snowballing/bibtex/database/__init__.py | Python | mit | 23,508 |
import os
import sys
import time
import json
import traceback
import numpy as np
class std_out(object):
def __call__(self, msg, lf=True):
sys.stdout.write(msg)
sys.stdout.flush()
def input(self, prompt):
return input(prompt)
class Question(object):
prompt = None
solution = Non... | MathYourLife/forall | maths.py | Python | mit | 7,874 |
import gtable as gt
import numpy as np
import pandas as pd
class TimeSuite:
def setup(self):
self.df1_s = pd.DataFrame({'A': ['A0', 'A1', 'A2', 'A3'],
'B': ['B0', 'B1', 'B2', 'B3'],
'C': ['C0', 'C1', 'C2', 'C3'],
... | guillemborrell/gtable | benchmarks/benchmark_outer_join.py | Python | bsd-3-clause | 4,179 |
import sys
import numpy as np
from vanilla_neural_nets.neural_network.network import VanillaNeuralNetwork
from vanilla_neural_nets.autoencoder.sparse_autoencoder.layer_object import NetworkLayersCollectionWithSparsity
class VanillaSparseAutoencoder(VanillaNeuralNetwork):
def __init__(self, layer_sizes, trainin... | cavaunpeu/vanilla-neural-nets | vanilla_neural_nets/autoencoder/sparse_autoencoder/network.py | Python | mit | 2,990 |
# file test_existdb/test_templatetags.py
#
# Copyright 2011 Emory University Libraries
#
# 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... | 0xffea/eulexistdb | test/test_existdb/test_templatetags.py | Python | apache-2.0 | 2,198 |
# Copyright (C) 2017 Matteo Franchin
#
# This file is part of Pyrtist.
# Pyrtist 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 option) any late... | mfnch/pyrtist | pyrtist/lib2d/style.py | Python | lgpl-2.1 | 13,065 |
# Copyright 2016 F5 Networks 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... | wojtek0806/f5-common-python | test/functional/tm/sys/software/test_update.py | Python | apache-2.0 | 1,540 |
from django.urls import re_path
from . import views
urlpatterns = [
# Serve the revision hashes.
re_path(r"^media/revision.txt$", views.revision_hash, name="version.kuma"),
re_path(
r"^media/kumascript-revision.txt$",
views.kumascript_revision_hash,
name="version.kumascript",
... | a2sheppy/kuma | kuma/version/urls.py | Python | mpl-2.0 | 325 |
"""
To install phcpy correctly, the shared object file must be copied
to the same location where the modules of phcpy are installed.
This is accomplished via the data_files entry in the setup below.
For the installation of the GPU accelerated path trackers in double,
double double and quad double precision, instead of ... | janverschelde/PHCpack | src/Python/PHCpy3/setup.py | Python | gpl-3.0 | 1,410 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
fraction_d2o = [u'0.99', u'0.12', u'0.41'] # 1 value for each contrast
partial_specific_volume = [u'0.745', u'0.903'] # 1 value for each compon... | madscatt/zazzie | susan_in_progress/test_variables.py | Python | gpl-3.0 | 1,074 |
from ..module import get_introspection_module
from ..overrides import override
import warnings
GElektra = get_introspection_module('GElektra')
def __func_alias(klass, old, new):
func = getattr(klass, old)
setattr(klass, new, func)
def __func_rename(klass, old, new):
__func_alias(klass, old, new)
delattr(klass, o... | e1528532/libelektra | src/bindings/gi/python/gi/overrides/GElektra.py | Python | bsd-3-clause | 8,767 |
"""
Author: Esteban Jiménez Rodríguez
Institution: ITESO - Universidad Jesuita de Guadalajara
Date: 01/11/2017
Description: This script contains functions that make possible to use the pyomo
library directly.
"""
from __future__ import division
import numpy as np
import pyomo.environ
import pyomo.opt
import random
##... | esjimenezro/Simulacion2017 | Modulo3/pyomo_utilities.py | Python | mit | 12,185 |
import re
import base64
import pathlib
import json
from cumulusci.tasks.salesforce import BaseSalesforceApiTask
from cumulusci.core.exceptions import CumulusCIException
from simple_salesforce.exceptions import SalesforceMalformedRequest
def join_errors(e: SalesforceMalformedRequest) -> str:
return "; ".join([err... | SalesforceFoundation/CumulusCI | cumulusci/tasks/salesforce/users/photos.py | Python | bsd-3-clause | 5,744 |
from datetime import date
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as tck
def date_months_ago(n):
now = time.localtime()
y, m = time.localtime(time.mktime((now.tm_year, now.tm_mon - n, 1, 0, 0, 0, 0, 0, 0)))[:2]
return date(y, m, 1)
def avg(lst):
return sum(lst) / l... | ddksr/toshlayzer | lib/display.py | Python | gpl-3.0 | 9,354 |
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of logilab-common.
#
# logilab-common is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as publ... | musicmetric/logilab-common | test/unittest_decorators.py | Python | gpl-2.0 | 7,058 |
import xbmc
import sys
def direct():
xbmc.executebuiltin('Dialog.Close(all,true)')
from sys import argv
query=argv[2][1:]
#run only on root
if not "module=" in query and not "page=" in query:
from dom import check
from defs import addon_setxml,addon_bsetxml,kodi_setxml,kodi_bsetxml,kodi_favxml,kodi_bfavxml
... | boogiekodi/plugin.program.ump | lib/ump/prerun.py | Python | gpl-2.0 | 1,123 |
from __future__ import absolute_import
import datetime
import re
import mechanize
from BeautifulSoup import BeautifulSoup
from celery import current_app as app
from visualizacion.models.anime import Anime
from visualizacion.models.genre import Genre
from visualizacion.models.licensor import Licensor
from visualizacion... | jampueroc/scrapper_anime | visualizacion/scrapper.py | Python | gpl-3.0 | 8,057 |
# coding: utf-8
#
# Copyright 2014 The Oppia 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 requi... | souravbadami/oppia | core/domain/rights_manager.py | Python | apache-2.0 | 48,790 |
# 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 ... | danieldanciu/schoggi | modules/dashboard/filer.py | Python | apache-2.0 | 25,644 |
'''
Test for deleting and expunge image created vm ops.
The key step:
-add image1
-create vm1 from image1
-export image1
-create image2 from vm1
-export image2
-create vm2 from image2
-del and expunge image1
-change vm2 os
-del image2
-attach iso/volume to vm2
-expunge image2
-create snapshot from vm2
@author: PxChen... | zstackio/zstack-woodpecker | integrationtest/vm/multihosts/bs/test_del_exp_img_cpyd_vm_chg_os_attach_sp.py | Python | apache-2.0 | 4,077 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | SKIRT/PTS | do/core/makewavemovie.py | Python | agpl-3.0 | 2,769 |
a = [1,2,3,4,5]
def helper(a):
print a[0]
helper(a[1:])
helper(a[-1:])
helper(a)
| quake0day/oj | testdfs.py | Python | mit | 95 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import pytest
from ... | dturner-tw/pants | tests/python/pants_test/targets/test_python_binary.py | Python | apache-2.0 | 3,428 |
from direct.gui.OnscreenImage import OnscreenImage
from panda3d.core import Vec3
from panda3d.core import BitMask32
from panda3d.core import TransparencyAttrib
from panda3d.core import CollisionNode
from panda3d.core import CollisionBox
from panda3d.ai import AICharacter
from math import exp
from random import uniform
... | freevryheid/spanda3D | spanda3D/enemy.py | Python | bsd-2-clause | 5,322 |
#!/usr/bin/env python
# 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/
from __future__ import division, absolute_import, print_function, unicode_literals
import OpenSSL
im... | Drewsif/OpenVPN-Config-Generator | OpenVPNConfig.py | Python | mpl-2.0 | 14,441 |
def name():
return 'apple'
| akerl/modlib | test/mock/apple.py | Python | mit | 31 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | seankelly/buildbot | master/buildbot/test/unit/test_util_bbcollections.py | Python | gpl-2.0 | 2,470 |
#
# ----------------------------------------------------------------------------------------------------
#
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# u... | graalvm/mx | mx_javacompliance.py | Python | gpl-2.0 | 12,586 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.