repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/test/test_asyncio/test_unix_events.py | 1 | 67821 | """Tests for unix_events.py."""
import collections
import contextlib
import errno
import io
import os
import pathlib
import signal
import socket
import stat
import sys
import tempfile
import threading
import unittest
from unittest import mock
from test import support
if sys.platform == 'win32':
raise unittest.Ski... | apache-2.0 |
Conceiva/MezzmoKodiPlugin | common.py | 1 | 2918 | import xbmc
import xbmcaddon
import inspect
import os
import sys
import socket
import re
class printDebug:
def __init__(self, main, sub=None):
self.main=main
if sub:
self.sub="."+sub
else:
self.sub=''
self.level=settings.get_debug()
... | gpl-2.0 |
maheshp/novatest | nova/virt/disk/mount/nbd.py | 13 | 4153 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Red Hat, 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 ... | apache-2.0 |
crmccreary/openerp_server | openerp/test/__init__.py | 14 | 1099 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 OpenERP S.A. http://www.openerp.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GN... | agpl-3.0 |
lafayette/JBTT | framework/framework/pym/yaml/__init__.py | 112 | 9273 |
from error import *
from tokens import *
from events import *
from nodes import *
from loader import *
from dumper import *
__version__ = '3.09'
try:
from cyaml import *
__with_libyaml__ = True
except ImportError:
__with_libyaml__ = False
def scan(stream, Loader=Loader):
"""
Scan a YAML stream... | mit |
fxia22/ASM_xf | PythonD/lib/python2.4/pkgutil.py | 13 | 3100 | """Utilities to support packages."""
import os
import sys
def extend_path(path, name):
"""Extend a package's path.
Intended use is to place the following code in a package's __init__.py:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
This will add to the pack... | gpl-2.0 |
frewsxcv/keyczar | cpp/src/tools/swtoolkit/bin/runtest.py | 9 | 11270 | #!/usr/bin/python2.4
#
# Copyright 2009, 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 ... | apache-2.0 |
rgmining/fraudar | fraudar/export/run_greedy.py | 1 | 2152 | # FRAUDAR: Bounding Graph Fraud in the Face of Camouflage
# Authors: Bryan Hooi, Hyun Ah Song, Alex Beutel, Neil Shah, Kijung Shin, Christos Faloutsos
#
# This software is licensed under Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a c... | gpl-3.0 |
MebiusHKU/flask-web | flask/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/gb2312prober.py | 2994 | 1681 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org 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 Reserved.
#
# Con... | bsd-3-clause |
kch8qx/osf.io | website/addons/badges/util.py | 22 | 1909 | import io
import os
import errno
import urllib2
from PIL import Image
from collections import defaultdict
from modularodm import Q
from website.addons.badges.settings import * # noqa
#TODO: Possible security errors
#TODO: Send to task queue may lock up thread
def acquire_badge_image(imageurl, uid):
location = ... | apache-2.0 |
markroxor/gensim | gensim/test/test_doc2vec.py | 1 | 23647 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
from __future__ import with_statement
import log... | lgpl-2.1 |
neilLasrado/erpnext | erpnext/selling/doctype/customer/customer.py | 1 | 22478 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe.model.naming import set_name_by_naming_series
from frappe import _, msgprint
import frappe.defaults
from frappe.ut... | gpl-3.0 |
barseghyanartur/jellyfish | jellyfish/porter.py | 1 | 6796 | from .compat import _range
_s2_options = {
'a': ((['a', 't', 'i', 'o', 'n', 'a', 'l'], ['a', 't', 'e']),
(['t', 'i', 'o', 'n', 'a', 'l'], ['t', 'i', 'o', 'n'])),
'c': ((['e', 'n', 'c', 'i'], ['e', 'n', 'c', 'e']),
(['a', 'n', 'c', 'i'], ['a', 'n', 'c', 'e']),),
'e': ((['i', 'z', 'e', 'r... | bsd-3-clause |
maxive/erp | addons/hr/tests/common.py | 38 | 2037 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestHrCommon(common.TransactionCase):
def setUp(self):
super(TestHrCommon, self).setUp()
self.Users = self.env['res.users']
self.group_hr_manager_id = ... | agpl-3.0 |
Javier-Acosta/meran | dev-plugins/node64/lib/node/wafadmin/Tools/icpc.py | 4 | 2581 | #!/usr/bin/env python
# Meran - MERAN UNLP is a ILS (Integrated Library System) wich provides Catalog,
# Circulation and User's Management. It's written in Perl, and uses Apache2
# Web-Server, MySQL database and Sphinx 2 indexing.
# Copyright (C) 2009-2013 Grupo de desarrollo de Meran CeSPI-UNLP
#
# This file is part ... | gpl-3.0 |
wilvk/ansible | lib/ansible/modules/web_infrastructure/jenkins_job.py | 64 | 11177 | #!/usr/bin/python
#
# Copyright: (c) 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': ['previe... | gpl-3.0 |
armikhael/software-center | utils/piston-helpers/x2go_helper.py | 2 | 2962 | #!/usr/bin/python -u
import x2go, gevent, sys, fcntl, os, shlex
def connect(server, port, login, password, session):
print "PROGRESS: creating"
cli = x2go.X2goClient(start_pulseaudio=True)
uuid = cli.register_session(
server=server,
port=int(port),
username=login,
add_to_kno... | gpl-3.0 |
babble/babble | include/jython/Lib/test/test_tempfile.py | 1 | 21877 | # From Python 2.5.1
# tempfile.py unit tests.
import tempfile
import os
import sys
import re
import errno
import warnings
import unittest
from test import test_support
warnings.filterwarnings("ignore",
category=RuntimeWarning,
message="mktemp", module=__name__)
if has... | apache-2.0 |
log2timeline/dfvfs | tests/vfs/gzip_file_system.py | 2 | 2511 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for the file system implementation using gzip."""
import unittest
from dfvfs.lib import definitions
from dfvfs.path import factory as path_spec_factory
from dfvfs.resolver import context
from dfvfs.vfs import gzip_file_system
from tests import test_lib as shared... | apache-2.0 |
MrBasset/libcloud | libcloud/test/__init__.py | 8 | 10398 | # 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 use ... | apache-2.0 |
letouriste001/SmartForest_2.0 | python3.4Smartforest/lib/python3.4/site-packages/django/contrib/gis/utils/wkt.py | 1 | 1923 | """
Utilities for manipulating Geometry WKT.
"""
from django.utils import six
def precision_wkt(geom, prec):
"""
Returns WKT text of the geometry according to the given precision (an
integer or a string). If the precision is an integer, then the decimal
places of coordinates WKT will be truncated t... | mit |
isard-vdi/isard | webapp/webapp/webapp/lib/isardScheduler.py | 1 | 5947 | # Copyright 2017 the Isard-vdi project authors:
# Josep Maria Viñolas Auquer
# Alberto Larraz Dalmases
# License: AGPLv3
#!/usr/bin/env python
# coding=utf-8
from decimal import Decimal
import random, queue
from threading import Thread
import time, pytz
from webapp import app
import rethinkdb as r
from flask... | agpl-3.0 |
alanljj/Pentaho-reports-for-OpenERP | openerp_addon/pentaho_report_selection_sets/report_formulae_definitions.py | 6 | 6817 | from datetime import date, datetime, timedelta
from dateutil.relativedelta import relativedelta
from openerp.addons.pentaho_reports.java_oe import *
from openerp.tools.translate import _
FTYPE_TIMEDELTA = 'tdel'
FUNCTION_TYPES = OPENERP_DATA_TYPES + [(FTYPE_TIMEDELTA, 'Time Delta')]
# FORMULAE are defined as dicti... | gpl-2.0 |
cts2/ihtsdoauth | auth/ihtsdoauth.py | 1 | 4415 | # -*- coding: utf-8 -*-
# Copyright (c) 2013, Mayo Clinic
# 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
# ... | mit |
Akrog/cinder | cinder/tests/fake_hp_client_exceptions.py | 32 | 3077 | # (c) Copyright 2014 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.apache.org/licenses/LI... | apache-2.0 |
syscoin/syscoin2 | test/functional/feature_dersig.py | 1 | 5813 | #!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP66 (DER SIG).
Test that the DERSIG soft-fork activates at (regtest) height 1251.
"""
from tes... | mit |
anubhavvardhan/qutip | qutip/tests/test_mcsolve.py | 4 | 20286 | # This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
... | bsd-3-clause |
skavulya/spark-tk | python/sparktk/models/timeseries/arimax.py | 14 | 15211 | # vim: set encoding=utf-8
# Copyright (c) 2016 Intel Corporation
#
# 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 require... | apache-2.0 |
EraYaN/CouchPotatoServer | libs/chardet/chardistribution.py | 2755 | 9226 | ######################## 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 |
sYnfo/samba | third_party/waf/wafadmin/Tools/unittestw.py | 32 | 9789 | #!/usr/bin/env python
# encoding: utf-8
# Carlos Rafael Giani, 2006
"""
Unit tests run in the shutdown() method, and for c/c++ programs
One should NOT have to give parameters to programs to execute
In the shutdown method, add the following code:
>>> def shutdown():
... ut = UnitTest.unit_test()
... ut.run()
...... | gpl-3.0 |
cwu2011/scikit-learn | sklearn/preprocessing/__init__.py | 14 | 1184 | """
The :mod:`sklearn.preprocessing` module includes scaling, centering,
normalization, binarization and imputation methods.
"""
from .data import Binarizer
from .data import KernelCenterer
from .data import MinMaxScaler
from .data import MaxAbsScaler
from .data import Normalizer
from .data import RobustScaler
from .d... | bsd-3-clause |
NeCTAR-RC/horizon | openstack_dashboard/dashboards/project/vg_snapshots/tests.py | 3 | 8730 | # 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
# d... | apache-2.0 |
bspaans/bookmark-tools | btools/matching/FileMatcher.py | 1 | 6660 | import os
import subprocess
import pipes
import btools.pybookmark as pybookmark
import btools.common as common
from ConfParser import ConfParser
class FileMatcher:
def __init__(self, bookmark_file = "", rules_file = ""):
if rules_file == "":
rules_file = common.get_conf_location()
c ... | gpl-3.0 |
MihaiMoldovanu/ansible | lib/ansible/modules/system/seboolean.py | 26 | 6955 | #!/usr/bin/python
# (c) 2012, Stephen Fromm <sfromm@gmail.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_version': '1.1',
'status... | gpl-3.0 |
ElDeveloper/scikit-learn | sklearn/tree/tests/test_tree.py | 13 | 52365 | """
Testing for the tree module (sklearn.tree).
"""
import pickle
from functools import partial
from itertools import product
import platform
import numpy as np
from scipy.sparse import csc_matrix
from scipy.sparse import csr_matrix
from scipy.sparse import coo_matrix
from sklearn.random_projection import sparse_rand... | bsd-3-clause |
cicorias/mongo-web-shell | tests/__init__.py | 8 | 1468 | # Copyright 2013 10gen 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... | apache-2.0 |
gauribhoite/personfinder | env/site-packages/py-1.4.30-py2.7.egg/py/_code/_assertionnew.py | 217 | 12384 | """
Find intermediate evalutation results in assert statements through builtin AST.
This should replace _assertionold.py eventually.
"""
import sys
import ast
import py
from py._code.assertion import _format_explanation, BuiltinAssertionError
if sys.platform.startswith("java") and sys.version_info < (2, 5, 2):
... | apache-2.0 |
neiudemo1/django | tests/postgres_tests/fields.py | 302 | 1087 | """
Indirection layer for PostgreSQL-specific fields, so the tests don't fail when
run with a backend other than PostgreSQL.
"""
from django.db import models
try:
from django.contrib.postgres.fields import (
ArrayField, BigIntegerRangeField, DateRangeField, DateTimeRangeField,
FloatRangeField, HSto... | bsd-3-clause |
samedder/azure-cli | src/command_modules/azure-cli-profile/azure/cli/command_modules/profile/_params.py | 4 | 2571 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | mit |
quru/qis | src/imageserver/user_auth.py | 1 | 7528 | #
# Quru Image Server
#
# Document: user_auth.py
# Date started: 10 Aug 2011
# By: Matt Fozard
# Purpose: Image server user authentication module
# Requires:
# Copyright: Quru Ltd (www.quru.com)
# Licence:
#
# This program is free software: you can redistribute it and/or modify
# it under... | agpl-3.0 |
helixyte/TheLMA | thelma/tests/functional/test_rack.py | 1 | 1605 | """
Created on Dec 09, 2014.
"""
from pyramid.httpexceptions import HTTPOk
from everest.mime import XmlMime
from everest.resources.utils import get_root_collection
from thelma.interfaces import ITubeRack
from thelma.tests.functional.conftest import TestFunctionalBase
class TestRackFunctional(TestFunctionalBase):
... | mit |
shaufi/odoo | addons/base_gengo/wizard/base_gengo_translations.py | 296 | 13127 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
Thor77/youtube-dl | youtube_dl/extractor/eyedotv.py | 25 | 2710 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
xpath_text,
parse_duration,
ExtractorError,
)
class EyedoTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?eyedo\.tv/[^/]+/(?:#!/)?Live/Detail/(?P<id>[0-9]+)'
_TEST = {
'ur... | unlicense |
stackforge/tacker | tacker/tests/functional/vnfm/test_tosca_vnf_block_storage.py | 2 | 4322 | # Copyright 2016 Brocade Communications System, 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 ... | apache-2.0 |
kohnle-lernmodule/exe201based | twisted/copyright.py | 14 | 1377 | # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Copyright information for Twisted.
"""
version="2.2.0"
longversion="Twisted %s" % version
copyright="""\
Copyright (c) 2001-2004 Twisted Matrix Laboratories.
See LICENSE for details."""
disclaimer='''
Twisted, the Framework of Y... | gpl-2.0 |
jesux/PatataWifi | FruityWifi/www/modules/responder/includes/Responder-master/LDAPPackets.py | 2 | 14612 | #! /usr/bin/env python
# NBT-NS/LLMNR Responder
# Created by Laurent Gaffie
# Copyright (C) 2014 Trustwave Holdings, 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 th... | gpl-3.0 |
xshotD/pyglet | pyglet/input/evdev_constants.py | 25 | 8529 | #!/usr/bin/env python
'''Event constants from /usr/include/linux/input.h
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
EV_SYN = 0x00
EV_KEY = 0x01
EV_REL = 0x02
EV_ABS = 0x03
EV_MSC = 0x04
EV_LED = 0x11
EV_SND = 0x12
EV_REP = 0x14
EV_FF = 0x15
EV_PWR = 0x16
EV_FF_STATUS = 0x17
EV_MAX = 0x1f
# Synchro... | bsd-3-clause |
tuomas2/automate | src/automate/extensions/arduino/arduino_actuators.py | 1 | 6343 | # -*- coding: utf-8 -*-
# (c) 2015 Tuomas Airaksinen
#
# This file is part of automate-arduino.
#
# automate-arduino 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 yo... | gpl-3.0 |
wsp/git | contrib/fast-import/import-zips.py | 47 | 1848 | #!/usr/bin/env python
## zip archive frontend for git-fast-import
##
## For example:
##
## mkdir project; cd project; git init
## python import-zips.py *.zip
## git log --stat import-zips
from os import popen, path
from sys import argv, exit
from time import mktime
from zipfile import ZipFile
if len(argv) < 2:
p... | gpl-2.0 |
rlindner81/pyload | module/plugins/hoster/QuickshareCz.py | 1 | 3533 | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.SimpleHoster import SimpleHoster
class QuickshareCz(SimpleHoster):
__name__ = "QuickshareCz"
__type__ = "hoster"
__version__ = "0.61"
__status__ = "testing"
__pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+'
_... | gpl-3.0 |
gluke77/rally | tests/unit/plugins/openstack/scenarios/ec2/test_utils.py | 7 | 2842 | # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#... | apache-2.0 |
rupak0577/ginga | ginga/misc/plugins/MyGlobalPlugin.py | 3 | 6437 | """
Skeleton example of a Ginga global plugin called 'MyGlobalPlugin'
To enable it, run ginga with the command
$ ginga --modules=MyLocalPlugin
it should become active in the right panel.
"""
from ginga import GingaPlugin
from ginga.gw import Widgets
# import any other modules you want here--it's a python world!... | bsd-3-clause |
steebchen/youtube-dl | youtube_dl/extractor/giantbomb.py | 30 | 2928 | from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
qualities,
unescapeHTML,
)
class GiantBombIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?giantbomb\.com/videos/(?P<display_id>[^/]+)/(?P<id>\d+-... | unlicense |
guorendong/iridium-browser-ubuntu | third_party/webrtc/build/extra_gitignore.py | 40 | 1443 | #!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | bsd-3-clause |
enjaz/enjaz | niqati/templatetags/niqati_tags.py | 2 | 2718 | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.template import Library
from django.utils.http import urlquote
import requests
from activities.models import Episode
from bulb.models import Request, Session
register = Library()
@register.simple_tag
def get_short_link(domain, endpoin... | agpl-3.0 |
drmrd/ansible | lib/ansible/modules/network/aci/aci_access_port_to_interface_policy_leaf_profile.py | 2 | 11226 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.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 |
abec/getabe.com | DjangoSite/apps/flashcards/api.py | 1 | 1367 | import logging
from rest_framework.generics import GenericAPIView, ListCreateAPIView
from rest_framework.response import Response
from .models import FlashCard
from .serializers import FlashCardSerializer
LOG = logging.getLogger(__name__)
class ListAddFlashCards(ListCreateAPIView):
model = FlashCard
serialize... | mit |
kdwink/intellij-community | python/helpers/rest_formatter.py | 1 | 11961 | import re
import sys
from docutils import nodes
from docutils.core import publish_string
from docutils.frontend import OptionParser
from docutils.nodes import Text, field_body, field_name, rubric
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from doc... | apache-2.0 |
fmfn/UnbalancedDataset | imblearn/ensemble/_weight_boosting.py | 2 | 11479 | from copy import deepcopy
import numpy as np
from sklearn.base import clone
from sklearn.ensemble import AdaBoostClassifier
from sklearn.ensemble._base import _set_random_states
from sklearn.utils import _safe_indexing
from ..under_sampling.base import BaseUnderSampler
from ..under_sampling import RandomUnderSampler... | mit |
apdjustino/DRCOG_Urbansim | urbandeveloper/elasticity_model_2SLS.py | 1 | 6896 | __author__ = 'JMartinez'
import numpy as np, pandas as pd, os
from synthicity.utils import misc
import pysal as py
class elasticity_model(object):
def __init__(self, dset):
self.zones = dset.zones
self.buildings_far = pd.merge(dset.buildings, dset.fars, left_on='far_id', right_index=True)
... | agpl-3.0 |
mitchelljkotler/django | django/contrib/gis/geos/prototypes/threadsafe.py | 529 | 2859 | import threading
from django.contrib.gis.geos.libgeos import (
CONTEXT_PTR, error_h, lgeos, notice_h,
)
class GEOSContextHandle(object):
"""
Python object representing a GEOS context handle.
"""
def __init__(self):
# Initializing the context handler for this thread with
# the noti... | bsd-3-clause |
mzdaniel/oh-mainline | vendor/packages/django-model-utils/model_utils/tests/tests.py | 2 | 18640 | from __future__ import with_statement
import pickle, sys, warnings
from datetime import datetime, timedelta
import django
from django.test import TestCase
from django.db import models
from django.db.models.fields import FieldDoesNotExist
from django.core.exceptions import ImproperlyConfigured
from django.contrib.co... | agpl-3.0 |
Huc91/TPB_Generator | tpb_ta_scrape.py | 1 | 1577 | """
The MIT License (MIT)
Copyright (c) 2016 Luca Ucciero
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 without limitation the rights to use, copy, modify, merge, ... | mit |
Konubinix/weboob | weboob/tools/date.py | 1 | 13543 | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2013 Romain Bignon
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | agpl-3.0 |
DempDemp/nautilus | modules/ircpaint.py | 1 | 1208 | import urllib2
from core import base
from core.auth import Auth
class IRCPaint(base.baseClass):
@classmethod
def get_drawing(cls, sid):
return urllib2.urlopen('http://ircpaint.randomlab.info/rawirc.php?q={}'.format(sid)).read()
def on_privmsg(self, address, target, text):
if target == self... | agpl-3.0 |
shubmit/shub-ltp | testcases/network/nfsv4/acl/test_long_acl.py | 27 | 1337 | '''
Access Control Lists testing based on newpynfs framework
Aurelien Charbon - Bull SA
'''
from random_gen import *
from optparse import OptionParser
import commands
import os
import threading
import time
import random
alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789_-() ~'
t_alphabet=len(alp... | gpl-2.0 |
broferek/ansible | lib/ansible/modules/network/fortios/fortios_switch_controller_network_monitor_settings.py | 14 | 9049 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 Lic... | gpl-3.0 |
3L3N4/metagoofil | hachoir_core/field/fake_array.py | 95 | 2294 | import itertools
from hachoir_core.field import MissingField
class FakeArray:
"""
Simulate an array for GenericFieldSet.array(): fielset.array("item")[0] is
equivalent to fielset.array("item[0]").
It's possible to iterate over the items using::
for element in fieldset.array("item"):
... | gpl-2.0 |
alan94jimenez/modified-shamu | Documentation/networking/cxacru-cf.py | 14668 | 1626 | #!/usr/bin/env python
# Copyright 2009 Simon Arlott
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program i... | gpl-2.0 |
epa/sqlalchemy | test/orm/test_bulk.py | 11 | 15200 | from sqlalchemy import testing
from sqlalchemy.testing import eq_
from sqlalchemy.testing.schema import Table, Column
from sqlalchemy.testing import fixtures
from sqlalchemy import Integer, String, ForeignKey, FetchedValue
from sqlalchemy.orm import mapper, Session
from sqlalchemy.testing.assertsql import CompiledSQL
f... | mit |
twz915/django | tests/m2m_multiple/tests.py | 133 | 2329 | from datetime import datetime
from django.test import TestCase
from .models import Article, Category
class M2MMultipleTests(TestCase):
def test_multiple(self):
c1, c2, c3, c4 = [
Category.objects.create(name=name)
for name in ["Sports", "News", "Crime", "Life"]
]
... | bsd-3-clause |
saintdragon2/python-3-lecture-2015 | civil-final/2nd_presentation/11조/pygame/tests/sprite_test.py | 11 | 36714 | #################################### IMPORTS ###################################
# -*- encoding: utf-8 -*-
if __name__ == '__main__':
import sys
import os
pkg_dir = os.path.split(os.path.abspath(__file__))[0]
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
... | mit |
jendap/tensorflow | tensorflow/python/autograph/converters/builtin_functions.py | 18 | 2499 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
renyi533/tensorflow | tensorflow/lite/testing/op_tests/sparse_to_dense.py | 17 | 3416 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
yoer/hue | desktop/core/ext-py/pycrypto-2.6.1/lib/Crypto/Util/py21compat.py | 125 | 2779 | # -*- coding: utf-8 -*-
#
# Util/py21compat.py : Compatibility code for Python 2.1
#
# Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to ... | apache-2.0 |
camilonova/sentry | src/sentry/web/frontend/create_team.py | 15 | 6257 | from __future__ import absolute_import
import logging
from django.contrib import messages
from django.core.urlresolvers import reverse
from sentry.models import OrganizationMemberType
from sentry.permissions import can_create_teams, Permissions
from sentry.web.forms.add_project import AddProjectForm
from sentry.web.... | bsd-3-clause |
e-matteson/pipit-keyboard | extras/audio/make_audio_files.py | 1 | 2652 | #!/bin/python2
from __future__ import division
import subprocess
from time import sleep
import os
# for generating sound files
import numpy as np
import matplotlib.pyplot as plt
import scipy.io.wavfile
import scipy.signal as sig
import scipy.stats as stats
master_volume = 1
sounds = {
'A':{'filename':'tick1.wa... | gpl-3.0 |
Reagankm/KnockKnock | venv/lib/python3.4/site-packages/nltk/test/unit/test_seekable_unicode_stream_reader.py | 27 | 3592 | # -*- coding: utf-8 -*-
"""
The following test performs a random series of reads, seeks, and
tells, and checks that the results are consistent.
"""
from __future__ import absolute_import, unicode_literals
import random
import functools
from io import BytesIO
from nltk.corpus.reader import SeekableUnicodeStreamReader
d... | gpl-2.0 |
CMU-Robotics-Club/roboticsclub.org | projects/templatetags/txt2img.py | 2 | 1483 | #
# Obtained from:
# https://djangosnippets.org/snippets/2737/
#
# TODO: move this out of projects app
from django.conf import settings
from django.template import Library
from PIL import Image, ImageDraw, ImageFont
from os import path
import hashlib
import os
register = Library()
@register.filter
def txt2img(text... | mit |
anryko/ansible | lib/ansible/modules/network/check_point/cp_mgmt_session_facts.py | 20 | 3932 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage Check Point Firewall (c) 2019
#
# 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 o... | gpl-3.0 |
arjunkhode/ASP | lectures/03-Fourier-properties/plots-code/symmetry-real-even.py | 26 | 1150 | import matplotlib.pyplot as plt
import numpy as np
import sys
import math
from scipy.signal import triang
from scipy.fftpack import fft, fftshift
M = 127
N = 128
hM1 = int(math.floor((M+1)/2))
hM2 = int(math.floor(M/2))
x = triang(M)
fftbuffer = np.zeros(N)
fftbuffer[:hM1] = x[hM2:]
fftbuffer[N-hM2:] = x[:hM2]
X =... | agpl-3.0 |
kaarolch/ansible | lib/ansible/modules/files/ini_file.py | 16 | 10123 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
# (c) 2015, Ales Nosek <anosek.nosek () 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 ... | gpl-3.0 |
vetu11/piloco | cosas/objetos.py | 1 | 4751 | # coding=utf-8
import json, time, threading, random, logging
from .funciones import nuevosMensajes
class Partida:
partidasEnCurso = []
def finder(self, host):
posicionPartida = 0
for e in self.partidasEnCurso:
if e["host"] == host:
return posicionPartida
... | gpl-3.0 |
jerryblakley/libcloud | libcloud/compute/drivers/ec2.py | 21 | 198736 | # 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 use ... | apache-2.0 |
tegusi/shadowsocks | setup.py | 929 | 1321 | import codecs
from setuptools import setup
with codecs.open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
name="shadowsocks",
version="2.8.2",
license='http://www.apache.org/licenses/LICENSE-2.0',
description="A fast tunnel proxy that help you get through firewalls",
... | apache-2.0 |
vFense/vFenseAgent-nix | agent/deps/rpm6/Python-2.7.5/lib/python2.7/test/test_urllib.py | 36 | 35463 | """Regresssion tests for urllib"""
import urllib
import httplib
import unittest
import os
import sys
import mimetools
import tempfile
import StringIO
from test import test_support
from base64 import b64encode
def hexescape(char):
"""Escape char as RFC 2396 specifies"""
hex_repr = hex(ord(char))[2:].upper()
... | lgpl-3.0 |
omakk/servo | etc/patch-trace-template.py | 113 | 3376 | #!/usr/bin/env python
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/l... | mpl-2.0 |
koson/MissionPlannerKMTI | Lib/lib2to3/fixes/fix_dict.py | 326 | 3824 | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for dict methods.
d.keys() -> list(d.keys())
d.items() -> list(d.items())
d.values() -> list(d.values())
d.iterkeys() -> iter(d.keys())
d.iteritems() -> iter(d.items())
d.itervalues() -> iter(d.values())
d.v... | gpl-3.0 |
android-ia/hardware_intel_parameter-framework | test/functional-tests/PfwTestCase/Types/tFP32_Q0_31.py | 10 | 10926 | # -*-coding:utf-8 -*
# Copyright (c) 2011-2015, Intel Corporation
# 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 copyright notice, thi... | bsd-3-clause |
sassoftware/conary | conary/lib/epdb_embedded/epdb_stackutil.py | 2 | 4928 | #
# Copyright (c) SAS Institute 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 w... | apache-2.0 |
jhawkesworth/ansible | lib/ansible/modules/web_infrastructure/apache2_mod_proxy.py | 47 | 17084 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Olivier Boukili <boukili.olivier@gmail.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_version':... | gpl-3.0 |
JohnReid/pybool | python/pybool/examples/neurogenesis.py | 1 | 6857 | #
# Copyright John Reid 2013
#
"""
Example to illustrate application of pybool. Based on regulatory network in paper
on robustness under functional constraint by Nakajima et al.
"""
import numpy as N, logging
from pybool.constraints import gene_off, gene_on
from pybool import network, constraints
class MetaData(c... | mit |
bonitadecker77/python-for-android | python3-alpha/python3-src/Lib/distutils/tests/test_install_data.py | 147 | 2603 | """Tests for distutils.command.install_data."""
import sys
import os
import unittest
import getpass
from distutils.command.install_data import install_data
from distutils.tests import support
from test.support import run_unittest
class InstallDataTestCase(support.TempdirManager,
support.Logg... | apache-2.0 |
nacho/gedit | plugins/snippets/snippets/SubstitutionParser.py | 2 | 7459 | # Gedit snippets plugin
# Copyright (C) 2006-2007 Jesse van den Kieboom <jesse@icecrew.nl>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
#... | gpl-2.0 |
chaicko/AlgorithmicToolbox | test/test_divide_and_conquer.py | 1 | 8325 | import divide_and_conquer.binary_search as binary_search
import divide_and_conquer.inversions as inversions
import divide_and_conquer.majority_element as majority_element
import divide_and_conquer.points_and_segments as points_and_segments
import divide_and_conquer.sorting as sorting
import pytest
@pytest.mark.timeou... | gpl-3.0 |
guillaume-philippon/aquilon | lib/aquilon/worker/commands/del_campus.py | 2 | 1551 | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2016 Contributor
#
# 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... | apache-2.0 |
zstackio/zstack-woodpecker | integrationtest/vm/multihosts/ha/test_smp_ls_vm_ha_force_stop_host_vm_status.py | 2 | 5387 | '''
New Integration Test for host where KVM VM ha located force stop and start again,
check vm self-start again. In addition, this test is sepcific for smp and local.
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test... | apache-2.0 |
naslanidis/ansible | lib/ansible/modules/network/f5/bigip_monitor_tcp.py | 32 | 15297 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, serge van Ginderachter <serge@vanginderachter.be>
#
# 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 vers... | gpl-3.0 |
toanalien/phantomjs | src/breakpad/src/third_party/protobuf/protobuf/python/google/protobuf/service_reflection.py | 601 | 11010 | # 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... | bsd-3-clause |
w4/belle | dave/modules/weather.py | 2 | 5156 | # -*- coding: utf-8 -*-
"""Get the weather from an address using forecast.io."""
from __future__ import division
import dave.modules
import requests
import dave.config
import pickle
from urllib.parse import quote_plus
import arrow
from dave.models import Location
import socket
@dave.module.help("Syntax: weather [loca... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.