repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
appsembler/edx-platform | openedx/core/djangoapps/user_api/preferences/views.py | 23 | 10838 | """
An API for retrieving user preference information.
For additional information and historical context, see:
https://openedx.atlassian.net/wiki/display/TNL/User+API
"""
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework import p... | agpl-3.0 |
ujjwalwahi/odoo | addons/sales_team/__init__.py | 365 | 1081 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
jbenden/ansible | lib/ansible/plugins/terminal/aireos.py | 101 | 1999 | #
# (c) 2016 Red Hat Inc.
#
# 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 d... | gpl-3.0 |
petermalcolm/osf.io | website/addons/wiki/exceptions.py | 52 | 1131 | from modularodm.exceptions import ValidationValueError
from website.addons.base.exceptions import AddonError
class WikiError(AddonError):
"""Base exception class for Wiki-related error."""
pass
class NameEmptyError(WikiError, ValidationValueError):
"""Raised if user tries to provide an empty name value.""... | apache-2.0 |
jdowner/chill | server.py | 1 | 1437 | #!/usr/bin/env python2
import sys
import tornado.ioloop
import tornado.web
import tornado.log
import tornado.escape
import chill
class SoundHandler(tornado.web.RequestHandler):
def initialize(self, sound_bank):
self.sound_bank = sound_bank
class SoundList(SoundHandler):
def get(self):
sel... | mit |
rgerkin/inspyred | inspyred/ec/replacers.py | 4 | 17658 | """
================================================
:mod:`replacers` -- Survivor replacement methods
================================================
This module provides pre-defined replacers for evolutionary computations.
All replacer functions have the following arguments:
... | gpl-3.0 |
sudheesh001/RFID-DBSync | PCSC/UnitaryTests/SCardBlockingBehaviourTest.py | 3 | 9336 | #!/usr/bin/env python
"""
# Copyright (c) 2010 Jean-Luc Giraud (jlgiraud@mac.com)
# All rights reserved.
"""
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above ... | gpl-2.0 |
detrout/debian-statsmodels | statsmodels/tsa/tests/test_seasonal.py | 27 | 9216 | import numpy as np
from numpy.testing import assert_almost_equal, assert_equal, assert_raises
from statsmodels.tsa.seasonal import seasonal_decompose
from pandas import DataFrame, DatetimeIndex
class TestDecompose:
@classmethod
def setupClass(cls):
# even
data = [-50, 175, 149, 214, 247, 237, ... | bsd-3-clause |
alianmohammad/pd-gem5-latest | src/arch/x86/isa/insts/simd64/integer/save_and_restore_state.py | 91 | 2168 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... | bsd-3-clause |
qilicun/python | python2/plotmap.py | 1 | 2234 | #!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
try:
from mpl_toolkits.basemap import Basemap
have_basemap = True
except ImportError:
have_basemap = False
def plotmap():
# create figure
fig = plt.figure(figsize=(8,8))
# set up orthographic map projection with
# p... | gpl-3.0 |
ianyh/heroku-buildpack-python-opencv | vendor/.heroku/lib/python2.7/idlelib/rpc.py | 65 | 20225 | """RPC Implemention, originally written for the Python Idle IDE
For security reasons, GvR requested that Idle's Python execution server process
connect to the Idle process, which listens for the connection. Since Idle has
only one client per server, this was not a limitation.
+---------------------------------+ +... | mit |
cratuki/solent | solent/tools/boiler.py | 2 | 7173 | # // license
# Copyright 2016, Free Software Foundation.
#
# This file is part of Solent.
#
# Solent is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
... | lgpl-3.0 |
tmalsburg/EyeScript | EyeScript/shapes.py | 1 | 2459 | # -*- coding: utf-8 -*-
"""Contains classes defining screen regions. Such regions may be used to define interest areas for the Data Viewer, or to trigger events in gaze-contingent paradigms.
"""
from pygame import Rect
class Shape:
"""Abstract class representing screen regions, from which shape-specific subclasses... | gpl-2.0 |
uhuc-de/minecraft-vanilla-server-toolset | bin/mvst/tracer_handler.py | 1 | 1568 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import datetime
import logging # used for logging
from .core_functions import CoreFunctions as Core
class TracerHandler:
"""
This class handles everything regarding the tracer
"""
def __init__(self, config):
self.config = config
self.log = logging.getL... | gpl-3.0 |
RazZziel/xbmc | play_on_xbmc.py | 1 | 1955 | #!/usr/bin/env python
#
# Copyright (c) 2014 Ismael Barros² <ismael@barros2.org>
#
# This script lets you play any video file on any remote XBMC
# It will set up a mini HTTP server only to make the video available for XBMC
import SimpleHTTPServer
import SocketServer
import threading
import time
import sys
import os
i... | mit |
DarkStarSword/junk | config/home/.i3/i3companion/wacom.py | 1 | 2989 | #!/usr/bin/env python
from pluginmanager import notify, notify_exception
import subprocess
mappings = {
# NOTE: Different versions of xsetwacom have different
# mappings, yours may vary! If you don't have a "pad", try
# "cursor" or upgrade:
'Wacom Intuos3 9x12 pad': {
# +-----+-----+ +-------+ \ +--... | mit |
viraptor/cryptography | cryptography/hazmat/primitives/padding.py | 1 | 5215 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | apache-2.0 |
petrus-v/server-tools | module_parent_dependencies/__openerp__.py | 1 | 2175 | # -*- encoding: utf-8 -*-
##############################################################################
#
# Module - Parent Dependencies module for Odoo
# Copyright (C) 2014 GRAP (http://www.grap.coop)
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# This program is free software: you can re... | agpl-3.0 |
andreyvit/pyjamas | examples/djangoweb/media/HTMLLinkPanel.py | 12 | 1309 | from pyjamas.ui.HTMLPanel import HTMLPanel
from pyjamas.ui.Hyperlink import Hyperlink
from pyjamas import Window
from pyjamas import DOM
class HTMLLinkPanel(HTMLPanel):
def __init__(self, sink, html="", title="", **kwargs):
self.sink = sink
self.title = title
HTMLPanel.__init__(self, html,... | apache-2.0 |
chmberl/django-cms | cms/models/pagemodel.py | 12 | 57774 | # -*- coding: utf-8 -*-
from logging import getLogger
from os.path import join
from django.conf import settings
from django.contrib.auth import get_permission_codename
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from djang... | bsd-3-clause |
liaorubei/depot_tools | third_party/gsutil/gslib/addlhelp/acls.py | 51 | 9472 | # 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 a... | bsd-3-clause |
Sumith1896/sympy | sympy/functions/elementary/tests/test_exponential.py | 2 | 14039 | from sympy import (
symbols, log, Float, nan, oo, zoo, I, pi, E, exp, Symbol,
LambertW, sqrt, Rational, expand_log, S, sign, conjugate,
sin, cos, sinh, cosh, tanh, exp_polar, re, Function, simplify)
def test_exp_values():
x, y = symbols('x,y')
k = Symbol('k', integer=True)
assert exp(nan) =... | bsd-3-clause |
rockyzhang/zhangyanhit-python-for-android-mips | python3-alpha/python3-src/Lib/test/test_stringprep.py | 165 | 3193 | # To fully test this module, we would need a copy of the stringprep tables.
# Since we don't have them, this test checks only a few codepoints.
import unittest
from test import support
from stringprep import *
class StringprepTests(unittest.TestCase):
def test(self):
self.assertTrue(in_table_a1("\u0221")... | apache-2.0 |
ademuk/django-oscar | sites/demo/apps/shipping/migrations/0001_initial.py | 119 | 4281 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import oscar.models.fields.autoslugfield
from decimal import Decimal
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('address', '0001_initial'),
]
oper... | bsd-3-clause |
plotly/plotly.py | packages/python/plotly/plotly/validators/funnelarea/_title.py | 2 | 1214 | import _plotly_utils.basevalidators
class TitleValidator(_plotly_utils.basevalidators.TitleValidator):
def __init__(self, plotly_name="title", parent_name="funnelarea", **kwargs):
super(TitleValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
da... | mit |
konsP/synnefo | snf-pithos-backend/pithos/backends/lib/sqlite/node.py | 6 | 43473 | # Copyright (C) 2010-2014 GRNET S.A.
#
# 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.
#
# This program is distributed i... | gpl-3.0 |
whiteear/cloudbase-init | cloudbaseinit/tests/metadata/services/test_httpservice.py | 4 | 7179 | # Copyright 2014 Cloudbase Solutions Srl
#
# 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... | apache-2.0 |
oddlespuddle/term-cube | termcube/cube/pykociemba/cubiecube.py | 3 | 19561 | import copy
from builtins import range
from .corner import URF, UFL, ULB, UBR, DFR, DLF, DBL, DRB, corner_values
from .edge import UR, UF, UL, UB, DR, DF, DL, DB, FR, FL, BL, BR, edge_values
from .facecube import FaceCube
# n choose k
def Cnk(n, k):
if n < k:
return 0
if k > n // 2:
k = n - k... | gpl-2.0 |
stephenfin/patchwork | patchwork/models.py | 1 | 33159 | # Patchwork - automated patch tracking system
# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
# Copyright (C) 2015 Intel Corporation
#
# SPDX-License-Identifier: GPL-2.0-or-later
from collections import Counter
from collections import OrderedDict
import datetime
import random
import re
from django.conf import settin... | gpl-2.0 |
supergis/QGIS | python/utils.py | 2 | 17976 | # -*- coding: utf-8 -*-
"""
***************************************************************************
utils.py
---------------------
Date : November 2009
Copyright : (C) 2009 by Martin Dobias
Email : wonder dot sk at gmail dot com
************************... | gpl-2.0 |
xindus40223115/w16b_test | static/Brython3.1.3-20150514-095342/Lib/platform.py | 620 | 51006 | #!/usr/bin/env python3
""" This module tries to retrieve as much platform-identifying data as
possible. It makes this information available via function APIs.
If called from the command line, it prints the platform
information concatenated as single string to stdout. The output
format is useable as pa... | gpl-3.0 |
komsas/OpenUpgrade | addons/hr_attendance/wizard/hr_attendance_error.py | 377 | 2896 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
EnviroCentre/jython-upgrade | jython/lib/test/re_tests.py | 19 | 28329 | #!/usr/bin/env python
# -*- mode: python -*-
# $Id$
# Re test suite and benchmark suite v1.5
# The 3 possible outcomes for each pattern
[SUCCEED, FAIL, SYNTAX_ERROR] = range(3)
# Benchmark suite (needs expansion)
#
# The benchmark suite does not test correctness, just speed. The
# first element of each tuple is the... | mit |
ptressel/sahana-eden-madpub | static/scripts/tools/topo.py | 8 | 3926 | # -*- coding: utf-8 -*-
"""
Reads a collection of Web2py .table files, extracts the foreign key
constraints, forms the tables and their dependencies into a directed graph,
verifies that the graph has no cycles, does a topological sort, and writes
out tables in order, with the non-dependent tables at the front. If the
... | mit |
beres/waliki | waliki/git/views.py | 1 | 6695 | import json
from django.utils import timezone
from datetime import datetime
from django.templatetags.tz import localtime
from django.shortcuts import render, get_object_or_404, redirect
from django.utils.translation import ugettext_lazy as _
from django.http import Http404
from django.core.management import call_comma... | bsd-3-clause |
Pakketeretet2/lammps | lib/mscg/Install.py | 12 | 4891 | #!/usr/bin/env python
"""
Install.py tool to download, unpack, build, and link to the MS-CG library
used to automate the steps described in the README file in this dir
"""
from __future__ import print_function
import sys, os, subprocess, shutil, tarfile
from argparse import ArgumentParser
sys.path.append('..')
from ... | gpl-2.0 |
Allow2CEO/browser-ios | brave/node_modules/ad-block/node_modules/bloom-filter-cpp/vendor/depot_tools/fetch_configs/config_util.py | 13 | 1597 | # Copyright (c) 2013 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 module holds utilities which make writing configs easier."""
import json
class Config(object):
"""Base class for all configs.
Provides me... | mpl-2.0 |
sekikn/ambari | ambari-common/src/main/python/ambari_jinja2/docs/conf.py | 14 | 4524 | # -*- coding: utf-8 -*-
#
# Jinja2 documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 27 21:42:41 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleab... | apache-2.0 |
EricYangzhiHong/python-docs-samples | bigquery/samples/load_data_by_post.py | 2 | 3655 | # Copyright 2015, 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, s... | apache-2.0 |
shiftcontrol/UnityOpenCV | opencv/samples/python/pyramid_segmentation.py | 6 | 1246 | #!/usr/bin/python
import cv
class PyrSegmentation:
def __init__(self, img0):
self.thresh1 = 255
self.thresh2 = 30
self.level =4
self.storage = cv.CreateMemStorage()
cv.NamedWindow("Source", 0)
cv.ShowImage("Source", img0)
cv.NamedWindow("Segmentation", 0)
... | gpl-3.0 |
SunghanKim/numpy | numpy/tests/test_ctypeslib.py | 87 | 4097 | from __future__ import division, absolute_import, print_function
import sys
import numpy as np
from numpy.ctypeslib import ndpointer, load_library
from numpy.distutils.misc_util import get_shared_lib_extension
from numpy.testing import TestCase, run_module_suite, dec
try:
cdll = load_library('multiarray', np.cor... | bsd-3-clause |
FCP-INDI/nipype | examples/dmri_preprocessing.py | 20 | 5464 | # coding: utf-8
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
===================
dMRI: Preprocessing
===================
Introduction
============
This script, dmri_preprocessing.py, demonstrates how to prepare dMRI data
for tractography and co... | bsd-3-clause |
w-martin/tact | gmock/scripts/generator/cpp/utils.py | 1158 | 1153 | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 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... | gpl-3.0 |
atanasi/morituri | morituri/common/gstreamer.py | 2 | 2652 | # -*- Mode: Python; test-case-name: morituri.test.test_common_gstreamer -*-
# vi:si:et:sw=4:sts=4:ts=4
# Morituri - for those about to RIP
# Copyright (C) 2009 Thomas Vander Stichele
# This file is part of morituri.
#
# morituri is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | gpl-3.0 |
h-2/seqan | misc/seqan_instrumentation/bin/classes/requests/packages/urllib3/packages/mimetools_choose_boundary/__init__.py | 55 | 1402 | """The function mimetools.choose_boundary() from Python 2.7, which seems to
have disappeared in Python 3 (although email.generator._make_boundary() might
work as a replacement?).
Tweaked to use lock from threading rather than thread.
"""
import os
from threading import Lock
_counter_lock = Lock()
_counter = 0
def _ge... | bsd-3-clause |
sertac/django | tests/shortcuts/urls.py | 252 | 1416 | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^render_to_response/$', views.render_to_response_view),
url(r'^render_to_response/multiple_templates/$', views.render_to_response_view_with_multiple_templates),
url(r'^render_to_response/request_context/$', views.render_to_response... | bsd-3-clause |
pskrz/ansible | lib/ansible/inventory/script.py | 27 | 6367 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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) an... | gpl-3.0 |
mathieui/pleaseshare | pleaseshare/default_settings.py | 1 | 1907 | # The folder in which the uploaded files will be stored
# each upload will be in UPLOAD_FOLDER/<uuid4>/.
UPLOAD_FOLDER = "uploads"
# URL allowing access to UPLOAD_FOLDER (terminated by a /)
UPLOADED_FILES_URL = 'http://path-to-the-uploads/directory/'
# Allow users to add other trackers in the form
ALLOW_TRACKERS = Tr... | agpl-3.0 |
iulian787/spack | var/spack/repos/builtin/packages/py-netcdf4/package.py | 2 | 2532 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyNetcdf4(PythonPackage):
"""Python interface to the netCDF Library."""
homepage = "h... | lgpl-2.1 |
mattseymour/django | tests/model_fields/test_imagefield.py | 2 | 16551 | import os
import shutil
from unittest import skipIf
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.core.files import File
from django.core.files.images import ImageFile
from django.test import TestCase
from django.test.testcases import SerializeMixin
try:
from .models import ... | bsd-3-clause |
Zanzibar82/pelisalacarta | python/main-classic/channels/guaridavalencianista.py | 5 | 12757 | # -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para guaridavalencianista
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
im... | gpl-3.0 |
yqm/sl4a | python/src/Lib/test/time_hashlib.py | 213 | 2856 | # It's intended that this script be run by hand. It runs speed tests on
# hashlib functions; it does not test for correctness.
import sys, time
import hashlib
def creatorFunc():
raise RuntimeError, "eek, creatorFunc not overridden"
def test_scaled_msg(scale, name):
iterations = 106201/scale * 20
longSt... | apache-2.0 |
nasfarley88/pyhabitica | habiticaapi/character.py | 1 | 8492 | from .habitica_object import HabiticaObject
from .task import Task
from .item import InventoryItem
import attrdict
# TODO consider having all HabiticaObjects do the _json and __getattr__ and __setattr__ thing
class Character(HabiticaObject):
def __init__(self, uuid, apikey):
super(Character, self).__init__... | cc0-1.0 |
LukeHoersten/ansible | v1/ansible/cache/__init__.py | 133 | 1828 | # (c) 2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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 lat... | gpl-3.0 |
pbeeler/Linux-stable | scripts/tracing/draw_functrace.py | 14676 | 3560 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... | gpl-2.0 |
OmarIthawi/edx-platform | lms/djangoapps/instructor_task/tests/test_tasks_helper.py | 9 | 4496 | """
Unit tests for LMS instructor-initiated background tasks helper functions.
Tests that CSV grade report generation works with unicode emails.
"""
import ddt
from mock import Mock, patch
from django.test.testcases import TestCase
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.... | agpl-3.0 |
TalShafir/ansible | lib/ansible/modules/network/onyx/onyx_lldp_interface.py | 118 | 7407 | #!/usr/bin/python
#
# Copyright: Ansible Project
# 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',
'status': ['preview'],
... | gpl-3.0 |
40223131/W17test | static/Brython3.1.1-20150328-091302/Lib/xml/dom/minidom.py | 727 | 66854 | """Simple implementation of the Level 1 DOM.
Namespaces and other minor Level 2 features are also supported.
parse("foo.xml")
parseString("<foo><bar/></foo>")
Todo:
=====
* convenience methods for getting elements and text.
* more testing
* bring some of the writer and linearizer code into conformance with this
... | gpl-3.0 |
WangKaimin/sublime-evernote | lib/pygments/formatters/other.py | 9 | 3806 | # -*- coding: utf-8 -*-
"""
pygments.formatters.other
~~~~~~~~~~~~~~~~~~~~~~~~~
Other formatters: NullFormatter, RawTokenFormatter.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.formatter import Formatter
from pygments... | mit |
allenyao0702/shuati | Intersections.py | 1 | 1390 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
#region Intersection of Two Linked List
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtyp... | mit |
neumerance/cloudloon2 | .venv/lib/python2.7/site-packages/sphinx/builders/devhelp.py | 5 | 4092 | # -*- coding: utf-8 -*-
"""
sphinx.builders.devhelp
~~~~~~~~~~~~~~~~~~~~~~~
Build HTML documentation and Devhelp_ support files.
.. _Devhelp: http://live.gnome.org/devhelp
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
f... | apache-2.0 |
fbagirov/scikit-learn | sklearn/svm/base.py | 156 | 36018 | from __future__ import print_function
import numpy as np
import scipy.sparse as sp
import warnings
from abc import ABCMeta, abstractmethod
from . import libsvm, liblinear
from . import libsvm_sparse
from ..base import BaseEstimator, ClassifierMixin, ChangedBehaviorWarning
from ..preprocessing import LabelEncoder
from... | bsd-3-clause |
I2Cvb/mp-mri-prostate | pipeline/feature-extraction/adc/pipeline_extraction_haralick_adc.py | 1 | 3181 | """
This pipeline is intended to extract Haralick features from ADC images.
"""
import os
import numpy as np
from protoclass.data_management import ADCModality
from protoclass.data_management import GTModality
from protoclass.preprocessing import PiecewiseLinearNormalization
from protoclass.extraction import Haral... | mit |
yonglehou/pybrain | pybrain/tests/unittests/supervised/trainers/test_evolino.py | 35 | 1418 | """
>>> import numpy
>>> from pybrain.datasets.sequential import SequentialDataSet
>>> from pybrain.structure.modules.evolinonetwork import EvolinoNetwork
>>> from pybrain.supervised.trainers.evolino import EvolinoTrainer
>>> dataset = SequentialDataSet(0,1)
>>> dataset.newSeq... | bsd-3-clause |
wangyum/spark | examples/src/main/python/mllib/regression_metrics_example.py | 158 | 2104 | #
# 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 us... | apache-2.0 |
apple/llvm-project | lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py | 4 | 2136 | """
Test utility functions for the frame object.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class FrameUtilsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(s... | apache-2.0 |
AlexHatesUnicorns/FDTD_Solver | postprocessing/calculate_spot.py | 2 | 5895 | import numpy as np
import matplotlib.pyplot as plt
import argparse
import traceback
import tarfile
import os
import re
import time
def read_tarinfo(fname):
tar = tarfile.open(fname)
return list(tar.getmembers()), tar
def read(file, tar_info):
f = file.extractfile(tar_info)
if f is None:
retu... | mit |
jolevq/odoopub | addons/survey/__openerp__.py | 64 | 2413 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms... | agpl-3.0 |
mcking49/apache-flask | Python/Lib/robotparser.py | 52 | 7588 | """ robotparser.py
Copyright (C) 2000 Bastian Kleineidam
You can choose between two licenses when using this package:
1) GNU GPLv2
2) PSF license for Python 2.2
The robots.txt Exclusion Protocol is implemented as specified in
http://www.robotstxt.org/norobots-rfc.txt
"""
import urlparse
imp... | mit |
emsrc/daeso-framework | lib/daeso/utils/report.py | 1 | 1110 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2013 by Erwin Marsi and TST-Centrale
#
# This file is part of the DAESO Framework.
#
# The DAESO Framework 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 ... | gpl-3.0 |
hunch/hunch-sample-app | django/contrib/gis/tests/geoapp/test_sitemaps.py | 9 | 4146 | import cStringIO
from xml.dom import minidom
import zipfile
from django.test import Client
from django.utils import unittest
from models import City, Country
class GeoSitemapTest(unittest.TestCase):
client = Client()
def assertChildNodes(self, elem, expected):
"Taken from regressionte... | mit |
kaushik94/twitter-sentiment-analyzer | simpleDemo.py | 2 | 3087 | #import regex
import re
import csv
import pprint
import nltk.classify
#start replaceTwoOrMore
def replaceTwoOrMore(s):
#look for 2 or more repetitions of character
pattern = re.compile(r"(.)\1{1,}", re.DOTALL)
return pattern.sub(r"\1\1", s)
#end
#start process_tweet
def processTweet(tweet):
# process... | gpl-2.0 |
forte916/hello_world | python/datetime.py | 1 | 2093 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import time
import calendar
def showTimezone():
# TOOD:: You need to implement subclass of datetime.tzinfo for handling timezone
# With python 3, you can do this using the built-in datetime.timezone object
pass
def showToday():
print('{} ... | mit |
Lustralisk/rcnn | external/liblinear-1.94/python/liblinear.py | 37 | 8400 | #!/usr/bin/env python
from ctypes import *
from ctypes.util import find_library
from os import path
import sys
try:
dirname = path.dirname(path.abspath(__file__))
if sys.platform == 'win32':
liblinear = CDLL(path.join(dirname, r'..\windows\liblinear.dll'))
else:
liblinear = CDLL(path.join(dirname, '../liblinea... | bsd-2-clause |
nomadcube/scikit-learn | examples/covariance/plot_mahalanobis_distances.py | 348 | 6232 | r"""
================================================================
Robust covariance estimation and Mahalanobis distances relevance
================================================================
An example to show covariance estimation with the Mahalanobis
distances on Gaussian distributed data.
For Gaussian dis... | bsd-3-clause |
jalexvig/tensorflow | tensorflow/examples/learn/text_classification_cnn.py | 21 | 5221 | # 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 appl... | apache-2.0 |
toobaz/pandas | pandas/tests/util/test_hashing.py | 2 | 11248 | import datetime
import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame, Index, MultiIndex, Series
from pandas.core.util.hashing import _hash_scalar, hash_tuple, hash_tuples
from pandas.util import hash_array, hash_pandas_object
import pandas.util.testing as tm
@pytest.fixture(
params=... | bsd-3-clause |
Shrulik/Open-Knesset | mks/migrations/0017_auto__add_field_member_average_weekly_presence_hours.py | 15 | 10803 | # encoding: 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 'Member.average_weekly_presence_hours'
db.add_column('mks_member', 'average_weekly_presence... | bsd-3-clause |
urwid/urwid | urwid/tests/test_escapes.py | 4 | 2944 | #!/usr/bin/python
# -*- coding: utf-8 -*-
""" Tests covering escape sequences processing """
import unittest
import urwid.escape
class InputEscapeSequenceParserTest(unittest.TestCase):
""" Tests for parser of input escape sequences """
def test_bare_escape(self):
codes = [27]
expected = ['... | lgpl-2.1 |
domenicosolazzo/philocademy | venv/src/node-v0.10.36/tools/gyp/pylib/gyp/generator/msvs.py | 51 | 124525 | # Copyright (c) 2012 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.
import collections
import copy
import ntpath
import os
import posixpath
import re
import subprocess
import sys
import gyp.common
import gyp.easy_xml as easy_xml
i... | mit |
Ulauncher/Ulauncher | ulauncher/api/shared/item/ResultItem.py | 1 | 4918 | from typing import Any, Callable, Optional
from ulauncher.api.shared.action.BaseAction import BaseAction
from ulauncher.search.Query import Query
from ulauncher.utils.text_highlighter import highlight_text
from ulauncher.utils.display import get_monitor_scale_factor
OnEnterCallback = Optional[Callable[[Query], Option... | gpl-3.0 |
andrewmoses/ssquiz | flask/lib/python2.7/site-packages/six.py | 878 | 29664 | """Utilities for writing code that runs on Python 2 and 3"""
# Copyright (c) 2010-2015 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including with... | bsd-3-clause |
paweljasinski/ironpython3 | Src/StdLib/Lib/ctypes/__init__.py | 11 | 17036 | """create and manipulate C data types in Python"""
import os as _os, sys as _sys
__version__ = "1.1.0"
from _ctypes import Union, Structure, Array
from _ctypes import _Pointer
from _ctypes import CFuncPtr as _CFuncPtr
from _ctypes import __version__ as _ctypes_version
from _ctypes import RTLD_LOCAL, RTLD_GLOBAL
from... | apache-2.0 |
IntelLabs/numba | numba/cuda/tests/cudapy/test_inspect.py | 4 | 5835 | import numpy as np
import warnings
from io import StringIO
from numba import cuda, float32, float64, int32, intp
from numba.core.errors import NumbaDeprecationWarning
from numba.cuda.testing import unittest, CUDATestCase
from numba.cuda.testing import (skip_on_cudasim, skip_with_nvdisasm,
... | bsd-2-clause |
hkhamm/django_rest_tutorial_2 | env/lib/python2.7/site-packages/pip/_vendor/requests/structures.py | 398 | 3575 | # -*- coding: utf-8 -*-
"""
requests.structures
~~~~~~~~~~~~~~~~~~~
Data structures that power Requests.
"""
import os
import collections
from itertools import islice
class IteratorProxy(object):
"""docstring for IteratorProxy"""
def __init__(self, i):
self.i = i
# self.i = chain.from_iter... | mit |
mzdaniel/oh-mainline | vendor/packages/Django/django/contrib/gis/tests/test_spatialrefsys.py | 154 | 6782 | from django.db import connection
from django.contrib.gis.gdal import GDAL_VERSION
from django.contrib.gis.tests.utils import mysql, no_mysql, oracle, postgis, spatialite
from django.utils import unittest
test_srs = ({'srid' : 4326,
'auth_name' : ('EPSG', True),
'auth_srid' : 4326,
... | agpl-3.0 |
zhangguiyu/djangocms-cascade | cmsplugin_cascade/bootstrap3/glyphicons.py | 6 | 4784 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.forms import widgets
from django.forms.widgets import RadioFieldRenderer
from django.utils.html import format_html, format_html_join
class GlyphiconRenderer(RadioFieldRenderer):
"""
This render has been prepared to prefix and append i... | mit |
darjus-amzn/boto | tests/mturk/cleanup_tests.py | 136 | 1463 | import itertools
from _init_environment import SetHostMTurkConnection
from _init_environment import config_environment
def description_filter(substring):
return lambda hit: substring in hit.Title
def disable_hit(hit):
return conn.disable_hit(hit.HITId)
def dispose_hit(hit):
# assignments must be first approved o... | mit |
dednal/chromium.src | third_party/closure_linter/closure_linter/common/position.py | 285 | 3324 | #!/usr/bin/env python
#
# Copyright 2008 The Closure Linter 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
#... | bsd-3-clause |
h3biomed/luigi | test/clone_test.py | 24 | 2286 | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | apache-2.0 |
macs03/demo-cms | cms/lib/python2.7/site-packages/django/core/files/uploadhandler.py | 104 | 6473 | """
Base file upload handler classes, and the built-in concrete subclasses
"""
from __future__ import unicode_literals
from io import BytesIO
from django.conf import settings
from django.core.files.uploadedfile import TemporaryUploadedFile, InMemoryUploadedFile
from django.utils.encoding import python_2_unicode_comp... | mit |
geekboxzone/lollipop_external_chromium_org | native_client_sdk/src/build_tools/generate_notice.py | 111 | 2710 | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Build the NOTICE file distributed with the NaCl SDK from a set of given
license files."""
import optparse
import os
import sys
... | bsd-3-clause |
cjforman/pele | pele/systems/morse_bulk.py | 1 | 2074 | import numpy as np
from morse_cluster import MorseCluster
from pele.potentials import Morse
from pele.mindist.periodic_exact_match import ExactMatchPeriodic, MeasurePeriodic
from pele.mindist import optimize_permutations
def put_in_box(x, boxvec):
x = x.reshape(-1, boxvec.size)
x -= boxvec * np.round(x / box... | gpl-3.0 |
tequa/ammisoft | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/idlelib/idle_test/test_grep.py | 50 | 2762 | """ !Changing this line will break Test_findfile.test_found!
Non-gui unit tests for idlelib.GrepDialog methods.
dummy_command calls grep_it calls findfiles.
An exception raised in one method will fail callers.
Otherwise, tests are mostly independent.
*** Currently only test grep_it.
"""
import unittest
from test.test_s... | bsd-3-clause |
sofianehaddad/ot-svn | python/test/t_Description_std.py | 2 | 1336 | #! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
# Default constructor
desc1 = Description()
ref_desc1 = desc1
# Check method add()
desc1.add("X")
desc1.add("Y")
size = desc1.getSize()
print "size of desc1 = ", size
val1 = ref_desc1[0]
val2 = ref_desc1[1]
print "desc1[0] = ", val1
print "desc1[1] = ... | mit |
pestrickland/pelican-plugins | tipue_search/tipue_search.py | 13 | 3258 | # -*- coding: utf-8 -*-
"""
Tipue Search
============
A Pelican plugin to serialize generated HTML to JSON
that can be used by jQuery plugin - Tipue Search.
Copyright (c) Talha Mansoor
"""
from __future__ import unicode_literals
import os.path
import json
from bs4 import BeautifulSoup
from codecs import open
try:
... | agpl-3.0 |
pbaesse/Sissens | lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/euctwfreq.py | 3133 | 34872 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... | gpl-3.0 |
sgml/popcorn_maker | vendor-local/lib/python/django_extensions/management/commands/runjob.py | 44 | 2261 | from django.core.management.base import LabelCommand
from optparse import make_option
from django_extensions.management.jobs import get_job, print_jobs
class Command(LabelCommand):
option_list = LabelCommand.option_list + (
make_option('--list', '-l', action="store_true", dest="list_jobs",
hel... | bsd-3-clause |
CiroArtigot/ababool | node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py | 542 | 45270 | # Copyright (c) 2012 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.
# Notes:
#
# This generates makefiles suitable for inclusion into the Android build system
# via an Android.mk file. It is based on make.py, the standard makefile
... | mit |
SaschaMester/delicium | ppapi/native_client/tests/breakpad_crash_test/crash_dump_tester.py | 154 | 8545 | #!/usr/bin/python
# Copyright (c) 2012 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.
import os
import subprocess
import sys
import tempfile
import time
script_dir = os.path.dirname(__file__)
sys.path.append(os.path.join... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.