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 |
|---|---|---|---|---|---|
badubizzle/whookapp | src/Yowsup/Media/uploader.py | 21 | 4872 | from ..Common.Http.warequest import WARequest
from ..Common.Http.waresponseparser import JSONResponseParser
import socket, ssl, mimetypes, os, hashlib, sys
from time import sleep
class MediaUploader(WARequest):
def __init__(self, jid, accountJid, successClbk = None, errorClbk = None, progressCallback = None):
... | mit |
lokeshjindal15/pd-gem5 | src/python/m5/options.py | 88 | 5158 | # Copyright (c) 2005 The Regents of The University of Michigan
# 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
# notice, this list ... | bsd-3-clause |
smther/vnpy | vn.demo/ctpdemo/tdtest.py | 96 | 4886 | # encoding: UTF-8
import sys
from time import sleep
from PyQt4 import QtGui
from vnctptd import *
#----------------------------------------------------------------------
def print_dict(d):
"""按照键值打印一个字典"""
for key,value in d.items():
print key + ':' + str(value)
#------------------... | mit |
hsuantien/scikit-learn | sklearn/linear_model/tests/test_least_angle.py | 44 | 17033 | import tempfile
import shutil
import os.path as op
import warnings
from nose.tools import assert_equal
import numpy as np
from scipy import linalg
from sklearn.cross_validation import train_test_split
from sklearn.externals import joblib
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.t... | bsd-3-clause |
thehajime/ns-3-dev | src/tap-bridge/bindings/modulegen__gcc_LP64.py | 5 | 248562 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | gpl-2.0 |
prampey/servo | tests/wpt/web-platform-tests/old-tests/webdriver/user_input/click_test.py | 141 | 10579 | import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
repo_root = os.path.abspath(os.path.join(__file__, "../../.."))
sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver"))
from webdriver import exceptions, wait
class ClickTest(base_tes... | mpl-2.0 |
pwyliu/cloud-init-0.6.3 | cloudinit/DataSourceConfigDrive.py | 2 | 6973 | # Copyright (C) 2012 Canonical Ltd.
#
# Author: Scott Moser <scott.moser@canonical.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# This program is distrib... | gpl-3.0 |
rrrene/django | tests/proxy_models/models.py | 192 | 4491 | """
By specifying the 'proxy' Meta attribute, model subclasses can specify that
they will take data directly from the table of their base class table rather
than using a new table of their own. This allows them to act as simple proxies,
providing a modified interface to the data from the base class.
"""
from django.db ... | bsd-3-clause |
Djabbz/wakatime | wakatime/packages/pygments_py2/pygments/console.py | 135 | 1850 | # -*- coding: utf-8 -*-
"""
pygments.console
~~~~~~~~~~~~~~~~
Format colored console output.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
esc = "\x1b["
codes = {}
codes[""] = ""
codes["reset"] = esc + "39;49;00m"
cod... | bsd-3-clause |
skirsdeda/django | django/db/models/related.py | 34 | 3413 | from collections import namedtuple
from django.utils.encoding import smart_text
from django.db.models.fields import BLANK_CHOICE_DASH
# PathInfo is used when converting lookups (fk__somecol). The contents
# describe the relation in Model terms (model Options and Fields for both
# sides of the relation. The join_field... | bsd-3-clause |
willcode/gnuradio | gr-blocks/python/blocks/qa_probe_signal.py | 5 | 1305 | #!/usr/bin/env python
#
# Copyright 2012-2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest, blocks
class test_probe_signal(gr_unittest.TestCase):
def setUp(self):
self.tb = gr.top_block()
de... | gpl-3.0 |
locustio/locust | setup.py | 1 | 1030 | # -*- coding: utf-8 -*-
import ast
import os
import re
import sys
from setuptools import find_packages, setup
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
# parse version from locust/__init__.py
_version_re = re.compile(r"__version__\s+=\s+(.*)")
_init_file = os.path.join(ROOT_PATH, "locust", "__init__.py"... | mit |
martincochran/score-minion | twitter_fetcher.py | 1 | 11856 | #!/usr/bin/env python
#
# Copyright 2014 Martin Cochran
#
# 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 la... | apache-2.0 |
pcc/ninja | src/browse.py | 2 | 4131 | #!/usr/bin/python
#
# Copyright 2001 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... | apache-2.0 |
shuaiharry/IntelligentSelection | lib/werkzeug/routing.py | 313 | 62520 | # -*- coding: utf-8 -*-
"""
werkzeug.routing
~~~~~~~~~~~~~~~~
When it comes to combining multiple controller or view functions (however
you want to call them) you need a dispatcher. A simple way would be
applying regular expression tests on the ``PATH_INFO`` and calling
registered callback fun... | apache-2.0 |
jingr1/Linux-4.2.1-for-OK6410 | Documentation/target/tcm_mod_builder.py | 337 | 24391 | #!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... | gpl-2.0 |
biodrone/plex-desk | desk/flask/lib/python3.4/site-packages/defusedxml/ElementTree.py | 53 | 4031 | # defusedxml
#
# Copyright (c) 2013 by Christian Heimes <christian@python.org>
# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/psf/license for licensing details.
"""Defused xml.etree.ElementTree facade
"""
from __future__ import print_function, absolute_import
import sys
from .common impor... | mit |
Thapelo-Tsotetsi/rapidpro | temba/ivr/migrations/0002_auto_20141126_2054.py | 7 | 1751 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ivr', '0001_initial'),
('flows', '0001_initial'),
('orgs', '0001_initial'),
]
opera... | agpl-3.0 |
catroot/rethinkdb | test/common/http_support/jinja2/optimizer.py | 1401 | 2302 | # -*- coding: utf-8 -*-
"""
jinja2.optimizer
~~~~~~~~~~~~~~~~
The jinja optimizer is currently trying to constant fold a few expressions
and modify the AST in place so that it should be easier to evaluate it.
Because the AST does not contain all the scoping information and the
compiler has to ... | agpl-3.0 |
cobalys/django | django/contrib/auth/tests/remote_user.py | 93 | 6554 | from datetime import datetime
from django.conf import settings
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
class RemoteUserTest(TestCase):
urls = 'django.contrib.auth.tests.urls'
mid... | bsd-3-clause |
musically-ut/statsmodels | statsmodels/duration/tests/phreg_gentests.py | 34 | 1924 | import numpy as np
"""
Generate data sets for testing Cox proportional hazards regression
models.
After updating the test data sets, use R to run the survival.R script
to update the R results.
"""
# The current data may not reflect this seed
np.random.seed(5234)
# Loop over pairs containing (sample size, number of ... | bsd-3-clause |
2rs2ts/moto | moto/events/responses.py | 2 | 6441 | import json
import re
from moto.core.responses import BaseResponse
from moto.events import events_backend
class EventsHandler(BaseResponse):
def _generate_rule_dict(self, rule):
return {
'Name': rule.name,
'Arn': rule.arn,
'EventPattern': rule.event_pattern,
... | apache-2.0 |
IDEHCO3/geonode | idehco3/utils/utils.py | 2 | 2610 |
import unicodedata
import simplejson
from django.http import HttpResponse
import shapefile
class JsonResponse(HttpResponse):
"""
JSON Response
"""
def __init__(self, content, mimetype='application/json', status=None, content_type=None):
super(JsonResponse, self).__init__(
conte... | gpl-3.0 |
CartoDB/crankshaft | release/python/0.9.0/crankshaft/crankshaft/regression/gwr/base/gwr.py | 2 | 39275 | #Main GWR classes
#Offset does not yet do anyhting and needs to be implemented
__author__ = "Taylor Oshan Tayoshan@gmail.com"
import numpy as np
import numpy.linalg as la
from scipy.stats import t
from .kernels import *
from .diagnostics import get_AIC, get_AICc, get_BIC
import pysal.spreg.user_output as USER
from c... | bsd-3-clause |
kcrossan/libcmus | cmus.py | 1 | 51955 | '''Wrapper for track_info.h
Generated with:
C:/msys/bin/ctypesgen.py -l libcmus track_info.h player.h input.h output.h debug.h buffer.h -o cmus.py
Do not modify this file.
'''
__docformat__ = 'restructuredtext'
# Begin preamble
import ctypes, os, sys
from ctypes import *
_int_types = (c_int16, c_int32)
if hasatt... | gpl-2.0 |
waheedahmed/edx-platform | pavelib/paver_tests/test_paver_bok_choy_cmds.py | 3 | 8621 | """
Tests for the bok-choy paver commands themselves.
Run just this test with: paver test_lib -t pavelib/paver_tests/test_paver_bok_choy_cmds.py
"""
import os
import unittest
from mock import patch, call
from test.test_support import EnvironmentVarGuard
from paver.easy import BuildFailure
from pavelib.utils.test.suite... | agpl-3.0 |
nataddrho/DigiCue-USB | Python3/src/venv/Lib/site-packages/pip/_vendor/packaging/specifiers.py | 8 | 32208 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import abc
import functools
import itertools
import re
import warnings
fr... | mit |
DepthDeluxe/ansible | lib/ansible/plugins/callback/log_plays.py | 44 | 3269 | # (C) 2012, 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 |
svenstaro/ansible | lib/ansible/modules/windows/win_dns_client.py | 32 | 2648 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, 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 ... | gpl-3.0 |
KiChjang/servo | tests/wpt/web-platform-tests/tools/third_party/hyper/hyper/http20/stream.py | 36 | 11947 | # -*- coding: utf-8 -*-
"""
hyper/http20/stream
~~~~~~~~~~~~~~~~~~~
Objects that make up the stream-level abstraction of hyper's HTTP/2 support.
These objects are not expected to be part of the public HTTP/2 API: they're
intended purely for use inside hyper's HTTP/2 abstraction.
Conceptually, a single HTTP/2 connect... | mpl-2.0 |
h-hirokawa/swampdragon | swampdragon/tests/mock_connection.py | 1 | 2987 | from .. import route_handler
from ..pubsub_providers.subscriber_factory import get_subscription_provider
from ..sessions.sessions import get_session_store
import json
import uuid
pubsub = get_subscription_provider()
session_store = get_session_store()
class TestSession(object):
def __init__(self):
self.... | bsd-3-clause |
waytai/picture | picture/settings.py | 1 | 5636 | # Django settings for picture project.
import os
Pro_dir = os.path.abspath('')
Temp_dir = os.path.join(Pro_dir , 'picture' ,'template').replace('\\','/')
Html_dir = os.path.join(Temp_dir , 'html')
Css_dir = os.path.join(Temp_dir , 'css')
Javascript_dir = os.path.join(Temp_dir , 'javascript')
Img_dir = os.path.join(Te... | mit |
NeCTAR-RC/nova | nova/tests/unit/api/openstack/compute/test_suspend_server.py | 35 | 3522 | # Copyright 2013 IBM Corp.
#
# 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 t... | apache-2.0 |
andrewmchen/incubator-airflow | airflow/hooks/sqlite_hook.py | 62 | 1026 | # -*- coding: utf-8 -*-
#
# 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
... | apache-2.0 |
dparshin/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/steps/obsoletepatches.py | 125 | 2318 | # Copyright (C) 2010 Google Inc. 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
# notice, this list of conditions and th... | bsd-3-clause |
quxiaolong1504/dpark | dpark/bitindex.py | 14 | 4649 | import itertools
import marshal
import math
from dpark.portable_hash import portable_hash
BYTE_SHIFT = 3
BYTE_SIZE = 1 << BYTE_SHIFT
BYTE_MASK = BYTE_SIZE - 1
_table = [(), (0,), (1,), (0,1), (2,), (0,2), (1,2), (0,1,2), (3,),
(0,3), (1,3), (0,1,3), (2,3), (0,2,3), (1,2,3), (0,1,2,3)]
class BitIndex(object... | bsd-3-clause |
zhlinh/leetcode | 0312.Burst Balloons/solution.py | 1 | 1890 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
*****************************************
Author: zhlinh
Email: zhlinhng@gmail.com
Version: 0.0.1
Created Time: 2016-05-16
Last_modify: 2016-05-16
******************************************
'''
'''
Given n balloons, indexed from 0 to n-1.
E... | apache-2.0 |
cesargtz/YecoraOdoo | addons/mail/tests/test_invite.py | 199 | 2591 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
prune998/ansible | lib/ansible/modules/commands/expect.py | 17 | 7711 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Matt Martz <matt@sivel.net>
#
# 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, ... | gpl-3.0 |
mxOBS/deb-pkg_trusty_chromium-browser | third_party/webdriver/pylib/test/selenium/webdriver/common/window_tests.py | 21 | 1567 | # Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 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 requir... | bsd-3-clause |
WhittKinley/aima-python | submissions/Porter/project/cspSubmissions.py | 3 | 1932 | import importlib
import traceback
from util import roster, print_table
from csp import backtracking_search, lcv, mrv, mac
import myCSPs
# import tkinter
# from Porter.Output import sudokuGUI
# gui = sudokuGUI.initialize(sudokuGUI(tkinter))
# states = {}
# 'A1': 3, 'A3': 1, 'A4': 5, 'A5': 2, 'A6': 9,
# ... | mit |
jankoslavic/numpy | numpy/doc/internals.py | 163 | 9673 | """
===============
Array Internals
===============
Internal organization of numpy arrays
=====================================
It helps to understand a bit about how numpy arrays are handled under the covers to help understand numpy better. This section will not go into great detail. Those wishing to understand the ... | bsd-3-clause |
takis/django | django/core/checks/security/csrf.py | 477 | 1796 | from django.conf import settings
from .. import Tags, Warning, register
W003 = Warning(
"You don't appear to be using Django's built-in "
"cross-site request forgery protection via the middleware "
"('django.middleware.csrf.CsrfViewMiddleware' is not in your "
"MIDDLEWARE_CLASSES). Enabling the middle... | bsd-3-clause |
froyobin/ironic | ironic/cmd/dbsync.py | 7 | 2897 | # -*- encoding: utf-8 -*-
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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.a... | apache-2.0 |
nharraud/b2share | invenio/legacy/bibindex/engine_config.py | 13 | 2853 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011 CERN.
#
# Invenio 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
# Li... | gpl-2.0 |
windedge/odoo | addons/hw_escpos/__openerp__.py | 315 | 1780 | # -*- 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 |
fhe-odoo/odoo | addons/analytic/wizard/account_analytic_inverted_balance_report.py | 378 | 2045 | # -*- 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 |
DreaminginCodeZH/shadowsocks | shadowsocks/tcprelay.py | 922 | 28870 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 clowwindy
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | apache-2.0 |
sorgerlab/indra | indra/tests/test_pmc_client.py | 3 | 3774 | from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
from indra.literature import pmc_client
from nose.tools import raises
from indra.util import unicode_strs
from nose.plugins.attrib import attr
example_ids = {'pmid': '25361007',
'pmcid': 'PMC4322985',... | bsd-2-clause |
amentis/Rexi | RxAPI/RxGUI/Border.py | 1 | 1108 | __author__ = 'amentis'
from RxAPI.RxGUI import Color, RxGUIObject
class Border(RxGUIObject):
"""
Drawable border for any drawable RxGUIObject.
"""
def __init__(self, name, color=None, style="solid", width="1px"):
"""
@param name: str name of the REXI object
@param color: Color ... | apache-2.0 |
arcyfelix/Courses | 18-11-22-Deep-Learning-with-PyTorch/02-Introduction to PyTorch/fc_model.py | 1 | 3543 | import torch
from torch import nn
import torch.nn.functional as F
class Network(nn.Module):
def __init__(self, input_size, output_size, hidden_layers, drop_p=0.5):
''' Builds a feedforward network with arbitrary hidden layers.
Arguments
---------
input_size: in... | apache-2.0 |
eeshangarg/oh-mainline | vendor/packages/Django/django/contrib/formtools/wizard/legacy.py | 115 | 11275 | """
FormWizard class -- implements a multi-page form, validating between each
step and storing the form's state as HTML hidden fields so that no state is
stored on the server side.
"""
from django.forms import HiddenInput
from django.http import Http404
from django.shortcuts import render_to_response
from django.templa... | agpl-3.0 |
javipalanca/xmppd | modules/muc.py | 4 | 165392 | # -*- coding: utf-8 -*-
from xmpp import *
import types
import copy
import pickle
class BadPassword(Exception):
'''
The user provided a wrong password
'''
def __init__(self):
pass
class NotAMember(Exception):
'''
The user is not a member of the room
'''
def __init__(self):
... | gpl-2.0 |
kernbeisser/python_koans | python3/koans/about_list_assignments.py | 4 | 1237 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutArrayAssignments in the Ruby Koans
#
from runner.koan import *
class AboutListAssignments(Koan):
def test_non_parallel_assignment(self):
names = ["John", "Smith"]
self.assertEqual(['John', 'Smith'], names)
def test_parallel_assi... | mit |
gavoski/audacity | lib-src/lv2/lilv/waflib/ConfigSet.py | 61 | 3736 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import copy,re,os
from waflib import Logs,Utils
re_imp=re.compile('^(#)*?([^#=]*?)\ =\ (.*?)$',re.M)
class ConfigSet(object):
__slots__=('table','parent')
def __init__(self,... | gpl-2.0 |
mikebsg01/Online-Judge-Solutions | UVa/11225-TarotScores.py | 3 | 1061 | from sys import stdin
def readLine():
return stdin.readline().strip()
def readInt():
return int(readLine())
def readInts():
return list(map(int, readLine().split()))
achieve = [56, 51, 41, 36]
def isOudler(s):
return s.startswith('one') or s.startswith('twenty-one') or s.startswith('fool')
def isKing(s):
ret... | mit |
ioggstream/python-course | python-for-sysadmin/scripts/03_parsing_test.py | 1 | 1544 | """ Python for System Administrators
Roberto Polli <rpolli@babel.it>
This file shows how to parse a postfix maillog file.
maillog traces every incoming and outgoing email using
different line formats.
"""
#
# Before writing the parser we collect the
# interesting lines to use as a sample
# For no... | agpl-3.0 |
rintoj/ai | demo/reinforcement/analysis.py | 1 | 2029 | # analysis.py
# -----------
# Licensing Information: Please do not distribute or publish solutions to this
# project. You are free to use and extend these projects for educational
# purposes. The Pacman AI projects were developed at UC Berkeley, primarily by
# John DeNero (denero@cs.berkeley.edu) and Dan Klein (klein@c... | mit |
poondog/m7_stock_443 | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 11088 | 3246 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | gpl-2.0 |
alikins/ansible | lib/ansible/modules/cloud/google/gcpubsub_facts.py | 95 | 4359 | #!/usr/bin/python
# Copyright 2016 Google Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
chendaniely/pystan | pystan/tests/test_pickle.py | 1 | 2959 | import os
import pickle
import sys
import tempfile
import unittest
import pystan
class TestPickle(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.pickle_file = os.path.join(tempfile.mkdtemp(), 'stanmodel.pkl')
cls.model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
de... | gpl-3.0 |
otherness-space/myProject | my_project_001/lib/python2.7/site-packages/django/db/backends/util.py | 108 | 4821 | from __future__ import unicode_literals
import datetime
import decimal
import hashlib
import logging
from time import time
from django.conf import settings
from django.utils.encoding import force_bytes
from django.utils.timezone import utc
logger = logging.getLogger('django.db.backends')
class CursorWrapper(objec... | mit |
Ichag/odoo | addons/crm_profiling/wizard/__init__.py | 438 | 1080 | # -*- 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... | agpl-3.0 |
salabim/salabim | sample models/Lock animated.py | 1 | 6668 | import salabim as sim
left = -1
right = +1
def sidename(side):
return "l" if side == left else "r"
def shipcolor(side):
return "blue" if side == left else "red"
def ship_polygon(ship):
return (ship.side * (ship.length - 2), 0, ship.side * 3, 0, ship.side * 2, 3, ship.side * (ship.length - 2), 3)
de... | mit |
Novamap-SAS/ZXing-GesMop | cpp/scons/scons-local-2.0.0.final.0/SCons/Scanner/Fortran.py | 34 | 14360 | """SCons.Scanner.Fortran
This module implements the dependency scanner for Fortran code.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentati... | apache-2.0 |
JT5D/scikit-learn | sklearn/linear_model/logistic.py | 8 | 5318 | import numpy as np
from .base import LinearClassifierMixin, SparseCoefMixin
from ..feature_selection.from_model import _LearntSelectorMixin
from ..svm.base import BaseLibLinear
class LogisticRegression(BaseLibLinear, LinearClassifierMixin,
_LearntSelectorMixin, SparseCoefMixin):
"""Logis... | bsd-3-clause |
Ultimaker/Cura | plugins/DigitalLibrary/src/DigitalFactoryProjectResponse.py | 1 | 2689 | # Copyright (c) 2021 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from datetime import datetime
from typing import Optional, List, Dict, Any
from .BaseModel import BaseModel
from .DigitalFactoryFileResponse import DIGITAL_FACTORY_RESPONSE_DATETIME_FORMAT
class DigitalFactoryProjectRespo... | lgpl-3.0 |
bema-ligo/pycbc | examples/workflow/data_checker/daily_test.py | 2 | 6794 | #!/usr/bin/env python
# Copyright (C) 2013 Ian W. Harry
#
# 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 prog... | gpl-3.0 |
ForNeVeR/styx-miranda | styx-client/protobuf-2.5.0/python/google/protobuf/internal/decoder.py | 223 | 26136 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions o... | mit |
prziborowski/pyvmomi-community-samples | samples/set_vcenter_motd.py | 4 | 2857 | #!/usr/bin/env python2.7
# William Lam
# wwww.virtuallyghetto.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | apache-2.0 |
scottcunningham/ansible | lib/ansible/plugins/lookup/url.py | 26 | 2093 | # (c) 2015, Brian Coca <bcoca@ansible.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 later version.... | gpl-3.0 |
bigdataelephants/scikit-learn | sklearn/linear_model/least_angle.py | 6 | 48722 | """
Least Angle Regression algorithm. See the documentation on the
Generalized Linear Model for a complete discussion.
"""
from __future__ import print_function
# Author: Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux
#
# License: BSD 3 ... | bsd-3-clause |
notriddle/servo | tests/wpt/web-platform-tests/tools/third_party/certifi/setup.py | 41 | 2220 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import with_statement
import re
import os
import sys
# While I generally consider it an antipattern to try and support both
# setuptools and distutils with a single setup.py, in this specific instance
# where certifi is a dependency of setuptools, it can cr... | mpl-2.0 |
bratsche/Neutron-Drive | google_appengine/lib/django_1_3/tests/regressiontests/templates/templatetags/custom.py | 49 | 3021 | from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
def trim(value, num):
return value[:num]
trim = stringfilter(trim)
register.filter(trim)
@register.simple_tag
def no_params():
"""Expected no_params __doc__"""
return "no_params - Expected r... | bsd-3-clause |
SmartInfrastructures/fuel-web-dev | fuel_upgrade_system/fuel_package_updates/fuel_package_updates/tests/base.py | 1 | 3164 | # -*- coding: utf-8 -*-
# Copyright 2015 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 requi... | apache-2.0 |
vatsalgit/Deep-Learning- | assignment1/data/deep/lib/python3.4/site-packages/pip/_vendor/requests/packages/chardet/sbcsgroupprober.py | 2936 | 3291 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | gpl-3.0 |
odootr/odoo | addons/base_report_designer/plugin/openerp_report_designer/bin/script/ExportToRML.py | 293 | 4469 | #########################################################################
#
# Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com
# Copyright (C) 2004-2013 OpenERP SA (<http://openerp.com>).
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Gene... | agpl-3.0 |
dataxu/ansible | lib/ansible/modules/cloud/vmware/vmware_host_lockdown.py | 1 | 8571 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Abhijeet Kasurde <akasurde@redhat.com>
# 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... | gpl-3.0 |
adam-iris/mailman | src/mailman/interfaces/system.py | 2 | 1135 | # Copyright (C) 2009-2014 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at you... | gpl-3.0 |
armoredsoftware/protocol | measurer/gdb-7.9/gdb/testsuite/gdb.perf/disassemble.py | 46 | 1514 | # Copyright (C) 2013-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... | bsd-3-clause |
shinglyu/ns3-h264-svc | src/applications/.waf-1.5.16-e6d03192b5ddfa5ef2c8d65308e48e42/wafadmin/Tools/gcc.py | 6 | 2779 | #! /usr/bin/env python
# encoding: utf-8
import os,sys
import Configure,Options,Utils
import ccroot,ar
from Configure import conftest
def find_gcc(conf):
cc=conf.find_program(['gcc','cc'],var='CC',mandatory=True)
cc=conf.cmd_to_list(cc)
ccroot.get_cc_version(conf,cc,gcc=True)
conf.env.CC_NAME='gcc'
conf.env.CC=cc... | gpl-2.0 |
lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/core/tests/test_eval.py | 119 | 2118 | from sympy import Symbol, Function, exp, sqrt, Rational, I, cos, tan
from sympy.utilities.pytest import XFAIL
def test_add_eval():
a = Symbol("a")
b = Symbol("b")
c = Rational(1)
p = Rational(5)
assert a*b + c + p == a*b + 6
assert c + a + p == a + 6
assert c + a - p == a + (-4)
assert... | gpl-3.0 |
yashrastogi16/python_koans | python2/koans/about_modules.py | 1 | 2549 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This is very different to AboutModules in Ruby Koans
# Our AboutMultipleInheritance class is a little more comparable
#
from runner.koan import *
from another_local_module import *
from local_module_with_all_defined import *
class AboutModules(Koan):
def test_i... | mit |
acengic/firecares | firecares/wsgi.py | 3 | 1434 | """
WSGI config for firecares project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`... | mit |
Techbikers/techbikers | server/auth/views.py | 1 | 1852 | from django.shortcuts import get_object_or_404
from django.contrib.auth.models import User
from rest_framework.permissions import IsAuthenticated
from rest_framework.generics import RetrieveAPIView
from rest_framework.permissions import IsAuthenticated, IsAdminUser
from rest_framework.authentication import BasicAuthen... | mit |
drxaero/calibre | src/html5lib/treewalkers/genshistream.py | 1730 | 2278 | from __future__ import absolute_import, division, unicode_literals
from genshi.core import QName
from genshi.core import START, END, XML_NAMESPACE, DOCTYPE, TEXT
from genshi.core import START_NS, END_NS, START_CDATA, END_CDATA, PI, COMMENT
from . import _base
from ..constants import voidElements, namespaces
class ... | gpl-3.0 |
MrLpk/nba | Backup_Collection.py | 1 | 11040 | #coding=utf-8
import urllib2
import re
import json
from pyquery import PyQuery as pq
from extlibs.MTool import MTool
def getAverage():
URL = 'http://liansai.500.com/lq/177/rank/'
_content = urllib2.urlopen(URL).read()
d = pq(_content)
_div = d('.t-content')
_result = re.findall('<td>([\d\.]{4,5})</td>', _div.eq... | agpl-3.0 |
noslenfa/tdjangorest | uw/lib/python2.7/site-packages/setuptools/command/sdist.py | 385 | 7079 | from glob import glob
from distutils import log
import distutils.command.sdist as orig
import os
import sys
from setuptools.compat import PY3
from setuptools.utils import cs_path_exists
import pkg_resources
READMES = 'README', 'README.rst', 'README.txt'
_default_revctrl = list
def walk_revctrl(dirname=''):
"""... | apache-2.0 |
daviddupont69/CouchPotatoServer | libs/suds/mx/basic.py | 211 | 1657 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser 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 in the hope that it will ... | gpl-3.0 |
kref/linux-oxnas | tools/perf/scripts/python/syscall-counts-by-pid.py | 11180 | 1927 | # system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os, sys
sys.path.append(os.env... | gpl-2.0 |
Uname-a/knife_scraper | kc_query.py | 1 | 1113 | #!/usr/bin/env python
# kc_query.py - module for sopel to query knifecenter.com for pricing data
#
# Copyright (c) 2016 Casey Bartlett <caseytb@bu.edu>
#
# See LICENSE for terms of usage, modification and redistribution.
from sopel import *
from ddg import ddg
from extract_blade_info import query_kc_knife, KnifeFo... | mit |
mandx/django-extensions | django_extensions/mongodb/fields/__init__.py | 65 | 8837 | """
MongoDB model fields emulating Django Extensions' additional model fields
These fields are essentially identical to existing Extensions fields, but South hooks have been removed (since mongo requires no schema migration)
"""
import re
import six
import datetime
from django import forms
from django.template.defau... | mit |
riklaunim/django-custom-multisite | django/db/backends/mysql/base.py | 40 | 20402 | """
MySQL database backend for Django.
Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""
import datetime
import re
import sys
import warnings
try:
import MySQLdb as Database
except ImportError, e:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured("Error l... | bsd-3-clause |
Mchakravartula/rockstor-core | src/rockstor/cli/iscsi_console.py | 6 | 1777 | """
Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any la... | gpl-3.0 |
YoshikawaMasashi/magenta | magenta/models/melody_rnn/melody_rnn_train.py | 2 | 4394 | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 |
direvus/ansible | test/units/modules/network/f5/test_bigip_device_auth.py | 10 | 4364 | # -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip i... | gpl-3.0 |
gauribhoite/personfinder | env/google_appengine/lib/django-0.96/django/contrib/auth/models.py | 32 | 14362 | from django.core import validators
from django.core.exceptions import ImproperlyConfigured
from django.db import backend, connection, models
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import gettext_lazy as _
import datetime
def check_password(raw_password, enc_password):
... | apache-2.0 |
1haodian/spark | dev/sparktestsupport/shellutils.py | 42 | 2800 | #
# 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 |
aixiamomo/flasky | tests/test_basics.py | 1 | 1036 | # coding=utf-8
import unittest # 单元测试
from flask import current_app # 程序上下文:当前激活程序的实例
from app import create_app, db # 工厂函数,数据库模型实例
class BasicsTestCase(unittest.TestCase): # 基础 测试 实例
"""
setUp(),tearDown()方法每次测试前后都会调用
test_开头的函数作为测试执行
"""
def setUp(self): # 创建一个测试环境
self.app = create_... | mit |
dracos/django | django/urls/converters.py | 34 | 1230 | import uuid
from django.utils import lru_cache
class IntConverter:
regex = '[0-9]+'
def to_python(self, value):
return int(value)
def to_url(self, value):
return str(value)
class StringConverter:
regex = '[^/]+'
def to_python(self, value):
return value
def to_url... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.