code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.db import models
class Review(models.Model):
source = models.CharField(max_length=100)
content_type = models.Foreig... | Smarsh/django | tests/regressiontests/multiple_database/models.py | Python | bsd-3-clause | 1,653 |
# See http://cens.ioc.ee/projects/f2py2e/
from __future__ import division, print_function
from numpy.f2py.f2py2e import main
main()
| ryfeus/lambda-packs | pytorch/source/numpy/f2py/__main__.py | Python | mit | 134 |
#!/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).
"""
import logging
import unittest
import os
import o... | jyt109/gensim | gensim/test/test_models.py | Python | gpl-3.0 | 23,020 |
# Copyright 2012 Nebula, Inc.
# 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... | petrutlucian94/nova | nova/tests/functional/v3/test_remote_consoles.py | Python | apache-2.0 | 3,556 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet.posixbase} and supporting code.
"""
from __future__ import division, absolute_import
from twisted.trial.unittest import TestCase
from twisted.internet.defer import Deferred
from twisted.internet.posixbase import ... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/internet/test/test_posixbase.py | Python | mit | 9,536 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class GameInformerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gameinformer\.com/(?:[^/]+/)*(?P<id>.+)\.aspx'
_TEST = {
'url': 'http://www.gameinformer.com/b/features/archive/2015/09/26/replay-animal-cro... | epitron/youtube-dl | youtube_dl/extractor/gameinformer.py | Python | unlicense | 1,315 |
'''
Unit tests for oc service
'''
import os
import six
import sys
import unittest
import mock
# Removing invalid variable names for tests so that I can
# keep them brief
# pylint: disable=invalid-name,no-name-in-module
# Disable import-error b/c our libraries aren't loaded in jenkins
# pylint: disable=import-error
#... | EricMountain-1A/openshift-ansible | roles/lib_openshift/src/test/unit/test_oc_service.py | Python | apache-2.0 | 17,402 |
# -*- coding: utf-8 -*-
import unittest
from mock import Mock, patch
from flask import Flask
from werkzeug import exceptions, MultiDict
from werkzeug.wrappers import Request
from werkzeug.datastructures import FileStorage
from flask_restful.reqparse import Argument, RequestParser, Namespace
import six
import decimal
i... | ueg1990/flask-restful | tests/test_reqparse.py | Python | bsd-3-clause | 29,848 |
from django import template
from symposion.proposals.models import AdditionalSpeaker
register = template.Library()
class AssociatedProposalsNode(template.Node):
@classmethod
def handle_token(cls, parser, token):
bits = token.split_contents()
if len(bits) == 3 and bits[1] == "as":
... | NelleV/pyconfr-test | symposion/proposals/templatetags/proposal_tags.py | Python | bsd-3-clause | 2,245 |
#!/usr/bin/env python
# Copyright (c) 2011 Stanford University
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | DavidLi2010/ramcloud | scripts/objectsize_scale.py | Python | isc | 2,086 |
from Screens.Screen import Screen
from Components.ActionMap import NumberActionMap
from Components.Label import Label
from Components.ChoiceList import ChoiceEntryComponent, ChoiceList
from Components.Sources.StaticText import StaticText
import enigma
class ChoiceBox(Screen):
def __init__(self, session, title="", lis... | popazerty/openblackhole-SH4 | lib/python/Screens/ChoiceBox.py | Python | gpl-2.0 | 6,533 |
import os
import infra.basetest
class TestDropbear(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_TARGET_GENERIC_ROOT_PASSWD="testpwd"
BR2_SYSTEM_DHCP="eth0"
BR2_PACKAGE_DROPBEAR=y
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR... | snickl/buildroot-iu | support/testing/tests/package/test_dropbear.py | Python | gpl-2.0 | 1,055 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | chjp2046/fbthrift | thrift/test/py/UTF8StringTest.py | Python | apache-2.0 | 2,919 |
#
# [The "BSD license"]
# Copyright (c) 2012 Terence Parr
# Copyright (c) 2012 Sam Harwell
# Copyright (c) 2014 Eric Vergnaud
# 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. Redis... | sidhart/antlr4 | runtime/Python2/src/antlr4/dfa/DFASerializer.py | Python | bsd-3-clause | 3,848 |
#!/usr/bin/env python
import sys
import logging
import logging.handlers
#The terminal has 8 colors with codes from 0 to 7
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
#These are the sequences need to get colored ouput
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[1m"
#The backg... | ashkankzme/IAISCustomsLoadTest | web/log/config.py | Python | apache-2.0 | 3,429 |
# coding=utf-8
# pylint: disable=C0111,too-many-arguments,too-many-instance-attributes,too-many-locals,redefined-outer-name,fixme
# pylint: disable=superfluous-parens, no-member, invalid-name
import sys
sys.path.insert(0, "../../python")
from __future__ import print_function
import numpy as np
import mxnet as mx
from... | likelyzhao/mxnet | example/warpctc/infer_ocr.py | Python | apache-2.0 | 2,418 |
#!/usr/bin/python
# Copyright (c) 2005-2015, Alexander Belchenko
# 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,... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/intelhex/test.py | Python | apache-2.0 | 60,573 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | bkolli/swift | test/unit/proxy/controllers/test_container.py | Python | apache-2.0 | 9,332 |
#
# 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... | ueshin/apache-spark | python/pyspark/mllib/stat/distribution.py | Python | apache-2.0 | 1,326 |
# coding: utf-8
{
'name': 'Saudi Arabia - Accounting',
'version': '1.1',
'author': 'DVIT.ME',
'category': 'Localization',
'description': """
Odoo Arabic localization for most arabic countries and Saudi Arabia.
This initially includes chart of accounts of USA translated to Arabic.
In future this m... | vileopratama/vitech | src/addons/l10n_sa/__openerp__.py | Python | mit | 765 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('appliances', '0009_appliancepool_provider'),
]
operations = [
migrations.AddField(
... | akrzos/cfme_tests | sprout/appliances/migrations/0010_appliance_power_state_changed.py | Python | gpl-2.0 | 511 |
#! /usr/bin/env python
# $Id: test_sidebars.py 7062 2011-06-30 22:14:29Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Tests for the "sidebar" directive.
"""
from __init__ import DocutilsTestSupport
def suite():
s = DocutilsTestSupport.Pa... | waseem18/oh-mainline | vendor/packages/docutils/test/test_parsers/test_rst/test_directives/test_sidebars.py | Python | agpl-3.0 | 1,905 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Margins in Sales Orders',
'version':'1.0',
'category': 'Sales',
'description': """
This module adds the 'Margin' on sales order.
=============================================
This gives the pr... | t3dev/odoo | addons/sale_margin/__manifest__.py | Python | gpl-3.0 | 563 |
from typing import Generic, TypeVar
T = TypeVar("T")
class A(Generic[T]):
def __init__(self, v):
pass
v2 = None # type: A[int] | ingokegel/intellij-community | python/testData/quickFixes/PyTypeHintsQuickFixTest/parenthesesAndCustomTarget_after.py | Python | apache-2.0 | 142 |
#author: fyth
from webshell import *
class PhpShell(Webshell):
_password = 'cmd'
_content = "<?php var_dump(md5(123));@assert($_REQUEST['{0}']);?>"
_check_statement = 'var_dump(md5(123));'
_keyword = '202cb962ac59075b964b07152d234b70'
class PhpVerify(VerifyShell):
_content = "<?php var_dump(md... | jiangzhw/Beebeeto-framework | utils/payload/webshell/php.py | Python | gpl-2.0 | 400 |
import os
import subprocess
locales = os.listdir('locale')
def call_command(command):
print command
subprocess.call(command.split())
for locale in locales:
call_command(
'python ../manage.py jinja2_makemessages -l %s -e html,py,txt' % locale
)
call_command(
'python ../manage.py ma... | PearsonIOKI/compose-forum | askbot/bin/rebuildlocales.py | Python | gpl-3.0 | 365 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import pickle
from openerp import tools
from openerp.osv import osv, fields
from openerp.exceptions import AccessError, MissingError
from openerp.tools.translate import _
EXCLUDED_FIELDS = set((
'report_sxw_content'... | ilexius/odoo | openerp/addons/base/ir/ir_values.py | Python | gpl-3.0 | 25,389 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
def deslugify(text):
in_bits = text.split('-')
out_bits = list()
for bit in in_bits:
out_bit = bit[0].upper() + bit[1:]
out_bits.append(out_bit)
return ' '.join(out_... | samhoo/askbot-realworld | askbot/migrations/0031_synchronize_badge_slug_with_name.py | Python | gpl-3.0 | 26,451 |
# Copyright (c) 2017 Citrix Systems
#
# 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.
#
# ... | marratj/ansible | test/units/modules/network/netscaler/test_netscaler_servicegroup.py | Python | gpl-3.0 | 22,813 |
# encoding: utf-8
from __future__ import unicode_literals
import re
import itertools
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urlparse,
compat_urllib_parse,
)
from ..utils import (
ExtractorError,
int_or_none,
unified_strdate,
)
class SoundcloudIE(InfoExtra... | 0x7678/youtube-dl | youtube_dl/extractor/soundcloud.py | Python | unlicense | 14,130 |
# 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... | Mistobaan/tensorflow | tensorflow/contrib/distributions/python/kernel_tests/mvn_diag_test.py | Python | apache-2.0 | 11,359 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2015, Hans-Joachim Kliemeck <git@kliemeck.de>
#
# 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 ... | Tatsh-ansible/ansible | lib/ansible/modules/windows/win_share.py | Python | gpl-3.0 | 3,686 |
#!/usr/bin/python -u
# Bootstrap Samba and run a number of tests against it.
# Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org>
# 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 versi... | Zentyal/samba | selftest/run.py | Python | gpl-3.0 | 4,316 |
# This file is part of beets.
# Copyright 2015, Adrian Sampson.
#
# 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, ... | shanemikel/beets | beetsplug/scrub.py | Python | mit | 5,220 |
# encoding: utf-8
from __future__ import unicode_literals
from ..compat import compat_urllib_parse
from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
ExtractorError,
)
class Porn91IE(InfoExtractor):
IE_NAME = '91porn'
_VALID_URL = r'(?:https?://)(?:www\.|)91porn\... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/porn91.py | Python | unlicense | 2,548 |
# Copyright 2013 OpenStack Foundation
# 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 requ... | hayderimran7/tempest | tempest/api/compute/servers/test_virtual_interfaces_negative.py | Python | apache-2.0 | 1,691 |
# -*- coding: utf-8 -*-
from reportlab.graphics.barcode import createBarcodeDrawing
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import inch, mm
from reportlab.platypus.doctemplate import NextPageTemplate, FrameBreak
from reportlab.platypus.flowables import Spacer, HRFlowable, PageBreak, Flowable
fro... | bradleyayers/xhtml2pdf | xhtml2pdf/tags.py | Python | apache-2.0 | 20,336 |
from unittest import mock
from django.db import connections, models
from django.test import SimpleTestCase
from django.test.utils import isolate_apps, override_settings
class TestRouter:
"""
Routes to the 'other' database if the model name starts with 'Other'.
"""
def allow_migrate(self, db, app_labe... | elena/django | tests/check_framework/test_multi_db.py | Python | bsd-3-clause | 1,726 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
RectangleMapTool.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | pblottiere/QGIS | python/plugins/processing/gui/RectangleMapTool.py | Python | gpl-2.0 | 3,872 |
import six
from w3lib.http import headers_dict_to_raw
from scrapy.utils.datatypes import CaselessDict
from scrapy.utils.python import to_unicode
class Headers(CaselessDict):
"""Case insensitive http headers dictionary"""
def __init__(self, seq=None, encoding='utf-8'):
self.encoding = encoding
... | rolando-contrib/scrapy | scrapy/http/headers.py | Python | bsd-3-clause | 2,738 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def get_items(price_list, sales_or_purchase, item=None, item_group=None):
condition = ""
args = {"price_list": p... | suyashphadtare/vestasi-erp-1 | erpnext/erpnext/accounts/doctype/sales_invoice/pos.py | Python | agpl-3.0 | 1,595 |
# -*- coding: utf-8 -*-
"""
werkzeug.wrappers
~~~~~~~~~~~~~~~~~
The wrappers are simple request and response objects which you can
subclass to do whatever you want them to do. The request object contains
the information transmitted by the client (webbrowser) and the response
object contains al... | danimajo/pineapple_pdf | werkzeug/wrappers.py | Python | mit | 76,131 |
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# 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... | nikhilpanicker/SecureVault | tools/modified/androguard/core/binaries/idapipe.py | Python | gpl-3.0 | 6,602 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import sale_order_dates
| vileopratama/vitech | src/addons/sale_order_dates/__init__.py | Python | mit | 124 |
#-*- coding:utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
import time
from openerp.osv import osv
from openerp.report import report_sxw
class report_hr_salary_employee_bymonth(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(r... | vileopratama/vitech | src/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py | Python | mit | 4,552 |
#!/usr/bin/env python
"""
client module for memcached (memory cache daemon)
Overview
========
See U{the MemCached homepage<http://www.danga.com/memcached>} for more about memcached.
Usage summary
=============
This should give you a feel for how this module operates::
import memcache
mc = memcache.Client(... | pouyana/teireader | webui/gluon/contrib/memcache/memcache.py | Python | mit | 49,300 |
# Copyright 2012 Cloudscaling, Inc.
# All Rights Reserved.
# Copyright 2013 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/L... | mmnelemane/nova | nova/tests/unit/api/ec2/test_ec2_validate.py | Python | apache-2.0 | 11,301 |
#!/usr/bin/env python2
#encoding:utf-8
#author:dbr/Ben
#project:tvdb_api
#repository:http://github.com/dbr/tvdb_api
#license:unlicense (http://unlicense.org/)
"""
urllib2 caching handler
Modified from http://code.activestate.com/recipes/491261/
"""
from __future__ import with_statement
__author__ = "dbr/Ben"
__versio... | badloop/SickRage | lib/tvdb_api/tvdb_cache.py | Python | gpl-3.0 | 7,781 |
from datetime import datetime
from django.core.files import storage
from django.contrib.staticfiles.storage import CachedStaticFilesStorage
class DummyStorage(storage.Storage):
"""
A storage class that does implement modified_time() but raises
NotImplementedError when calling
"""
def _save(self, n... | lecaoquochung/ddnb.django | tests/staticfiles_tests/storage.py | Python | bsd-3-clause | 660 |
TEST_DEFAULT = 'defvalue'
| scorphus/scrapy | tests/test_settings/default_settings.py | Python | bsd-3-clause | 27 |
"""This is a test module for test_pydoc"""
__author__ = "Benjamin Peterson"
__credits__ = "Nobody"
__version__ = "1.2.3.4"
class A:
"""Hello and goodbye"""
def __init__():
"""Wow, I have no function!"""
pass
class B(object):
NO_MEANING = "eggs"
pass
def doc_func():
"""
This ... | teeple/pns_server | work/install/Python-2.7.4/Lib/test/pydoc_mod.py | Python | gpl-2.0 | 439 |
"""Tests of the builder registry."""
import unittest
from bs4 import BeautifulSoup
from bs4.builder import (
builder_registry as registry,
HTMLParserTreeBuilder,
TreeBuilderRegistry,
)
try:
from bs4.builder import HTML5TreeBuilder
HTML5LIB_PRESENT = True
except ImportError:
HTML5LIB_PRESENT =... | wangtaoking1/found_website | 项目代码/bs4/tests/test_builder_registry.py | Python | gpl-2.0 | 5,374 |
"""
mod_auth Models
===================
In this module, we are trying to maintain all database models used
for authentication.
List of models corresponding to mysql tables: ['User' => 'user']
"""
import string
from passlib.apps import custom_app_context as pwd_context
from sqlalchemy import Column, Integer, String, T... | satyammittal/sample-platform | mod_auth/models.py | Python | isc | 3,955 |
from __future__ import print_function
# make the handler of the color field to call chicken_mcnuggets()
# instead of the default set handle_color() function
handler_registry['color'] = 'chicken_mcnuggets'
def chicken_mcnuggets():
# print color.getValue().getValue()
pass
# Initialize the color Packer (required of ... | looooo/pivy | examples/SoPyScript/glow.py | Python | isc | 1,768 |
__all__ = [
'null', 'Invalid', 'FieldsetErrors',
'Field', 'FieldFactory', 'Fieldset',
'field', 'fieldpreview', 'get_field_factory', 'get_field_preview',
'Term', 'Vocabulary',
'All','Function','Regex','Email','Range', 'Length','OneOf',
'CompositeField', 'CompositeError',
'InputField', 'Op... | djedproject/djed.form | djed/form/__init__.py | Python | isc | 3,170 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# django-oscar-cch documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 16 14:04:42 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in ... | thelabnyc/django-oscar-cch | docs/conf.py | Python | isc | 10,340 |
# encoding: UTF-8
from vnpy.trader import vtConstant
from korbitGateway import korbitGateway
gatewayClass = korbitGateway
gatewayName = 'KORBIT'
gatewayDisplayName = u'KORBIT'
gatewayType = vtConstant.GATEWAYTYPE_BTC
gatewayQryEnabled = True
| wisfern/vnpy | beta/gateway/korbitGateway/__init__.py | Python | mit | 245 |
# Python - 2.7.6
def sale_hotdogs(n):
if n < 5:
return n * 100
elif (5 <= n < 10):
return n * 95
else:
return n * 90 | RevansChen/online-judge | Codewars/8kyu/training-js-number-7-if-dot-else-and-ternary-operator/Python/solution1.py | Python | mit | 153 |
from twisted.trial import unittest
from twisted.internet import defer
from duct.protocol.sflow import protocol
from duct.tests import globs
class Test(unittest.TestCase):
def test_decode(self):
proto = protocol.Sflow(globs.SFLOW_PACKET, '172.30.0.5')
self.assertTrue(proto.version == 5)
... | ducted/duct | duct/tests/test_sflow.py | Python | mit | 362 |
from django.test import TestCase
from voice.models import Call
class CallModelTestCase(TestCase):
def setUp(self):
self.call = Call(sid="CAxxx",
from_number="+15558675309",
to_number="+15556667777")
self.call.save()
def test_string_representa... | RobSpectre/garfield | garfield/voice/tests/test_models.py | Python | mit | 499 |
"""
Simple wrapper around requests library, mostly for configuring connection
and usage by resources.
The get, post, put, and delete methods of the class could be used directly.
_run_method doc:
Runs given method (requests.post, .get, .put, .delete)
with given req_path (the part after /api/v2), and the
gi... | bc-jackiehuynh/bigcommerce-api-python | bigcommerce/connection.py | Python | mit | 4,916 |
import os
from notifications_delivery.app import create_app
from credstash import getAllSecrets
# on aws get secrets and export to env
secrets = getAllSecrets(region="eu-west-1")
for key, val in secrets.items():
os.environ[key] = val
application = create_app()
if __name__ == "__main__":
application.run(... | alphagov/notifications-delivery | wsgi.py | Python | mit | 322 |
import sys
import os
import shlex
import subprocess
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
if read_the_docs_build:
subprocess.call('doxygen', shell=True)
extensions = ['breathe']
breathe_projects = { 'Nanoshield_Termopar': 'xml' }
breathe_default_project = "Nanoshield_Termopar"
templ... | circuitar/Nanoshield_Termopar | extras/docs/conf.py | Python | mit | 867 |
# Test the support for SSL and sockets
import sys
import unittest
from test import test_support
import asyncore
import socket
import select
import time
import gc
import os
import errno
import pprint
import urllib, urlparse
import traceback
import weakref
import functools
import platform
from BaseHTTPServer import HTT... | sauloal/pycluster | pypy-1.9_64/lib-python/2.7/test/test_ssl.py | Python | mit | 58,198 |
from __future__ import absolute_import, division, print_function
import stripe
TEST_RESOURCE_ID = "activity.summary.1"
class TestReportType(object):
def test_is_listable(self, request_mock):
resources = stripe.reporting.ReportType.list()
request_mock.assert_requested("get", "/v1/reporting/repor... | stripe/stripe-python | tests/api_resources/reporting/test_report_type.py | Python | mit | 760 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Backup'
db.create_table(u'client_backup', (
(... | gustavomazevedo/tbackup-client | client/migrations/0001_initial.py | Python | mit | 8,611 |
from nltk import *
from nltk.corpus import brown
class ParallelismFinder:
def __init__(self):
self.f = ""
self.counter = 0
self.para = [] #array to hold instances of parallelism
self.tokenizer = RegexpTokenizer('\w+') #remove punctuation which could mess up finding parallelism
... | benglard/Rhetorical-Analysis | ParallelismFinder.py | Python | mit | 2,891 |
import time
import numpy as np
import keras
import tensorflow as tf
import keras.backend as K
from keras import optimizers
from keras.models import load_model
from keras.callbacks import Callback
from functions import calculate_top_k_new_only
"""
PeriodicValidation - Keras callback - checks val_loss periodically i... | DimiterM/santander | PeriodicValidation.py | Python | mit | 2,287 |
#!/usr/bin/env python
# encoding: utf-8
"""
For local testing purposes
"""
from itertools import compress, chain, product, ifilter
from functools import partial
from reader import read_input, list_files
def is_valid(task, solution):
"""
:param reader.Task task:
:param list[1|0] solution:
:return bool... | discreteoptimization/setcover | cp_homebrew_003/validator.py | Python | mit | 2,676 |
import redis
import psycopg2
from tornado.options import options
import tornadobase.handlers
class BaseHandler(tornadobase.handlers.BaseHandler):
def initialize(self):
self.dbref = psycopg2.connect(dbname=options.dbname,
user=options.dbuser,
... | coyote240/zeroecks.com | zeroecks/handlers/base_handler.py | Python | mit | 1,495 |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... | astrellon/cotsb | client/.ycm_extra_conf.py | Python | mit | 5,739 |
# Make masking rectangle
import cv2
import numpy as np
import os
from plantcv.plantcv import fatal_error
from plantcv.plantcv import print_image
from plantcv.plantcv import plot_image
from plantcv.plantcv import params
def rectangle_mask(img, p1, p2, color="black"):
"""Takes an input image and returns a binary i... | stiphyMT/plantcv | plantcv/plantcv/rectangle_mask.py | Python | mit | 2,816 |
from ctypes import *
class EnumerationType(type(c_uint)):
def __new__(metacls, name, bases, dict):
if not "_members_" in dict:
_members_ = {}
for key,value in dict.items():
if not key.startswith("_"):
_members_[key] = value
dict["_memb... | ActiveState/code | recipes/Python/576415_ctype_Enumeration_class/recipe-576415.py | Python | mit | 1,430 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import numpy as np
import faiss
from common_faiss_tests import make_binary_dataset
def bitvec_shuffle(a, order):
n, d =... | facebookresearch/faiss | tests/test_binary_hashindex.py | Python | mit | 6,617 |
from dallinger.nodes import Source
import random
class WarOfTheGhostsSource(Source):
"""A Source that reads in a random story from a file and transmits it."""
__mapper_args__ = {"polymorphic_identity": "war_of_the_ghosts_source"}
def _contents(self):
"""Define the contents of new Infos.
... | Dallinger/Dallinger | demos/dlgr/demos/bartlett1932/models.py | Python | mit | 758 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
import numpy
from snisi_core.models.Projects import Cluster
# from snisi_core.models.Reporting import ExpectedRepor... | yeleman/snisi | snisi_vacc/indicators.py | Python | mit | 4,346 |
# -*- coding: utf-8 -*-
import os
from inspector.utils.strings import render_template
def generate_graph_html(graph, filename):
"""
:type graph: networkx.Graph
:param str filename: path to save the generated html file
"""
params = {
'nodes': [],
'links': [],
}
ids... | amiraliakbari/static-inspector | inspector/utils/visualization/graph.py | Python | mit | 1,351 |
# -*- coding: utf-8 -*-
import sys
import time
from config import Config
from multiprocessing import managers, connection
def _new_init_timeout():
return time.time() + 0.2
sys.modules['multiprocessing'].__dict__['managers'].__dict__['connection']._init_timeout = _new_init_timeout
from multiprocessing.manage... | noah/riddim | lib/data.py | Python | mit | 674 |
from .simple import CacheClient
from .hash import HashCacheClient
| nkanish2002/pyredis-cache | redis_cache/__init__.py | Python | mit | 66 |
from joueur.delta_mergeable import DeltaMergeable
from joueur.base_game_object import BaseGameObject
from joueur.utilities import camel_case_converter
from joueur.serializer import is_game_object_reference, is_object
# @class GameManager: managed the game and it's game objects including unserializing deltas
class Game... | brhoades/megaminer16-anarchy | joueur/game_manager.py | Python | mit | 3,572 |
# -*- coding: utf-8 -*-
import os
import subprocess
import sys
import threading
import time
import signal
from thriftpy.protocol import TBinaryProtocolFactory
from thriftpy.server import TThreadedServer
from thriftpy.thrift import TProcessor
from thriftpy.transport import TServerSocket, TBufferedTransportFactory
from ... | eleme/archer | archer/_server.py | Python | mit | 3,460 |
from rest_framework import serializers
from .models import Food, Recipe
class FoodSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Food
fields = ('name', 'quantity', 'unit', 'url')
class RecipeSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
mod... | kevinharvey/fridge | food/serializers.py | Python | mit | 381 |
"""Use Mayapy for testing
Usage:
$ mayapy run_maya_tests.py
"""
import sys
import nose
import warnings
from nose_exclude import NoseExclude
warnings.filterwarnings("ignore", category=DeprecationWarning)
if __name__ == "__main__":
from maya import standalone
standalone.initialize()
argv = sys.argv... | pyblish/pyblish-mindbender | run_maya_tests.py | Python | mit | 1,052 |
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... | vithd/vithd.github.io | django/mysite/mysite/urls.py | Python | mit | 816 |
import random
import datetime
import time
import hashlib
from django.db import models
from django.conf import settings
from django.urls import reverse
from django.contrib.auth.models import User, Group
from django.db.models.signals import post_save
from djangopress.core.models import Property
from django.utils import ... | codefisher/djangopress | djangopress/accounts/models.py | Python | mit | 5,282 |
import time
import os
import numpy as np
def getPID():
os.system("qstat > qstat.temp")
qstat = open("qstat.temp","r")
qstatString = qstat.readlines()
print qstatString[0]
PID=[]
for line in qstatString:
lineSplit=line.split()
PID.append(lineSplit[0])
print PID[2:]
... | BillyLiggins/MemoryLeaks | memoryTracker.py | Python | mit | 1,292 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:6960")
else:
access = Ser... | allaboutbit/Cludcoin-project | contrib/bitrpc/bitrpc.py | Python | mit | 7,838 |
import os
from setuptools import setup
setup(
name = "restler-serialization",
version = "0.3",
author = "Curtis Thompson",
author_email = "curtis.thompson@gmail.com",
description = "Restler provides flexible and configurable JSON and XML object serialization for the web",
license = "MIT",
k... | xuru/restler | setup.py | Python | mit | 789 |
class Permission(object):
"""This class represents the most basic permission possible. It has any number of segments, but is fully defined by
it's name. It may have wildcards, allowing for easily giving multiple permissions of the same form to users,
especially when the number of permissions is large, infin... | Acidity/PyPermissions | pypermissions/permission.py | Python | mit | 8,509 |
import pandas as pd
from pandas import DataFrame
import math
import numpy as np
from .decorators import *
@iterate_jit(nopython=True)
def FilingStatus(MARS):
if MARS == 3 or MARS == 6:
_sep = 2
else: _sep = 1
return _sep
@iterate_jit(parameters=["ALD_StudentLoan_HC", "ALD_SelfEmploymentTax_HC", ... | xiyuw123/Tax-Calculator | taxcalc/functions.py | Python | mit | 44,187 |
"""
Completes Hearthstone Card Lookup through comparing search queries to card names
"""
import copy
class Searcher:
def __init__(self, card_dict):
"""Initializes a Searcher object with a card dictionary provided
Args: card_dict(dict): Card dictionary with cards are separated
into sub dictionaries by set and... | MagiChau/Hearthstone-Card-Lookup | card_lookup/searcher.py | Python | mit | 4,417 |
import astropy.io.fits as pyfits
import astropy.wcs as pywcs
import os, sys, time
import numpy as np
from pdb import set_trace
import montage_wrapper as montage
import shutil
import gal_data
import config
import glob
from scipy.ndimage.interpolation import zoom
#_TOP_DIR = '/data/tycho/0/leroy.42/allsky/'
#_INDEX_DIR... | arlewis/arl_galbase | single_cutout_test_newmethod.py | Python | mit | 18,179 |
from app import db
from sqlalchemy.dialects.postgresql import JSON
class ChBible(db.Model):
__tablename__ = 'chbible'
id = db.Column(db.Integer, primary_key=True)
bbid = db.Column(db.String())
snt = db.Column(db.String())
snt_lg = db.Column(db.String())
snt_sdg = db.Column(db.String())
d... | HimmelStein/lg-flask | models.py | Python | mit | 578 |
# coding: utf-8
class Singleton(type):
def __init__(cls, name, bases, class_dict):
super(Singleton, cls).__init__(name, bases, class_dict)
cls._instance = None
def __call__(cls, *args):
if cls._instance is None:
cls._instance = super(Singleton, cls).__call__(*args)
... | pengzhuo/gameServer | server/models/singleton.py | Python | mit | 342 |
from src.shared import config
def test_answer():
assert type(config.CHUNK_SIZE) == int
| CheeseLord/warts | tests/smoketests/test_src_access.py | Python | mit | 92 |
#
# A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
# a^2 + b^2 = c^2
#
# For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
#
# There exists exactly one Pythagorean triplet for which a + b + c = 1000.
# Find the product abc.
for x in range(1, 1000):
for y in range(2, 1000):
if x >... | doctoryes/project_euler | prob9.py | Python | mit | 983 |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User, Group
from iospack.models import App
from rest_framework import viewsets
from rest_framework import generics
from iospack.serializers import UserSerializer, GroupSerializer, AppSerializer
# Create your views here.
class UserViewSet(viewsets.ModelVie... | gushaokun/AppPack | iospack/views.py | Python | mit | 1,042 |
import matplotlib.pyplot as plt
import numpy
from helpers import assert_equality
def plot():
fig = plt.figure()
xxx = numpy.linspace(0, 5)
yyy = xxx ** 2
plt.text(
1,
5,
"test1",
size=50,
rotation=30.0,
ha="center",
va="bottom",
color="r... | m-rossi/matplotlib2tikz | test/test_text_overlay.py | Python | mit | 2,420 |
# Copyright (C) 2013 Andrew Okin
# 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, publish, distribu... | Forkk/Sporkk-Pastebin | sporkk/views.py | Python | mit | 4,231 |
'''
A secret file with data that we can use in unit tests without needing to
clutter up that file with a bunch of raw data structures.
'''
from datetime import datetime
SEARCH_TEST_DATA = [
{
"created" : datetime(2015, 10, 1),
"published": datetime(2015, 10, 1),
"edited": datet... | bgporter/wastebook | testData/postTestData.py | Python | mit | 1,496 |