repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
Luavis/sherlock.py | refs/heads/master | tests/test_list_codes.py | 1 | from tests import analysis_code_list
def test_numeric_list_assign():
code = [
'a = [1, 2, 3, 4]'
]
assert analysis_code_list(code) == 'export a=(1 2 3 4)\n'
def test_mix_list_assign():
code = [
'a = ["1", "2", 1, 2]'
]
assert analysis_code_list(code) == 'export a=("1" "2" 1 ... |
magsol/garmin | refs/heads/master | parser.py | 1 | import sys
import xml.parsers.expat
import matplotlib.pyplot as plot
import numpy as np
from datetime import datetime
import time
from scipy import stats
class GCFileParser:
def __init__(self, filename, sport = 'Running'):
self.parser = xml.parsers.expat.ParserCreate()
self.parser.buffer_text = Tr... |
clchiou/garage | refs/heads/master | py/g1/webs/g1/webs/handlers/etags.py | 1 | __all__ = [
'compute_etag',
'compute_etag_from_file',
'maybe_raise_304',
]
import hashlib
import logging
import re
from .. import consts
from .. import wsgi_apps
LOG = logging.getLogger(__name__)
_CHUNK_SIZE = 8192
def compute_etag(content):
hasher = hashlib.md5()
hasher.update(content)
re... |
aleksandra-tarkowska/django | refs/heads/master | django/contrib/flatpages/tests/test_csrf.py | 40 | import os
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase, Client
from django.test import override_settings
@override_settings(
LOGIN_URL='/accounts/login/',
MIDDLEWARE_CLASSES=(
'django.middleware.common.CommonM... |
apixandru/intellij-community | refs/heads/master | python/testData/copyPaste/singleLine/Indent11.dst.py | 747 | class C:
def foo(self):
<caret>y = 2
|
indexofire/django-entrez | refs/heads/master | src/apps/entrez/helper.py | 2 | # -*- coding: utf-8 -*-
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from django.core.mail import send_mail
import entrez
from entrez.models import EntrezEntry
from entrez.settings import ENTREZ_OPTION_TYPE, ENTREZ_SEARCH_MAX
from... |
hanicker/odoo | refs/heads/8.0 | addons/fetchmail/__openerp__.py | 260 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# mga@openerp.com
#
# This program is free software: you can redistribute it and/or mo... |
cntnboys/410Lab4 | refs/heads/master | env-lab4/lib/python2.7/site-packages/werkzeug/wsgi.py | 147 | # -*- coding: utf-8 -*-
"""
werkzeug.wsgi
~~~~~~~~~~~~~
This module implements WSGI related helpers.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import re
import os
import sys
import posixpath
import mimetypes
from itert... |
jn7163/django | refs/heads/master | django/contrib/gis/db/backends/postgis/introspection.py | 330 | from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.postgresql.introspection import DatabaseIntrospection
class GeoIntrospectionError(Exception):
pass
class PostGISIntrospection(DatabaseIntrospection):
# Reverse dictionary for PostGIS geometry types not populated until
# introspectio... |
VitalPet/c2c-rd-addons | refs/heads/8.0 | stock_packing_webkit/stock_packing.py | 5 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2011 ChriCar Beteiligungs- und Beratungs- GmbH (<http://www.camptocamp.com>).
#
# This p... |
kurikuri99/xen_study | refs/heads/master | tools/python/logging/logging-0.4.9.2/test/myapp.py | 42 | import logging, mymodule
logging.basicConfig()
log = logging.getLogger("MyApp")
log.setLevel(logging.DEBUG) #set verbosity to show all messages of severity >= DEBUG
log.info("Starting my app")
try:
mymodule.doIt()
except Exception, e:
log.exception("There was a problem.")
log.info("Ending my app")
|
devstructure/blueprint | refs/heads/master | blueprint/io/server/backend.py | 4 | import boto
import boto.exception
import httplib
import socket
from blueprint import cfg
import librato
import statsd
access_key = cfg.get('s3', 'access_key')
bucket = cfg.get('s3', 'bucket')
protocol = 'https' if cfg.getboolean('s3', 'use_https') else 'http'
region = cfg.get('s3', 'region')
s3_region = 's3' if 'US'... |
vincent-fei/django-xadmin | refs/heads/master | demo_app/app/adminx.py | 17 | import xadmin
from xadmin import views
from models import IDC, Host, MaintainLog, HostGroup, AccessRecord
from xadmin.layout import Main, TabHolder, Tab, Fieldset, Row, Col, AppendedText, Side
from xadmin.plugins.inline import Inline
from xadmin.plugins.batch import BatchChangeAction
class MainDashboard(object):
w... |
lodemo/CATANA | refs/heads/master | src/face_recognition/youtube_dl/extractor/izlesene.py | 40 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote
from ..utils import (
determine_ext,
float_or_none,
get_element_by_id,
int_or_none,
parse_iso8601,
str_to_int,
)
class IzleseneIE(InfoExtractor... |
andyliuliming/WALinuxAgent | refs/heads/master | azurelinuxagent/common/errorstate.py | 1 | from datetime import datetime, timedelta
ERROR_STATE_DELTA_DEFAULT = timedelta(minutes=15)
ERROR_STATE_DELTA_INSTALL = timedelta(minutes=5)
ERROR_STATE_HOST_PLUGIN_FAILURE = timedelta(minutes=5)
class ErrorState(object):
def __init__(self, min_timedelta=ERROR_STATE_DELTA_DEFAULT):
self.min_timedelta = mi... |
rolando-contrib/scrapy | refs/heads/master | scrapy/settings/deprecated.py | 29 | import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
DEPRECATED_SETTINGS = [
('TRACK_REFS', 'no longer needed (trackref is always enabled)'),
('RESPONSE_CLASSES', 'no longer supported'),
('DEFAULT_RESPONSE_ENCODING', 'no longer supported'),
('BOT_VERSION', 'no longer used (user agent ... |
rlaboiss/pelican-plugins | refs/heads/master | glossary/glossary.py | 24 | """
Builds a glossary page containing definition lists found in articles
and pages, and adds a `definitions` variable visible to all page templates.
"""
import bs4
from pelican import signals
class Definitions():
definitions = []
exclude = []
def make_title(def_title):
return def_title.text
def make... |
vicky2135/lucious | refs/heads/master | oscar/lib/python2.7/site-packages/faker/providers/address/sv_SE/__init__.py | 19 | # coding=utf-8
from __future__ import unicode_literals
from .. import Provider as AddressProvider
class Provider(AddressProvider):
building_number_formats = ('###', '##', '#')
street_name_formats = ('{{street_prefix}}{{street_suffix}}', )
street_address_formats = ('{{street_name}} {{building_number}}'... |
DarkEnergySurvey/ugali | refs/heads/master | ugali/utils/factory.py | 2 | #!/usr/bin/env python
"""
Factory for generating instances of classes
"""
import sys
from collections import OrderedDict as odict
import inspect
def factory(type, module=None, **kwargs):
"""
Factory for creating objects. Arguments are passed directly to the
constructor of the chosen class.
"""
cls ... |
wenyu1001/scrapy | refs/heads/master | scrapy/utils/benchserver.py | 38 | import random
from six.moves.urllib.parse import urlencode
from twisted.web.server import Site
from twisted.web.resource import Resource
from twisted.internet import reactor
class Root(Resource):
isLeaf = True
def getChild(self, name, request):
return self
def render(self, request):
tot... |
amiller/python-bitcoinlib | refs/heads/master | examples/publish-text.py | 7 | #!/usr/bin/env python3
#
# Copyright (C) 2015 Peter Todd
#
# 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,... |
infobloxopen/infoblox-netmri | refs/heads/master | infoblox_netmri/api/remote/models/device_flow_filter_cfg_remote.py | 1 | from ..remote import RemoteModel
from infoblox_netmri.utils.utils import check_api_availability
class DeviceFlowFilterCfgRemote(RemoteModel):
"""
Network traffic flow configuration, definition of a path of ip flow to rule
| ``DeviceFlowFilterCfgID:`` The internal NetMRI identifier for this ip packet fl... |
jambonrose/DjangoUnleashed-1.8 | refs/heads/master | organizer/migrations/0002_tag_data.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from functools import reduce
from operator import or_
from django.db import migrations, models
from django.db.models import Q
TAGS = (
# ( tag name, tag slug ),
("augmented reality", "augmented-reality"),
("big data", "big-data"),
("djan... |
alephcero/baSubwayObservatory | refs/heads/master | src/dataTransformation.py | 1 |
# coding: utf-8
# import libraries
# this wont be necesary further on
import pickle
import pandas as pd
import numpy as np
#Load pickle from download and clean data
cleanData = pickle.load( open( "cleanData.p", "rb" ) )
cleanData.sort_values(by=['line','terminal','depart'],inplace=True)
cleanData.reset_index(drop... |
chainer/chainer | refs/heads/master | tests/chainer_tests/distributions_tests/test_exponential.py | 8 | import numpy
from chainer import distributions
from chainer import testing
@testing.parameterize(*testing.product({
'shape': [(2, 3), ()],
'is_variable': [True, False],
'sample_shape': [(3, 2), ()],
}))
@testing.fix_random()
@testing.with_requires('scipy')
class TestLogNormal(testing.distribution_unittes... |
miminar/openshift-ansible | refs/heads/master | roles/lib_utils/library/docker_creds.py | 8 | #!/usr/bin/env python
# pylint: disable=missing-docstring
#
# Copyright 2017, 2018 Red Hat, Inc. and/or its affiliates
# and other contributors as indicated by the @author tags.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You m... |
SparklerPone/burpyhooves | refs/heads/master | modules/buh.py | 2 | # This file is part of BurpyHooves.
#
# BurpyHooves 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.
#
# BurpyHooves is distributed in... |
aimas/TuniErp-8.0 | refs/heads/master | addons/hr_attendance/__openerp__.py | 1 | # -*- 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... |
mr-karan/coala-bears | refs/heads/master | bears/general/KeywordBear.py | 2 | from coalib.bears.LocalBear import LocalBear
from coalib.results.Result import RESULT_SEVERITY, Result
class KeywordBear(LocalBear):
LANGUAGES = {"All"}
AUTHORS = {'The coala developers'}
AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}
LICENSE = 'AGPL-3.0'
CAN_DETECT = {'Documentation'}
def... |
DavidTingley/ephys-processing-pipeline | refs/heads/master | installation/klustaviewa-0.3.0/galry/test/plot_slice_test.py | 2 | import unittest
from galry import *
from test import GalryTest
import numpy as np
class PM(PaintManager):
def initialize(self):
n = 100000
v = .5 * np.ones(n)
x = np.hstack((-v, v, v, -v, -v))
y = np.hstack((-v, -v, v, v, -v))
self.add_visual(PlotVisual,... |
filmkorn/PokemonGo-Map | refs/heads/master | pogom/customLog.py | 45 | from .utils import get_pokemon_name
from pogom.utils import get_args
from datetime import datetime
args = get_args()
#temporarily disabling because -o and -i is removed from 51f651228c00a96b86f5c38d1a2d53b32e5d9862
#IGNORE = None
#ONLY = None
#if args.ignore:
# IGNORE = [i.lower().strip() for i in args.ignore.spli... |
abusalimov/pytest-travis-fold | refs/heads/master | setup.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import codecs
from setuptools import setup
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
return codecs.open(file_path, encoding='utf-8').read()
setup(
name='pytest-travis-fold',
version='1.3.0',
author='Eldar ... |
KiChjang/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/third_party/html5lib/html5lib/treeadapters/genshi.py | 155 | from __future__ import absolute_import, division, unicode_literals
from genshi.core import QName, Attrs
from genshi.core import START, END, TEXT, COMMENT, DOCTYPE
def to_genshi(walker):
"""Convert a tree to a genshi tree
:arg walker: the treewalker to use to walk the tree to convert it
:returns: genera... |
jneves/python-social-auth | refs/heads/master | social/backends/stackoverflow.py | 77 | """
Stackoverflow OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/stackoverflow.html
"""
from social.backends.oauth import BaseOAuth2
class StackoverflowOAuth2(BaseOAuth2):
"""Stackoverflow OAuth2 authentication backend"""
name = 'stackoverflow'
ID_KEY = 'user_id'
AUTHORIZATION... |
GuillaumeSeren/alot | refs/heads/master | alot/db/message.py | 2 | # Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import email
import email.charset as charset
import email.policy
import functools
from datetime import datetime
from notmuch import Nu... |
eneabio/nova | refs/heads/stable/essex | nova/compute/api.py | 3 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); y... |
farodin91/servo | refs/heads/master | components/script/dom/bindings/codegen/parser/tests/test_variadic_constraints.py | 170 | def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
interface VariadicConstraints1 {
void foo(byte... arg1, byte arg2);
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw,
"Should... |
a-parhom/edx-platform | refs/heads/master | cms/djangoapps/contentstore/views/tests/test_transcripts.py | 13 | """Tests for items views."""
import copy
from codecs import BOM_UTF8
import ddt
import json
from mock import patch, Mock
import tempfile
import textwrap
from uuid import uuid4
from django.conf import settings
from django.urls import reverse
from django.test.utils import override_settings
from edxval.api import create... |
suttond/MODOI | refs/heads/master | ase/ga/offspring_creator.py | 2 | """Base module for all operators that create offspring."""
import numpy as np
from random import random
from ase import Atoms
from ase.ga.atoms_attach import enable_raw_score_methods
class OffspringCreator(object):
"""Base class for all procreation operators
Parameters:
verbose: Be verbose and print so... |
ramyfarid922/Quiz-Program | refs/heads/master | vendor/bundle/ruby/2.2.0/gems/libv8-3.16.14.7/vendor/gyp/test/win/gyptest-link-aslr.py | 344 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure aslr setting is extracted properly.
"""
import TestGyp
import sys
if sys.platform == 'win32':
test = TestGyp.TestGyp(form... |
peterwilliams97/stats | refs/heads/master | outer.py | 1 | from __future__ import division
import sys
import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
def p(X):
print '-' * 80
print X
print X.shape
X = np.ones((3, 2)) * 2
Y = np.ones((4, 2)) * 2
p(X)
p(Y)
A = np.subtract.outer(X, Y)
p(A)
A = np.subtract.out... |
codepotpl/codepot-backend | refs/heads/master | django_payu/migrations/0001_initial.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='PayuPayment',
fields=[
('payment_id', models.Ch... |
vinegret/youtube-dl | refs/heads/master | youtube_dl/extractor/m6.py | 71 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class M6IE(InfoExtractor):
IE_NAME = 'm6'
_VALID_URL = r'https?://(?:www\.)?m6\.fr/[^/]+/videos/(?P<id>\d+)-[^\.]+\.html'
_TEST = {
'url': 'http://www.m6.fr/emission-les_reines_du_shopping/videos/11323908-e... |
awbirdsall/popmodel | refs/heads/master | src/popmodel/__init__.py | 1 | # -*- coding: utf-8 -*-
'''POPMODEL: calculate population dynamics for laser-induced fluorescence.
Core functionality in popmodel.main.
'''
from .version import __version__
from .main import *
|
JaneliaSciComp/fly-alcohol-assay | refs/heads/master | faa_actionlib/src/faa_actionlib/__init__.py | 205 | #autogenerated by ROS python message generators |
JamisHoo/Cloud-Image-Migration-Tool | refs/heads/master | usr/lib/requests/packages/urllib3/contrib/ntlmpool.py | 1009 | """
NTLM authenticating pool, contributed by erikcederstran
Issue #10, see: http://code.google.com/p/urllib3/issues/detail?id=10
"""
try:
from http.client import HTTPSConnection
except ImportError:
from httplib import HTTPSConnection
from logging import getLogger
from ntlm import ntlm
from urllib3 import HTT... |
alexpilotti/compute-hyperv | refs/heads/master | hyperv/tests/test.py | 2 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... |
openstack/zaqar | refs/heads/master | zaqar/tests/unit/transport/wsgi/v1/test_messages.py | 1 | # Copyright (c) 2013 Rackspace, 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 wr... |
jimyx17/jimh | refs/heads/master | lib/requests/sessions.py | 5 | # -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
from copy import deepcopy
from .compat import cookielib
from .cookies import cookiejar_from_dict, remove_cookie_by_name
from .defaults impo... |
mattuuh7/incubator-airflow | refs/heads/master | airflow/models.py | 2 | # -*- 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
... |
vitiral/micropython | refs/heads/master | stmhal/boards/make-pins.py | 29 | #!/usr/bin/env python
"""Creates the pin file for the STM32F4xx."""
from __future__ import print_function
import argparse
import sys
import csv
SUPPORTED_FN = {
'TIM' : ['CH1', 'CH2', 'CH3', 'CH4',
'CH1N', 'CH2N', 'CH3N', 'CH1_ETR', 'ETR', 'BKIN'],
'I2C' : ['SDA', 'SCL'],
'I2S' : ... |
ClusterLabs/pcs | refs/heads/master | pcs/lib/commands/cib_options.py | 3 | from typing import (
Any,
Container,
Iterable,
List,
Mapping,
Optional,
)
from pcs.common import reports
from pcs.common.pacemaker.nvset import CibNvsetDto
from pcs.common.reports.item import ReportItem
from pcs.common.tools import Version
from pcs.lib.cib import (
nvpair_multi,
section... |
crosswalk-project/chromium-crosswalk-efl | refs/heads/efl/crosswalk-10/39.0.2171.19 | tools/telemetry/unittest_data/discoverable_classes/another_discover_dummyclass.py | 90 | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""More dummy exception subclasses used by core/discover.py's unit tests."""
# Import class instead of module explicitly so that inspect.getmembers() return... |
YuriGural/erpnext | refs/heads/master | erpnext/schools/doctype/student_guardian/student_guardian.py | 53 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class StudentGuardian(Document):
pass
|
fangcode/tornado_note | refs/heads/master | tornado/test/websocket_test.py | 99 | from __future__ import absolute_import, division, print_function, with_statement
import traceback
from tornado.concurrent import Future
from tornado import gen
from tornado.httpclient import HTTPError, HTTPRequest
from tornado.log import gen_log, app_log
from tornado.testing import AsyncHTTPTestCase, gen_test, bind_u... |
Asana/python-asana | refs/heads/master | asana/resources/gen/typeahead.py | 2 | # coding=utf-8
class _Typeahead:
def __init__(self, client=None):
self.client = client
def typeahead_for_workspace(self, workspace_gid, params=None, **options):
"""Get objects via typeahead
:param str workspace_gid: (required) Globally unique identifier for the workspace or organizatio... |
tarballs-are-good/sympy | refs/heads/master | sympy/geometry/tests/test_geometry.py | 1 | from sympy import Symbol, Rational, sqrt, pi, cos, oo, simplify, Real
from sympy.geometry import (Point, Polygon, convex_hull, Segment,
RegularPolygon, Circle, Ellipse, GeometryError, Line, intersection, Ray,
Triangle, are_similar, Curve)
from sympy.utilities.pytest import raises
x = Symbol('x', real=True)
y =... |
40423114/2016fallcadp_hw | refs/heads/gh-pages | plugin/tipue_search/tipue_search.py | 251 | # -*- coding: utf-8 -*-
"""
Tipue Search
============
A Pelican plugin to serialize generated HTML to JSON
that can be used by jQuery plugin - Tipue Search.
Copyright (c) Talha Mansoor
"""
from __future__ import unicode_literals
import os.path
import json
from bs4 import BeautifulSoup
from codecs import open
try:
... |
ESSICS/org.csstudio.display.builder | refs/heads/master | org.csstudio.display.builder.model/examples/pic/image_server.py | 2 | # Example image server
#
# Uses pcaspy to serve a test image
import numpy as np
width = 100
height = 100
img = np.zeros(height * width).reshape(height, width)
# Image value at odd x or y: 0
# Image value at even x or y: x/2 + y/2 * 50
pixel = 0
for y in range(0, height, 2):
for x in range(0, width, 2):
... |
adelton/django | refs/heads/master | tests/template_tests/test_parser.py | 288 | """
Testing some internals of the template processing. These are *not* examples to be copied in user code.
"""
from __future__ import unicode_literals
from unittest import TestCase
from django.template import Library, TemplateSyntaxError
from django.template.base import (
TOKEN_BLOCK, FilterExpression, Parser, To... |
ahb0327/intellij-community | refs/heads/master | python/testData/inspections/PyUnboundLocalVariableInspection/UnboundExceptAs.py | 83 | def f():
try:
raise KeyError("ms")
except KeyError as e:
print(e) #pass
print(<warning descr="Local variable 'e' might be referenced before assignment">e</warning>) #fail
|
nju520/django | refs/heads/master | django/contrib/gis/geoip/base.py | 73 | import os
import re
import warnings
from ctypes import c_char_p
from django.contrib.gis.geoip.libgeoip import GEOIP_SETTINGS
from django.contrib.gis.geoip.prototypes import (
GeoIP_country_code_by_addr, GeoIP_country_code_by_name,
GeoIP_country_name_by_addr, GeoIP_country_name_by_name,
GeoIP_database_info,... |
ar7z1/ansible | refs/heads/devel | lib/ansible/modules/network/panos/panos_set.py | 20 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage PaloAltoNetworks Firewall
# (c) 2018, Jasper Mackenzie <jasper.mackenzie@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 publis... |
sumanthha/fundafriend | refs/heads/master | django/contrib/databrowse/models.py | 195 | # Empty models.py to allow for specifying databrowse as a test label.
|
e-q/scipy | refs/heads/master | scipy/interpolate/fitpack2.py | 4 | """
fitpack --- curve and surface fitting with splines
fitpack is based on a collection of Fortran routines DIERCKX
by P. Dierckx (see http://www.netlib.org/dierckx/) transformed
to double routines by Pearu Peterson.
"""
# Created by Pearu Peterson, June,August 2003
__all__ = [
'UnivariateSpline',
'Interpolate... |
hyperdriveguy/mint-software-center | refs/heads/master | src/widgets/toolbar.py | 1 | #!/usr/bin/env python
# -*- coding:UTF-8 -*-
# Copyright (c) Stephen Smally <stephen.smally@gmail.com>
#
# 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 ... |
controlzee/ansible | refs/heads/devel | test/units/module_utils/test_database.py | 325 | import collections
import mock
import os
import re
from nose.tools import eq_
try:
from nose.tools import assert_raises_regexp
except ImportError:
# Python < 2.7
def assert_raises_regexp(expected, regexp, callable, *a, **kw):
try:
callable(*a, **kw)
except expected as e:
... |
savi-dev/quantum | refs/heads/master | quantum/plugins/linuxbridge/common/utils.py | 3 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Cisco Systems, 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... |
hdinsight/hue | refs/heads/master | desktop/core/ext-py/pycrypto-2.6.1/lib/Crypto/Hash/MD2.py | 124 | # -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... |
davidwaroquiers/monty | refs/heads/master | monty/math.py | 2 | # coding: utf-8
"""
Addition math functions.
"""
import math
def nCr(n, r):
"""
Calculates nCr.
Args:
n (int): total number of items.
r (int): items to choose
Returns:
nCr.
"""
f = math.factorial
return int(f(n) / f(r) / f(n-r))
def nPr(n, r):
"""
Calc... |
petrutlucian94/nova | refs/heads/master | nova/api/openstack/compute/contrib/fixed_ips.py | 72 | # Copyright 2012 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... |
slohse/ansible | refs/heads/devel | lib/ansible/modules/network/nxos/nxos_gir_profile_management.py | 50 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
cryptobanana/ansible | refs/heads/devel | lib/ansible/modules/network/avi/avi_scheduler.py | 15 | #!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
ANSIB... |
kawamon/hue | refs/heads/master | desktop/core/ext-py/ndg_httpsclient-0.4.0/ndg/httpsclient/subj_alt_name.py | 79 | """NDG HTTPS Client package
Use pyasn1 to provide support for parsing ASN.1 formatted subjectAltName
content for SSL peer verification. Code based on:
http://stackoverflow.com/questions/5519958/how-do-i-parse-subjectaltname-extension-data-using-pyasn1
"""
__author__ = "P J Kershaw"
__date__ = "01/02/12"
__copyright_... |
gsmartway/odoo | refs/heads/8.0 | addons/project/__openerp__.py | 259 | # -*- 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... |
MrJoes/sockjs-tornado | refs/heads/master | sockjs/tornado/basehandler.py | 2 | # -*- coding: utf-8 -*-
"""
sockjs.tornado.basehandler
~~~~~~~~~~~~~~~~~~~~~~~~~~
Various base http handlers
"""
import datetime
import socket
import logging
from tornado.web import RequestHandler
from sockjs.tornado.util import asynchronous
CACHE_TIME = 31536000
LOG = logging.getLogger("tornado.genera... |
st135yle/django-site | refs/heads/master | dbenv/lib/python3.4/site-packages/django/contrib/auth/mixins.py | 115 | from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import redirect_to_login
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.utils import six
from django.utils.encoding import force_text
class AccessMixin(object):
... |
szopu/django | refs/heads/master | django/contrib/gis/gdal/tests/test_geom.py | 94 | import json
from binascii import b2a_hex
try:
from django.utils.six.moves import cPickle as pickle
except ImportError:
import pickle
import unittest
from unittest import skipUnless
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.geometry.test_data import TestDataMixin
from django.utils.six... |
argriffing/cvxpy | refs/heads/master | cvxpy/performance_tests/test_warmstart.py | 12 | """
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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.
CVXPY is distributed i... |
theflofly/tensorflow | refs/heads/master | tensorflow/python/ops/distributions/exponential.py | 37 | # 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... |
voidabhi/python-scripts | refs/heads/master | webhook.py | 1 | from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import json
class WebHook(BaseHTTPRequestHandler):
def do_POST(self):
self.send_response(200)
self.end_headers()
print json.dumps(json.loads(self.rfile.read(int(self.headers.getheader('content-length')))), indent=4)
server = HTTPServer... |
TOCyna/tabelinha | refs/heads/master | flask/lib/python2.7/site-packages/sqlalchemy/ext/serializer.py | 81 | # ext/serializer.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Serializer/Deserializer objects for usage with SQLAlchemy query structures,
all... |
is210-faculty/is210-week-07-warmup | refs/heads/master | tests/test_task_02.py | 9 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Task 02."""
# Import Python libs
import unittest
# Import User libs
import task_02
class Task02TestCase(unittest.TestCase):
"""Test cases for Task 02"""
def test_bval_required(self):
"""Tests that bval is a required argument"""
with self.ass... |
nmercier/linux-cross-gcc | refs/heads/master | win32/bin/Lib/lib2to3/pgen2/pgen.py | 61 | # Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
# Pgen imports
from . import grammar, token, tokenize
class PgenGrammar(grammar.Grammar):
pass
class ParserGenerator(object):
def __init__(self, filename, stream=None):
cl... |
tinkerinestudio/Tinkerine-Suite | refs/heads/master | TinkerineSuite/python/Lib/OpenGL/raw/GL/EXT/index_array_formats.py | 3 | '''OpenGL extension EXT.index_array_formats
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_EXT_index_array_formats'
_DEPRECATED = False
GL_IUI... |
colehertz/Stripe-Tester | refs/heads/master | venv/lib/python3.5/site-packages/pip-7.1.0-py3.5.egg/pip/_vendor/requests/packages/chardet/universaldetector.py | 1775 | ######################## 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... |
halberom/ansible | refs/heads/devel | lib/ansible/utils/module_docs_fragments/dimensiondata.py | 192 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Dimension Data
#
# This module 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 ... |
sport-monkey/GYP | refs/heads/master | test/library/gyptest-static.py | 72 | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies simple build of a "Hello, world!" program with static libraries,
including verifying that libraries are rebuilt correctly when ... |
qiime2/qiime2 | refs/heads/master | qiime2/core/transform.py | 2 | # ----------------------------------------------------------------------------
# Copyright (c) 2016-2021, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
hzlf/openbroadcast | refs/heads/master | node_modules/nunjucks/bench/jinja.py | 1 |
import time
from jinja2 import Template, Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('.'))
src = open('index.html').read()
# print(env._generate(env._parse(src, 'poop', 'hello.html'),
# 'poop',
# 'hello.html'))
# print([x for x in env._tokenize(src... |
myroot/crosswalk-tizen | refs/heads/master | tools/gyp/pylib/gyp/win_tool.py | 231 | #!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility functions for Windows builds.
These functions are executed via gyp-win-tool when using the ninja generator.
"""
from ctypes imp... |
climberwb/video-api | refs/heads/master | src/accounts/migrations/0001_initial.py | 6 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='MyUser',
fields=[
... |
marcoantoniooliveira/labweb | refs/heads/master | oscar/lib/python2.7/site-packages/django/conf/locale/mk/formats.py | 118 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'd F Y'
TIME_FORMAT = 'H:i:s'
DATE... |
Jgarcia-IAS/SAT | refs/heads/master | openerp/addons-extra/odoo-pruebas/odoo-server/openerp/modules/migration.py | 4 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2013 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... |
ClearCorp-dev/odoo-clearcorp | refs/heads/9.0 | TODO-9.0/pos_price_confirm/__init__.py | 6 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... |
pakodekker/oceansar | refs/heads/master | oceansar/utils/misc.py | 1 |
import numpy as np
from scipy import signal
def get_parFile(parfile=None):
"""Mini gui to get filename
"""
def _test(out_q):
out_q.put('hola')
if (parfile is None):
#output_queue = multiprocessing.Queue()
#p = multiprocessing.Process(target=_get_parFile, args=(ou... |
supersven/intellij-community | refs/heads/master | python/helpers/pydev/pydev_ipython/inputhookwx.py | 53 | # encoding: utf-8
"""
Enable wxPython to be used interacive by setting PyOS_InputHook.
Authors: Robin Dunn, Brian Granger, Ondrej Certik
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the... |
h4ck3rm1k3/OpenWrt-Firefly-SDK | refs/heads/master | staging_dir/host/lib/scons-2.3.1/SCons/Tool/sgic++.py | 11 | """SCons.Tool.sgic++
Tool-specific initialization for MIPSpro C++ on SGI.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2... |
sergey-shandar/autorest | refs/heads/master | src/generator/AutoRest.Python.Azure.Tests/Expected/AcceptanceTests/AzureParameterGrouping/fixtures/acceptancetestsazureparametergrouping/version.py | 1003 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
wfxiang08/changes | refs/heads/master | changes/config.py | 1 | import celery
import changes
import logging
import flask
import os
import os.path
import shutil
import time
import warnings
from celery.schedules import crontab
from celery.signals import task_postrun
from datetime import timedelta
from flask import request, session, Blueprint
from flask.ext.sqlalchemy import SQLAlche... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.