repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
cvsuser-chromium/chromium | ppapi/generators/idl_generator.py | 165 | 8397 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
from idl_log import ErrOut, InfoOut, WarnOut
from idl_option import GetOption, Option, ParseOptions
from idl_parser imp... | bsd-3-clause |
wetneb/django | django/contrib/flatpages/templatetags/flatpages.py | 472 | 3632 | from django import template
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.shortcuts import get_current_site
register = template.Library()
class FlatpageNode(template.Node):
def __init__(self, context_name, starts_with=None, user=None):
sel... | bsd-3-clause |
Fkawala/gcloud-python | system_tests/bigtable.py | 3 | 17333 | # Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 |
MechanisM/musicdb | contrib/django/db/backends/mysql/client.py | 524 | 1380 | import os
import sys
from django.db.backends import BaseDatabaseClient
class DatabaseClient(BaseDatabaseClient):
executable_name = 'mysql'
def runshell(self):
settings_dict = self.connection.settings_dict
args = [self.executable_name]
db = settings_dict['OPTIONS'].get('db', settings_d... | agpl-3.0 |
tealover/nova | nova/virt/libvirt/rbd_utils.py | 25 | 10843 | # Copyright 2012 Grid Dynamics
# Copyright 2013 Inktank Storage, Inc.
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.or... | apache-2.0 |
reyoung/Paddle | benchmark/tensorflow/rnn/rnn_multi_gpu.py | 21 | 12436 | #!/usr/bin/env python
from six.moves import xrange # pylint: disable=redefined-builtin
import re
import math
import time
import numpy as np
from datetime import datetime
import reader
import tensorflow as tf
from tensorflow.python.ops import rnn
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_integer('batch_size', 6... | apache-2.0 |
benschmaus/catapult | third_party/gsutil/third_party/boto/boto/ec2containerservice/layer1.py | 135 | 31044 | # Copyright (c) 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... | bsd-3-clause |
sogno/stbgui | lib/python/Screens/PluginBrowser.py | 1 | 16924 | from Screen import Screen
from Screens.ParentalControlSetup import ProtectedScreen
from enigma import eConsoleAppContainer, eDVBDB
from Components.ActionMap import ActionMap, NumberActionMap
from Components.config import config, ConfigSubsection, ConfigText
from Components.PluginComponent import plugins
from Component... | gpl-2.0 |
batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/encodings/iso8859_13.py | 272 | 13271 | """ Python Character Mapping Codec iso8859_13 generated from 'MAPPINGS/ISO8859/8859-13.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors... | apache-2.0 |
aplanas/rally | tests/unit/cli/test_manage.py | 9 | 1368 | # Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | apache-2.0 |
madscatt/zazmol | src/python/test_sasmol/test_file_io/test_intg_file_io_Files_write_dcd_frames.py | 2 | 10912 | '''
SASMOL: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... | gpl-3.0 |
stdweird/aquilon | lib/python2.6/aquilon/worker/commands/del_intervention.py | 2 | 1458 | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013 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 copy... | apache-2.0 |
shashwatsehgal/ToLop | lib/requests/compat.py | 71 | 1595 | # -*- coding: utf-8 -*-
"""
requests.compat
~~~~~~~~~~~~~~~
This module handles import compatibility issues between Python 2 and
Python 3.
"""
import chardet
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] =... | apache-2.0 |
tuxfux-hlp-notes/python-batches | archieves/batch-64/09-modules/myenv/lib/python2.7/site-packages/django/contrib/sites/migrations/0001_initial.py | 276 | 1096 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.contrib.sites.models
from django.contrib.sites.models import _simple_domain_name_validator
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = []
operations = [
migrations.Create... | gpl-3.0 |
CPBridge/fetal_heart_analysis | scripts/utilities/test_argparse.py | 1 | 4426 | import argparse as ap
# This is intended to replicate the functionality of the argument parser in
# test.cpp
test_arg_parser = ap.ArgumentParser()
test_arg_parser.add_argument('--pause','-u', help="pause the video until a key press after each frame")
test_arg_parser.add_argument('--display_hidden','-H', help="displa... | gpl-3.0 |
raajitr/django_hangman | env/lib/python2.7/site-packages/rest_framework/authtoken/models.py | 17 | 1307 | import binascii
import os
from django.conf import settings
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class Token(models.Model):
"""
The default authorization token model.
... | mit |
Mte90/remo | remo/dashboard/tests/test_views.py | 3 | 9978 | from datetime import timedelta
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core import mail
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.utils.timezone import now
import mock
from nose.tools import eq_, ok_
... | bsd-3-clause |
d0ugal/readthedocs.org | readthedocs/vcs_support/utils.py | 17 | 3450 | import logging
import os
import time
import stat
log = logging.getLogger(__name__)
class LockTimeout(Exception):
pass
class Lock(object):
"""
A simple file based lock with timeout
On entering the context, it will try to aquire the lock. If timeout passes,
it just gets the lock anyway.
If w... | mit |
misdoro/python-ase | ase/calculators/siesta.py | 2 | 31261 | from __future__ import print_function
"""This module defines an ASE interface to SIESTA.
http://www.uam.es/departamentos/ciencias/fismateriac/siesta
"""
import os
from os.path import join, isfile, islink, getmtime
from cmath import exp
import array
import numpy as np
from ase.data import chemical_symbols
from ase.u... | gpl-2.0 |
quantopian/zipline | zipline/examples/buy_and_hold.py | 1 | 1568 | #!/usr/bin/env python
#
# Copyright 2015 Quantopian, 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 ... | apache-2.0 |
PythonProgramming/pygame-tutorial-series | part7.py | 2 | 2665 | import pygame
import time
import random
pygame.init()
display_width = 800
display_height = 600
black = (0,0,0)
white = (255,255,255)
red = (255,0,0)
car_width = 73
gameDisplay = pygame.display.set_mode((display_width,display_height))
pygame.display.set_caption('A bit Racey')
clock = pygame.time.Clock()
carImg = p... | mit |
apixandru/intellij-community | python/lib/Lib/decimal.py | 74 | 183326 | # Copyright (c) 2004 Python Software Foundation.
# All rights reserved.
# Written by Eric Price <eprice at tjhsst.edu>
# and Facundo Batista <facundo at taniquetil.com.ar>
# and Raymond Hettinger <python at rcn.com>
# and Aahz <aahz at pobox.com>
# and Tim Peters
# This module is currently Py2.3 compatibl... | apache-2.0 |
gench/rec2 | Allrecipes-Scraper/recipe.py | 1 | 4424 | import json
class Recipe:
NUTRIENT_TAG = './/ul[@class="nutrientLine"]'
TIME_TAG = './/ul[@class="prepTime"]'
GENERAL_TAG = './/section[contains(@class, "recipe-summary")]'
RATING_TAG = './/div[@class="rating-stars"]'
NUM_RATINGS_TAG = './/span[@class="review-count"]'
DESCRIPTION_TAG = './/div... | gpl-3.0 |
ncc-unesp/goo-dataproxy | core/api/resources.py | 1 | 5320 | # This file is part of goo-dataproxy.
#
# Copyright (c) 2103-2014 by Nucleo de Computacao Cientifica, UNESP
#
# Authors:
# Beraldo Leal <beraldo AT ncc DOT unesp DOT br>
# Gabriel von. Winckler <winckler AT ncc DOT unesp DOT br>
#
# goo-dataproxy is free software: you can redistribute it and/or modify
# it under ... | gpl-3.0 |
centaurialpha/ninja-ide | ninja_ide/intellisensei/jedi/parser/tokenize.py | 3 | 13763 | # -*- coding: utf-8 -*-
"""
This tokenizer has been copied from the ``tokenize.py`` standard library
tokenizer. The reason was simple: The standard library tokenizer fails
if the indentation is not right. The fast parser of jedi however requires
"wrong" indentation.
Basically this is a stripped down version of the sta... | gpl-3.0 |
ericlink/adms-server | playframework-dist/1.1-src/framework/pym/play/utils.py | 2 | 8837 | import sys
import os, os.path
import re
import random
import fileinput
import getopt
import shutil
import zipfile
def playVersion(play_env):
play_version_file = os.path.join(play_env["basedir"], 'framework', 'src', 'play', 'version')
return open(play_version_file).readline().strip()
def replaceAll(file, searc... | mit |
eHealthAfrica/onadata | onadata/apps/api/serializers.py | 2 | 9603 | import copy
from django.forms import widgets
from django.contrib.auth.models import User
from rest_framework import serializers
from rest_framework.exceptions import ParseError
from onadata.apps.api.models import Project, OrganizationProfile, Team
from onadata.apps.api.fields import HyperlinkedMultiIdentityField,\
... | bsd-2-clause |
mlperf/training_results_v0.6 | NVIDIA/benchmarks/minigo/implementations/tensorflow/minigo/features.py | 3 | 4840 | # Copyright 2018 Google LLC
#
# 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, ... | apache-2.0 |
allotria/intellij-community | python/helpers/pydev/_pydev_bundle/pydev_console_utils.py | 5 | 18214 | import os
import signal
import sys
import traceback
from _pydev_bundle import _pydev_imports_tipper
from _pydev_bundle.pydev_code_executor import BaseCodeExecutor
from _pydev_bundle.pydev_console_types import CodeFragment
from _pydev_bundle.pydev_imports import Exec
from _pydev_bundle.pydev_stdin import StdIn, DebugCo... | apache-2.0 |
takahiro33/ICC | .waf-1.7.9-786a25f4411038005f1f2ec0d121c503/waflib/extras/boost.py | 3 | 10213 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
'''
This is an extra tool, not bundled with the default waf binary.
To add the boost tool to the waf file:
$ ./waf-light --tools=compat15,boost
or, if you have waf >= 1.6.2
... | agpl-3.0 |
MBALearnsToCode/ProbabPyReason | ProbabPyReason/HiddenMarkovModel.py | 1 | 7006 | from copy import deepcopy
from frozendict import frozendict
from ProbabPy import OnePDF, OnePMF
class HiddenMarkovModel:
def __init__(self, state_var, observation_var,
state_prior_pdf, transition_pdf_template, observation_pdf_template):
self.state_var = state_var
self.observation_... | mit |
moto-timo/ironpython3 | Src/StdLib/Lib/xml/etree/ElementTree.py | 5 | 57594 | """Lightweight XML support for Python.
XML is an inherently hierarchical data format, and the most natural way to
represent it is with a tree. This module has two classes for this purpose:
1. ElementTree represents the whole XML document as a tree and
2. Element represents a single node in this tree.
In... | apache-2.0 |
vrenaville/ngo-addons-backport | addons/stock/partner.py | 57 | 1890 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
jzoldak/edx-platform | cms/startup.py | 9 | 2130 | """
Module with code executed during Studio startup
"""
from django.conf import settings
# Force settings to run so that the python path is modified
settings.INSTALLED_APPS # pylint: disable=pointless-statement
from openedx.core.lib.django_startup import autostartup
import django
from openedx.core.djangoapps.monke... | agpl-3.0 |
sylvan5/pygame | pyrpg/pyrpg15/pyrpg15.py | 1 | 19499 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
import codecs
import os
import random
import sys
SCR_RECT = Rect(0, 0, 640, 480)
GS = 32
DOWN,LEFT,RIGHT,UP = 0,1,2,3
STOP, MOVE = 0, 1 # 移動タイプ
PROB_MOVE = 0.005 # 移動確率
def main():
pygame.init()
screen = pygame.display.s... | mit |
qwefi/nova | nova/compute/resource_tracker.py | 3 | 24000 | # Copyright (c) 2012 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 ... | apache-2.0 |
fjbatresv/odoo | addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py | 318 | 9494 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
canaltinova/servo | tests/wpt/web-platform-tests/referrer-policy/generic/tools/generate.py | 15 | 7360 | #!/usr/bin/env python
from __future__ import print_function
import os, sys, json
from common_paths import *
import spec_validator
import argparse
def expand_test_expansion_pattern(spec_test_expansion, test_expansion_schema):
expansion = {}
for artifact in spec_test_expansion:
artifact_value = spec_t... | mpl-2.0 |
GaryKriebel/osf.io | website/addons/osfstorage/tests/test_models.py | 4 | 14077 | # encoding: utf-8
import mock
import unittest
from nose.tools import * # noqa
from tests.base import OsfTestCase
from tests.factories import ProjectFactory
from website.addons.osfstorage.tests import factories
from website.addons.osfstorage.tests.utils import StorageTestCase
import datetime
from modularodm import... | apache-2.0 |
TeachAtTUM/edx-platform | common/djangoapps/third_party_auth/tests/test_admin.py | 5 | 3696 | """
Tests third_party_auth admin views
"""
import unittest
from django.contrib.admin.sites import AdminSite
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from django.forms import models
from student.tests.factories import UserFactory
from third_party_auth.a... | agpl-3.0 |
pkoutsias/SickRage | lib/subliminal/api.py | 3 | 19115 | # -*- coding: utf-8 -*-
from collections import defaultdict
import io
import logging
import operator
import os.path
from pkg_resources import EntryPoint
import socket
from babelfish import Language
import requests
from stevedore import ExtensionManager
from .subtitle import compute_score, get_subtitle_path
logger = ... | gpl-3.0 |
spacediver/behave | behave/reporter/junit.py | 8 | 12420 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os.path
import codecs
import sys
from xml.etree import ElementTree
from behave.reporter.base import Reporter
from behave.model import Scenario, ScenarioOutline, Step
from behave.formatter import ansi_escapes
from behave.model_describe import ModelDe... | bsd-2-clause |
nvoron23/scipy | scipy/weave/build_tools.py | 97 | 26432 | """ Tools for compiling C/C++ code to extension modules
The main function, build_extension(), takes the C/C++ file
along with some other options and builds a Python extension.
It uses distutils for most of the heavy lifting.
choose_compiler() is also useful (mainly on windows anyway)
for trying to... | bsd-3-clause |
shiquanwang/pylearn2 | pylearn2/gui/tangent_plot.py | 5 | 1687 | """
Code for plotting curves with tangent lines.
"""
__author__ = "Ian Goodfellow"
try:
from matplotlib import pyplot
except Exception:
pyplot = None
def tangent_plot(x, y, s):
"""
Plots a curve with tangent lines.
Parameters
----------
x : list
List of x coordinates.
As... | bsd-3-clause |
dursk/django | django/contrib/gis/geos/prototypes/prepared.py | 288 | 1214 | from ctypes import c_char
from django.contrib.gis.geos.libgeos import (
GEOM_PTR, PREPGEOM_PTR, GEOSFuncFactory,
)
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
# Prepared geometry constructor and destructors.
geos_prepare = GEOSFuncFactory('GEOSPrepare', argtypes=[GEOM_PTR], restype=PRE... | bsd-3-clause |
visaxin/flask | flask/blueprints.py | 141 | 16871 | # -*- coding: utf-8 -*-
"""
flask.blueprints
~~~~~~~~~~~~~~~~
Blueprints are the recommended way to implement larger or more
pluggable applications in Flask 0.7 and later.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from functools import update_wrap... | bsd-3-clause |
netsamir/dotfiles | dotbot/lib/pyyaml/tests/lib/test_input_output.py | 55 | 6210 |
import yaml
import codecs, StringIO, tempfile, os, os.path
def _unicode_open(file, encoding, errors='strict'):
info = codecs.lookup(encoding)
if isinstance(info, tuple):
reader = info[2]
writer = info[3]
else:
reader = info.streamreader
writer = info.streamwriter
srw = ... | unlicense |
calfonso/ansible | test/units/modules/cloud/amazon/test_aws_direct_connect_link_aggregation_group.py | 89 | 7309 | # (c) 2017 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dis... | gpl-3.0 |
verycumbersome/the-blue-alliance | controllers/suggestions/suggest_event_media_review_controller.py | 3 | 3584 | import datetime
import os
import json
import logging
from google.appengine.ext import ndb
from consts.account_permissions import AccountPermissions
from consts.media_type import MediaType
from controllers.suggestions.suggestions_review_base_controller import SuggestionsReviewBaseController
from helpers.media_manipula... | mit |
mepesh/eqapp_rev_2 | eqapp_rev_2.py | 1 | 1226 | from flask import Flask, redirect, render_template
from datetime import datetime
import csv,random
app = Flask(__name__)
#creating csv file
with open('templates/eqdata.csv','wb') as fwrite:
writer = csv.writer(fwrite)
for i in range(1,10):
writer.writerow((i,datetime.now().strftime("%Y-%m-%d... | apache-2.0 |
albertomurillo/ansible | lib/ansible/plugins/callback/mail.py | 69 | 8479 | # -*- coding: utf-8 -*-
# Copyright: (c) 2012, Dag Wieers <dag@wieers.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
DOCUMENTATION = '''
callback: mail
type: notification
short_d... | gpl-3.0 |
sl2017/campos | campos_event/controllers/main.py | 1 | 25825 | # -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of CampOS Event, an Odoo module.
#
# Copyright (c) 2015 Stein & Gabelgaard ApS
# http://www.steingabelgaard.dk
# Hans Henrik Gaelgaard
#
# ... | agpl-3.0 |
karan1276/servo | tests/wpt/web-platform-tests/tools/pytest/_pytest/runner.py | 173 | 17105 | """ basic collect and runtest protocol implementations """
import bdb
import sys
from time import time
import py
import pytest
from _pytest._code.code import TerminalRepr, ExceptionInfo
def pytest_namespace():
return {
'fail' : fail,
'skip' : skip,
'importorskip' : importo... | mpl-2.0 |
ghchinoy/tensorflow | tensorflow/python/kernel_tests/distributions/gamma_test.py | 44 | 15465 | # 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 |
kkuunnddaannkk/vispy | vispy/visuals/collections/__init__.py | 21 | 1112 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
"""
Collections ... | bsd-3-clause |
markovmodel/PyEMMA | pyemma/coordinates/data/_base/random_accessible.py | 2 | 5928 | from abc import ABCMeta, abstractmethod
import numpy as np
import numbers
class NotRandomAccessibleException(Exception):
pass
class TrajectoryRandomAccessible(object):
def __init__(self):
super(TrajectoryRandomAccessible, self).__init__()
self._ra_cuboid = NotImplementedRandomAccessStrategy... | lgpl-3.0 |
rkokkelk/CouchPotatoServer | libs/suds/sax/attribute.py | 203 | 5788 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | gpl-3.0 |
mtesauro/gauntlt-demo | examples/webgoat/vuln-04/http_attack.py | 2 | 1399 | #Python attack file
import requests
import json
url1 = "http://127.0.0.1:8080/WebGoat/login.mvc"
url2 = "http://127.0.0.1:8080/WebGoat/j_spring_security_check"
payload = {'username':'guest','password':'guest'}
session = requests.Session()
first_request = session.get(url1)
login = session.post(url2, data=payload)
url... | mit |
beomyeol/models | neural_gpu/wmt_utils.py | 3 | 16405 | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
hakehuang/rt-thread | bsp/beaglebone/rtconfig.py | 28 | 2652 | import os
# toolchains options
ARCH='arm'
CPU='am335x'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = r'C:\Program Files (x86)\CodeSourcery\Sourcery_CodeBench_Lite_for_ARM_EABI\bin'
elif CROSS_TOOL == 'keil':
PLATFORM = ... | gpl-2.0 |
andela-brotich/CP2-bucket-list-api | app/mod_bucketlists/controller.py | 2 | 10484 | from flask import Blueprint, request, jsonify, abort
from flask import url_for
from flask_httpauth import HTTPTokenAuth
from itsdangerous import BadTimeSignature, BadSignature
from app import token_signer, db, app
from app.mod_auth.models import User
from app.mod_bucketlists.models import BucketList, BucketListItem
"... | mit |
openstack/manila | manila/tests/test_api.py | 1 | 2636 | # 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 ... | apache-2.0 |
grhawk/ASE | ase/optimize/fire.py | 10 | 1688 | import numpy as np
from ase.optimize.optimize import Optimizer
class FIRE(Optimizer):
def __init__(self, atoms, restart=None, logfile='-', trajectory=None,
dt=0.1, maxmove=0.2, dtmax=1.0, Nmin=5, finc=1.1, fdec=0.5,
astart=0.1, fa=0.99, a=0.1):
Optimizer.__init__(self, a... | gpl-2.0 |
nicoTrombon/DjangoPolls | env/Lib/site-packages/django/contrib/gis/gdal/field.py | 122 | 6400 | from ctypes import byref, c_int
from datetime import date, datetime, time
from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.gdal.prototypes import ds as capi
from django.utils.encoding import force_text
# For more information, see the OG... | bsd-3-clause |
nysan/yocto-autobuilder | lib/python2.6/site-packages/Jinja2-2.5.5-py2.6.egg/jinja2/_stringdefs.py | 412 | 404256 | # -*- coding: utf-8 -*-
"""
jinja2._stringdefs
~~~~~~~~~~~~~~~~~~
Strings of all Unicode characters of a certain category.
Used for matching in Unicode-aware languages. Run to regenerate.
Inspired by chartypes_create.py from the MoinMoin project, original
implementation from Pygments.
:co... | gpl-2.0 |
coderbone/SickRage | lib/requests/packages/chardet/langhungarianmodel.py | 2763 | 12536 | ######################## 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 |
tangp3/gpdb | gpMgmt/bin/gppylib/test/behave/mgmt_utils/steps/kerberos_mgmt_utils.py | 19 | 2530 | from gppylib.commands.base import Command, ExecutionError, REMOTE, WorkerPool
from gppylib.db import dbconn
from gppylib.gparray import GpArray
from gppylib.test.behave_utils.utils import run_gpcommand, getRows
from time import gmtime, strftime
import subprocess
from socket import gethostname
@given('the kerberos is s... | apache-2.0 |
jayceyxc/hue | desktop/core/ext-py/Django-1.6.10/django/contrib/gis/db/backends/mysql/introspection.py | 624 | 1426 | from MySQLdb.constants import FIELD_TYPE
from django.contrib.gis.gdal import OGRGeomType
from django.db.backends.mysql.introspection import DatabaseIntrospection
class MySQLIntrospection(DatabaseIntrospection):
# Updating the data_types_reverse dictionary with the appropriate
# type for Geometry fields.
d... | apache-2.0 |
MPIB/Lagerregal | network/tests.py | 1 | 2252 | from django.test import TestCase
from django.test.client import Client
from django.urls import reverse
from model_mommy import mommy
from network.models import IpAddress
from users.models import Lageruser
class IpAddressTests(TestCase):
def setUp(self):
self.client = Client()
self.admin = Lageru... | bsd-3-clause |
lhl/pensieve | js/node_modules/prosemirror/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py | 1843 | 1786 | #!/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.
""" Unit tests for the ninja.py file. """
import gyp.generator.ninja as ninja
import unittest
import StringIO
import sys
import TestCommon
... | gpl-3.0 |
diagramsoftware/odoo | addons/email_template/wizard/email_template_preview.py | 377 | 3851 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it ... | agpl-3.0 |
chand3040/cloud_that | lms/djangoapps/courseware/migrations/0006_create_student_module_history.py | 114 | 8158 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'StudentModuleHistory'
db.create_table('courseware_studentmodulehistory', (
('id'... | agpl-3.0 |
looker/sentry | tests/sentry/api/endpoints/test_team_stats.py | 2 | 1224 | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry import tsdb
from sentry.testutils import APITestCase
class TeamStatsTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
team = self.create_team(members=[self.user])
projec... | bsd-3-clause |
soldag/home-assistant | tests/components/tasmota/conftest.py | 5 | 2049 | """Test fixtures for Tasmota component."""
from hatasmota.discovery import get_status_sensor_entities
import pytest
from homeassistant import config_entries
from homeassistant.components.tasmota.const import (
CONF_DISCOVERY_PREFIX,
DEFAULT_PREFIX,
DOMAIN,
)
from tests.async_mock import patch
from tests.c... | apache-2.0 |
jubalix/terracoin-masterfork | contrib/testgen/base58.py | 2139 | 2818 | '''
Bitcoin base58 encoding and decoding.
Based on https://bitcointalk.org/index.php?topic=1026.0 (public domain)
'''
import hashlib
# for compatibility with following code...
class SHA256:
new = hashlib.sha256
if str != bytes:
# Python 3.x
def ord(c):
return c
def chr(n):
return byte... | mit |
CapOM/ChromiumGStreamerBackend | tools/telemetry/third_party/gsutilz/third_party/boto/tests/unit/emr/test_instance_group_args.py | 112 | 2056 | #!/usr/bin/env python
# Author: Charlie Schluting <charlie@schluting.com>
#
# Test to ensure initalization of InstanceGroup object emits appropriate errors
# if bidprice is not specified, but allows float, int, Decimal.
from decimal import Decimal
from tests.compat import unittest
from boto.emr.instance_group import ... | bsd-3-clause |
zenlambda/pip | tests/unit/test_req_uninstall.py | 28 | 1279 | import os
import pytest
from mock import Mock
import pip.req.req_uninstall
from pip.req.req_uninstall import UninstallPathSet
# Pretend all files are local, so UninstallPathSet accepts files in the tmpdir,
# outside the virtualenv
def mock_is_local(path):
return True
class TestUninstallPathSet(object):
de... | mit |
nagyistoce/netzob | src/netzob/Inference/Vocabulary/Searcher.py | 1 | 17945 | # -*- coding: utf-8 -*-
#+---------------------------------------------------------------------------+
#| 01001110 01100101 01110100 01111010 01101111 01100010 |
#| |
#| Netzob : Inferring communication protocol... | gpl-3.0 |
piyush82/icclab-rcb-web | virtualenv/lib/python2.7/site-packages/django/core/serializers/python.py | 106 | 6103 | """
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from __future__ import unicode_literals
from django.conf import settings
from django.core.serializers import base
from django.db... | apache-2.0 |
gotostack/neutron-lbaas | neutron_lbaas/drivers/radware/v2_driver.py | 1 | 28247 | # Copyright 2015, Radware LTD. 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 ap... | apache-2.0 |
cernops/neutron | neutron/agent/ovs_cleanup_util.py | 8 | 3836 | # Copyright (c) 2012 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... | apache-2.0 |
Kiiv/CouchPotatoServer | couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/discovery.py | 18 | 1798 | from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
class DiscoveryIE(InfoExtractor):
_VALID_URL = r'http://www\.discovery\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9\-]*)(.htm)?'
_TEST = {
'url': 'http://www.discovery.com/tv-shows/mythbus... | gpl-3.0 |
GalaxyTab4/aosp-p_kernel_samsung_matissewifi | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 11088 | 3246 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | gpl-2.0 |
supermarcos/log2bq | mapreduce/lib/pipeline/simplejson/decoder.py | 43 | 15215 | #!/usr/bin/env python
"""Implementation of JSONDecoder
"""
import re
import sys
import struct
# Local changes for relative import.
from scanner import make_scanner
def _import_c_scanstring():
try:
from mapreduce.lib.simplejson._speedups import scanstring
return scanstring
except ImportError:
... | apache-2.0 |
Nexenta/cinder | cinder/api/v2/views/types.py | 9 | 2122 | # Copyright 2012 Red Hat, Inc.
# Copyright 2015 Intel Corporation
# 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 |
resmo/ansible | test/units/executor/module_common/test_modify_module.py | 84 | 1383 | # Copyright (c) 2018 Matt Martz <matt@sivel.net>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from ansible.executor.module_common import modify... | gpl-3.0 |
Stanford-Online/edx-platform | cms/djangoapps/contentstore/management/commands/tests/test_export.py | 24 | 2500 | """
Tests for exporting courseware to the desired path
"""
import unittest
import shutil
import ddt
from django.core.management import CommandError, call_command
from tempfile import mkdtemp
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modul... | agpl-3.0 |
postlund/home-assistant | homeassistant/components/glances/const.py | 1 | 1779 | """Constants for Glances component."""
from homeassistant.const import DATA_GIBIBYTES, DATA_MEBIBYTES, TEMP_CELSIUS
DOMAIN = "glances"
CONF_VERSION = "version"
DEFAULT_HOST = "localhost"
DEFAULT_NAME = "Glances"
DEFAULT_PORT = 61208
DEFAULT_VERSION = 3
DEFAULT_SCAN_INTERVAL = 60
DATA_UPDATED = "glances_data_updated"... | apache-2.0 |
mushtaqak/edx-platform | lms/djangoapps/dashboard/support.py | 50 | 4528 | """
Views for support dashboard
"""
import logging
from django.contrib.auth.models import User
from django.views.generic.edit import FormView
from django.views.generic.base import TemplateView
from django.utils.translation import ugettext as _
from django.http import HttpResponseRedirect
from django.contrib import mes... | agpl-3.0 |
basvandijk/nixops | nixops/backends/none.py | 3 | 2763 | # -*- coding: utf-8 -*-
import os
import sys
import nixops.util
from nixops.backends import MachineDefinition, MachineState
from nixops.util import attr_property, create_key_pair
class NoneDefinition(MachineDefinition):
"""Definition of a trivial machine."""
@classmethod
def get_type(cls):
retur... | lgpl-3.0 |
Workday/OpenFrame | tools/telemetry/telemetry/internal/platform/tracing_agent/chrome_tracing_agent.py | 2 | 7110 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import shutil
import stat
import sys
import tempfile
import traceback
from telemetry.internal.platform import tracing_agent
from telemetry.interna... | bsd-3-clause |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/docutils/parsers/rst/languages/ja.py | 128 | 3863 | # -*- coding: utf-8 -*-
# $Id: ja.py 7119 2011-09-02 13:00:23Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two file... | agpl-3.0 |
ulfjack/bazel | third_party/py/mock/tests/_testwith.py | 109 | 6077 | # Copyright (C) 2007-2012 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# http://www.voidspace.org.uk/python/mock/
from __future__ import with_statement
from tests.support import unittest2, is_instance
from mock import MagicMock, Mock, patch, sentinel, mock_open, call
from tests.suppo... | apache-2.0 |
ikargis/horizon_fod | openstack_dashboard/openstack/common/network_utils.py | 19 | 2207 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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.apac... | apache-2.0 |
metaml/nupic | external/linux32/lib/python2.6/site-packages/matplotlib/colors.py | 69 | 31676 | """
A module for converting numbers or color arguments to *RGB* or *RGBA*
*RGB* and *RGBA* are sequences of, respectively, 3 or 4 floats in the
range 0-1.
This module includes functions and classes for color specification
conversions, and for mapping numbers to colors in a 1-D array of
colors called a colormap. Color... | agpl-3.0 |
Kast0rTr0y/ansible | test/sanity/validate-modules/utils.py | 33 | 3443 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Matt Martz <matt@sivel.net>
# Copyright (C) 2015 Rackspace US, 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 ... | gpl-3.0 |
stackforge/tricircle | tricircle/tests/unit/network/test_central_sfc_plugin.py | 1 | 36327 | # Copyright 2017 Huawei Technologies Co., Ltd.
# 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
#
# Unl... | apache-2.0 |
SciTools/cube_browser | setup.py | 1 | 2272 | #!/usr/bin/env python
from __future__ import print_function
import os
from setuptools import setup
NAME = 'cube_browser'
DIR = os.path.abspath(os.path.dirname(__file__))
def extract_packages():
packages = []
root = os.path.join(DIR, 'lib', NAME)
offset = len(os.path.dirname(root)) + 1
for dpath, d... | bsd-3-clause |
disqus/Diamond | src/diamond/test/testcollector.py | 24 | 1083 | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import unittest
import configobj
from diamond.collector import Collector
class BaseCollectorTest(unittest.TestCase):
def test_SetCustomHostname(self):
config = configobj.ConfigObj... | mit |
joshsamara/game-website | core/migrations/0001_squashed_0020_merge.py | 1 | 11615 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import stdimage.models
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
replaces = [(b'core', '0001_initial'), (b'core', '0002_auto_20150320_0150'), (b'cor... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.