repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
ahmedaljazzar/edx-platform
cms/djangoapps/contentstore/management/commands/force_publish.py
""" Script for force publishing a course """ from django.core.management.base import BaseCommand, CommandError from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from .prompt import query...
sanguinariojoe/FreeCAD
src/Mod/PartDesign/fcgear/fcgeardialog.py
# (c) 2014 David Douard <david.douard@gmail.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (LGPL) # as published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version....
ashaarunkumar/spark-tk
regression-tests/generatedata/count_letters.py
# vim: set encoding=utf-8 # Copyright (c) 2016 Intel Corporation  # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #       http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
erja-gp/openthread
tools/harness-automation/autothreadharness/open_thread_controller.py
#!/usr/bin/env python # # Copyright (c) 2016, The OpenThread Authors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright # notic...
garyjyao1/ansible
lib/ansible/modules/extras/cloud/cloudstack/cs_project.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2015, René Moser <mail@renemoser.net> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Lice...
caio2k/RIDE
src/robotide/lib/robot/utils/connectioncache.py
# Copyright 2008-2015 Nokia Solutions and Networks # # 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 l...
addition-it-solutions/project-all
addons/mail/mail_followers.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2009-today OpenERP SA (<http://www.openerp.com>) # # This program is free software: you can redistribute it and/or modify # it under the terms o...
krattai/ss-middleware
connector/connector/backend.py
# -*- coding: utf-8 -*- ############################################################################## # # Author: Guewen Baconnier # Copyright 2013 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # pu...
chromium/chromium
third_party/dom_distiller_js/protoc_plugins/util/writer.py
# Copyright 2016 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 contextlib class CodeWriter(object): """Helper class for code indentation.""" def __init__(self): self.indent = 0 self.value = [] se...
holygits/incubator-airflow
airflow/contrib/operators/sqoop_operator.py
# -*- 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 ...
unnikrishnankgs/va
venv/lib/python3.5/site-packages/sqlparse/compat.py
# -*- coding: utf-8 -*- # # Copyright (C) 2016 Andi Albrecht, albrecht.andi@gmail.com # # This module is part of python-sqlparse and is released under # the BSD License: https://opensource.org/licenses/BSD-3-Clause """Python 2/3 compatibility. This module only exists to avoid a dependency on six for very trivial stuf...
chrsrds/scikit-learn
examples/semi_supervised/plot_label_propagation_structure.py
""" ============================================== Label Propagation learning a complex structure ============================================== Example of LabelPropagation learning a complex internal structure to demonstrate "manifold learning". The outer circle should be labeled "red" and the inner circle "blue". Be...
ds-hwang/chromium-crosswalk
tools/polymer/txt_to_polymer_grdp.py
#!/usr/bin/env python # 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. from __future__ import with_statement import os import string import sys FILE_TEMPLATE = \ """<?xml version="1.0" encoding="utf-8"?> ...
mdavid/horizon
horizon/test/tests/utils.py
# Copyright 2012 Nebula, 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 agree...
uiri/pxqz
venv/lib/python2.7/site-packages/django/db/models/sql/compiler.py
from itertools import izip from django.core.exceptions import FieldError from django.db import transaction from django.db.backends.util import truncate_name from django.db.models.query_utils import select_related_descend from django.db.models.sql.constants import * from django.db.models.sql.datastructures import Empty...
kbdick/RecycleTracker
recyclecollector/scrap/gdata-2.0.18/samples/apps/marketplace_sample/appengine_utilities/django-middleware/middleware.py
import Cookie import os from common.appengine_utilities import sessions class SessionMiddleware(object): TEST_COOKIE_NAME = 'testcookie' TEST_COOKIE_VALUE = 'worked' def process_request(self, request): """ Check to see if a valid session token exists, if not, then use a cookie on...
jaggu303619/asylum
openerp/addons/note/note.py
# -*- 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...
InakiZabala/odoomrp-wip
product_template_reassign/__openerp__.py
# -*- encoding: utf-8 -*- ############################################################################## # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of th...
TomBaxter/osf.io
addons/base/tests/base.py
from nose.tools import * # noqa (PEP8 asserts) from framework.auth import Auth from django.conf import settings from osf_tests.factories import AuthUserFactory, ProjectFactory class AddonTestCase(object): """General Addon TestCase that automatically sets up a user and node with an addon. Must define:...
kustodian/ansible
lib/ansible/executor/playbook_executor.py
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
guorendong/iridium-browser-ubuntu
tools/profile_chrome/chrome_startup_controller_unittest.py
# 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 json from profile_chrome import chrome_startup_controller from profile_chrome import controllers_unittest class ChromeControllerTest(cont...
sserrot/champion_relationships
venv/Lib/site-packages/dateutil/easter.py
# -*- coding: utf-8 -*- """ This module offers a generic easter computing method for any given year, using Western, Orthodox or Julian algorithms. """ import datetime __all__ = ["easter", "EASTER_JULIAN", "EASTER_ORTHODOX", "EASTER_WESTERN"] EASTER_JULIAN = 1 EASTER_ORTHODOX = 2 EASTER_WESTERN = 3 def easter(year,...
MeteorAdminz/viper
viper/modules/peepdf/JSAnalysis.py
# # peepdf is a tool to analyse and modify PDF files # http://peepdf.eternal-todo.com # By Jose Miguel Esparza <jesparza AT eternal-todo.com> # # Copyright (C) 2011-2014 Jose Miguel Esparza # # This file is part of peepdf. # # peepdf is free software: you can redistribute it and/or modify # ...
gianina-ingenuity/titanium-branch-deep-linking
testbed/x/mobilesdk/osx/5.5.1.GA/iphone/logger.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Tail an application log file running in the iPhone Simulator # import os, sys, subprocess, time, signal, run, filetail def find_file(folder, fname): for root, dirs, files in os.walk(folder): for file in files: # make search case insensitive ...
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/django/middleware/clickjacking.py
""" Clickjacking Protection Middleware. This module provides a middleware that implements protection against a malicious site loading resources from your site in a hidden frame. """ from django.conf import settings class XFrameOptionsMiddleware(object): """ Middleware that sets the X-Frame-Options HTTP head...
guorendong/iridium-browser-ubuntu
build/android/pylib/host_driven/test_runner.py
# 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. """Runs host-driven tests on a particular device.""" import logging import sys import time import traceback from pylib.base import base_test_result from py...
chand3040/sree_odoo
openerp/addons/payment_authorize/tests/test_authorize.py
# -*- coding: utf-8 -*- import hashlib import hmac import time import urlparse from lxml import objectify import openerp from openerp.addons.payment.models.payment_acquirer import ValidationError from openerp.addons.payment.tests.common import PaymentAcquirerCommon from openerp.addons.payment_authorize.controllers.ma...
hackerbot/DjangoDev
tests/template_tests/templatetags/custom.py
import operator import warnings from django import template from django.template.defaultfilters import stringfilter from django.utils import six register = template.Library() @register.filter @stringfilter def trim(value, num): return value[:num] @register.filter def noop(value, param=None): """A noop fil...
alxgu/ansible
test/units/module_utils/facts/base.py
# base unit test classes for ansible/module_utils/facts/ tests # -*- coding: utf-8 -*- # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any lat...
vileopratama/vitech
src/addons/hr_holidays/wizard/hr_holidays_summary_employees.py
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import time from openerp.osv import fields, osv class hr_holidays_summary_employee(osv.osv_memory): _name = 'hr.holidays.summary.employee' _description = 'HR Leaves Summary Report By Employee' _columns = { ...
KSanthanam/rethinkdb
test/memcached_workloads/rget.py
#!/usr/bin/env python # Copyright 2010-2012 RethinkDB, all rights reserved. import os, sys, random, time sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, "common"))) import rdb_workload_common from line import * key_padding = ''.zfill(20) def gen_key(prefix, num): return pref...
calamityman/ansible-modules-extras
source_control/github_hooks.py
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2013, Phillip Gentry <phillip@cx.com> # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the Licen...
manqala/erpnext
erpnext/accounts/doctype/gl_entry/test_gl_entry.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe, unittest from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry class TestGLEntry(unittest.TestCase): ...
mattbernst/polyhartree
support/ansible/modules/extras/monitoring/datadog_event.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Author: Artūras 'arturaz' Šlajus <x11@arturaz.net> # # This module is proudly sponsored by iGeolise (www.igeolise.com) and # Tiny Lab Productions (www.tinylabproductions.com). DOCUMENTATION = ''' --- module: datadog_event short_description: Posts events to DataDog service...
ashutrix03/inteygrate_flaskapp-master
yowsup/layers/auth/protocolentities/auth.py
from yowsup.structs import ProtocolEntity, ProtocolTreeNode class AuthProtocolEntity(ProtocolEntity): def __init__(self, user, mechanism = "WAUTH-2", passive = False, nonce = None): super(AuthProtocolEntity, self).__init__("auth") self.user = user self.mechanism = mechanism self.pass...
BitWriters/Zenith_project
zango/lib/python3.5/site-packages/setuptools/config.py
from __future__ import absolute_import, unicode_literals import io import os import sys from collections import defaultdict from functools import partial from distutils.errors import DistutilsOptionError, DistutilsFileError from setuptools.py26compat import import_module from six import string_types def read_configu...
gnu-sandhi/sandhi
modules/gr36/grc/base/__init__.py
""" Copyright 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later ...
EmadMokhtar/Django
tests/postgres_tests/test_citext.py
""" The citext PostgreSQL extension supports indexing of case-insensitive text strings and thus eliminates the need for operations such as iexact and other modifiers to enforce use of an index. """ from django.db import IntegrityError from django.test.utils import modify_settings from . import PostgreSQLTestCase from ...
unnikrishnankgs/va
venv/lib/python3.5/site-packages/tensorflow/python/saved_model/signature_def_utils.py
# 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...
valexandersaulys/airbnb_kaggle_contest
venv/lib/python3.4/site-packages/scipy/linalg/tests/test_fblas.py
# Test interfaces to fortran blas. # # The tests are more of interface than they are of the underlying blas. # Only very small matrices checked -- N=3 or so. # # !! Complex calculations really aren't checked that carefully. # !! Only real valued complex numbers are used in tests. from __future__ import division, print...
e-gob/plataforma-kioscos-autoatencion
scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/module_utils/postgres.py
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
npuichigo/ttsflow
third_party/tensorflow/tensorflow/python/kernel_tests/gradient_correctness_test.py
# Copyright 2015 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...
LumPenPacK/NetworkExtractionFromImages
win_build/nefi2_win_amd64_msvc_2015/site-packages/numpy/polynomial/tests/test_classes.py
"""Test inter-conversion of different polynomial classes. This tests the convert and cast methods of all the polynomial classes. """ from __future__ import division, absolute_import, print_function import operator as op from numbers import Number import numpy as np from numpy.polynomial import ( Polynomial, Leg...
tnkteja/myhelp
virtualEnvironment/lib/python2.7/site-packages/coverage/html.py
"""HTML reporting for Coverage.""" import os, re, shutil, sys import coverage from coverage.backward import pickle from coverage.misc import CoverageException, Hasher from coverage.phystokens import source_token_lines, source_encoding from coverage.report import Reporter from coverage.results import Numbers from cove...
Ju2ender/CSharp-Exercise
shadowsocks/shadowsocks/encrypt.py
#!/usr/bin/env python # # Copyright 2012-2015 clowwindy # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
crosswalk-project/web-testing-service
tools/pywebsocket/src/mod_pywebsocket/extensions.py
# Copyright 2012, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
edisonlz/fruit
web_project/base/site-packages/gdata/geo/__init__.py
# -*-*- encoding: utf-8 -*-*- # # This is gdata.photos.geo, implementing geological positioning in gdata structures # # $Id: __init__.py 81 2007-10-03 14:41:42Z havard.gulldahl $ # # Copyright 2007 Håvard Gulldahl # Portions copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License");...
slibby/machine
openaddr/expand.py
""" Expand and alter case street names in US English ie: "ST. SEBASTIAN ST" becomes "Saint Sebastian Street" This code is a port of the Node conform's _expandElements function https://github.com/openaddresses/openaddresses-conform/blob/572b7a8066db107f028ecd5407fda0b2c7041d84/Tools/csv.js#L225 See also StreetNames,...
ashbc/tgrsite
rpgs/urls.py
from django.urls import path from . import views app_name = "rpgs" urlpatterns = [ path('', views.Index.as_view(), name='index'), path('<int:pk>/', views.Detail.as_view(), name='detail'), path('create/', views.Create.as_view(), name='create'), path('<int:pk>/edit/', views.Update.as_view(), name='edi...
wablair/misc_scripts
set_hp_scan_folders.py
""" Script to add scan folder to HP MFP M521dn, which lacks an address book fuction for scan folders. """ import requests import urllib3 # Certs are self signed so let's ignore. urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # IP addresses of printers to set the scan folders on. prin...
KermMartian/pymclevel
directories.py
# -*- coding: utf-8 -*- """Copyright (c) 2010-2012 David Rio Vierra Permission to use, copy, modify, and/or 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 THE...
thornomad/cask-dl
travis_pypi_setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Update encrypted deploy password in Travis config file """ from __future__ import print_function import base64 import json import os from getpass import getpass import yaml from cryptography.hazmat.primitives.serialization import load_pem_public_key from cryptography.h...
timj/scons
test/Repository/targets.py
#!/usr/bin/env python # # __COPYRIGHT__ # # 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, ...
dmakian/feudal_networks
feudal_networks/envs/vision_maze.py
import gym from gym import spaces import numpy as np class VisionMazeEnv(gym.Env): def __init__(self, room_length=3, num_rooms_per_side=2): assert room_length % 2 == 1, "room_length must be odd" assert room_length >= 3, "room_length must be greater than 3" assert num_rooms_per_side >= 1, "...
danielbaak/imperii-viz
regeste/models.py
from django.db import models from location.models import Location class Department(models.Model): """ Department id der uni mainz Department-->Volume-->Issue """ name = models.CharField(max_length=200) department_id = models.IntegerField(unique=True) class Volume(models.Model): """ ...
bmatejek/ibex
algorithms/agglomerate.py
from ibex.transforms import seg2seg, seg2gold from ibex.data_structures import UnionFind from ibex.utilities import dataIO import numpy as np import os import struct def Agglomerate(prefix, model_prefix, threshold=0.5): # read the segmentation data segmentation = dataIO.ReadSegmentationData(prefix) # g...
nico01f/z-pec
ZimbraBuild/support/gobuild/helpers/legacymake.py
# Copyright 2008 VMware, Inc. All rights reserved. -- VMware Confidential """ Helpers for legacy make-based targets. """ import helpers.make import helpers.util class LegacyMakeHelper(helpers.make.MakeHelper): """ Helper class for targets that build with make and rely on legacy makefile flags such as `CPAN...
ZhiangChen/bendix_dnn
front_radar/tanh_hidden_layers.py
#!/usr/bin/env python ''' Zhiang Chen Aug,2016 ''' from six.moves import cPickle as pickle import matplotlib.pyplot as plt import os import tensorflow as tf import numpy as np import time '''Load Data''' wd = os.getcwd() file_name = wd+'/front_dist_data' with open(file_name, 'rb') as f: save = pickle.load(f) ...
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/aio/operations/_available_service_aliases_operations.py
# 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 may ...
IntSPstudio/vslst-python
sta/980004006.py
#|==============================================================|# # Made by IntSPstudio # Project Visual Street # ID: 980004006 # Twitter: @IntSPstudio #|==============================================================|# #SYSTEM import os import sys #import time import turtle import math #ALG #Ympyrän kehän koko def c...
simbuerg/benchbuild
benchbuild/experiments/sequences/polly_stats.py
#!/usr/bin/env python """This module supplies utility functions that are required to retrieve information from calls of the LLVM opt tool. """ import os from benchbuild.utils.compiler import clang_cxx __author__ = "Christoph Woller" __credits__ = ["Christoph Woller"] __maintainer__ = "Christoph Woller" __email__ = "wo...
jatraug/Dataclass
Module3/andrews.py
from sklearn.datasets import load_iris from pandas.tools.plotting import andrews_curves import pandas as pd import matplotlib.pyplot as plt import matplotlib # Look pretty... matplotlib.style.use('ggplot') # If the above line throws an error, use plt.style.use('ggplot') instead # Load up SKLearn's Iris Da...
mriehl/fysom
src/unittest/python/test_state.py
# coding=utf-8 # # fysom - pYthOn Finite State Machine - this is a port of Jake # Gordon's javascript-state-machine to python # https://github.com/jakesgordon/javascript-state-machine # # Copyright (C) 2011 Mansour Behabadi <mansour@oxplot.com>, Jake Gordon # and o...
screwgoth/JugheadBot
Jughead/settings.py
""" Django settings for Jughead project. Generated by 'django-admin startproject' using Django 1.11. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import os i...
SciLifeLab/bcbio-nextgen
bcbio/bam/__init__.py
"""Functionality to query and extract information from aligned BAM files. """ import collections import contextlib import os import itertools import subprocess import numpy import pysam import toolz as tz from bcbio import utils from bcbio.bam import ref from bcbio.distributed.transaction import file_transaction from...
luciddg/auth-tool
webapp/__init__.py
# -*- coding: utf-8 -*- """ Copyright (c) 2015 Lucid Design Group """ import cherrypy from lib.model.user import ( User, UserModelException, InvalidUser, InvalidCredentials ) from lib.model.sshkey import SSHKey, InvalidKey class AuthTool(object): """ Auth-Tool A webapp for managing LDAP ...
yupswing/yaps
lib/highscores.py
# # YetAnotherPythonSnake 0.94 # Author: Simone Cingano (simonecingano@gmail.com) # Web: http://simonecingano.it # Licence: MIT # import random # YASP common imports from constants import Constants class Highscores(object): def __init__(self): self.filename = Constants.HIGHSCORES_FILE self.l...
followtheart/KeyGenerator
tests/unit_tests.py
# -*- coding: utf-8 -*- """ Coinkit ~~~~~ :copyright: (c) 2013 by Halfmoon Labs :license: MIT, see LICENSE for more details. """ import unittest from test import test_support from characters.hex import is_hex from coinkit.keypair import * from coinkit.wallet import SDWallet from coinkit.utils import ...
woothemes/wc-api-python
tests.py
""" API Tests """ import unittest import woocommerce from woocommerce import oauth from httmock import all_requests, HTTMock class WooCommerceTestCase(unittest.TestCase): """Test case for the client methods.""" def setUp(self): self.consumer_key = "ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ...
EmanueleCannizzaro/scons
test/option--duplicate.py
#!/usr/bin/env python # # Copyright (c) 2001 - 2016 The SCons Foundation # # 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 us...
gellel/pystrings
modules/persona.py
#!/usr/bin/python # -*- coding: utf-8 -*- #sys.argv[1:] ######################### ### File requirements ### ######################### ### import future print function from __future__ import print_function ### import style module import style ### import time module import time ### import system module import sys ### i...
schlichtanders/pyparsing-2.0.3-OrderedDict
examples/oc.py
# oc.py # # A subset-C parser, (BNF taken from 1996 International Obfuscated C Code Contest) # # Copyright, 2010, Paul McGuire # """ http://www.ioccc.org/1996/august.hint The following is a description of the OC grammar: OC grammar ========== Terminals are in quotes, () is used for bracketing. ...
TheLady/Lexos
managers/session_manager.py
import os import pickle from shutil import rmtree import re import random import string from flask import session, request import helpers.constants as constants def session_folder(): """ Generates and returns the file path for the session folder. Args: None Returns: The file path f...
SmileLikeYe/XYSPythonTool
Scratch/SmileRequestProxy/Step1_GenerateParamList.py
# coding:utf-8 # !/usr/bin/env python # coding:utf-8 # @Date : 2017-03-01 12:38:38 # @Author : Smile Hu (smile.hu@sap.com) # @Link : http://www.smilehu.com import sys reload(sys) sys.setdefaultencoding('utf-8') import codecs import math import ast import json import smileRequest import traceback def getKeyTre...
borg-project/cargo
src/python/cargo/tools/triggered.py
"""@author: Bryan Silverthorn <bcs@cargo-cult.org>""" import plac if __name__ == "__main__": from cargo.tools.triggered import main plac.call(main) import subprocess import pyinotify import cargo logger = cargo.get_logger(__name__, level = "NOTSET") class TriggerHandler(pyinotify.ProcessEvent): """ ...
punkdit/shakespy
server/server.py
#!/usr/bin/env python3 import sys, os from subprocess import Popen, PIPE import asyncio import websockets import re import traceback mux = asyncio.get_event_loop() def get_all_games(): games = [] for root, dirs, names in os.walk("../games"): for name in names: if name.endswith(".py"): ...
maps16/FComputacional1
Actividad10/Reporte/Animacion_Pendulo.py
from numpy import sin, cos import numpy as np import matplotlib.pyplot as plt import scipy.integrate as integrate import matplotlib.animation as animation class DoublePendulum: """Double Pendulum Class init_state is [theta1, omega1, theta2, omega2] in degrees, where theta1, omega1 is the angular position ...
ganesh-95/python-programs
project/5mul.py
""" 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? """ check_list = [11, 13, 14, 16, 17, 18, 19, 20] def find_solution(step): for num in xrange(step, 99999...
bsautermeister/machine-learning-examples
bayes_classification/sklearn/bayes_gaussian_mnist.py
import argparse import sys import numpy as np import matplotlib.pyplot as plt from scipy.stats import multivariate_normal from sklearn.mixture import BayesianGaussianMixture from tensorflow.examples.tutorials.mnist import input_data class MultivariateNormalDistribution(object): def fit(self, x_k): mean ...
epsy/sigtools
sigtools/tests/test_autoforwards.py
from functools import partial, wraps from mock import patch import ast from sigtools import support, modifiers, specifiers, signatures, _util, _autoforwards from sigtools.tests.util import Fixtures, tup _wrapped = support.f('x, y, *, z', name='_wrapped') def func(*args, **kwargs): pass class AutoforwardsMark...
vivaxy/algorithms
python/problems/fair_candy_swap.py
""" https://leetcode.com/problems/fair-candy-swap/ https://leetcode.com/submissions/detail/186770998/ """ class Solution: def fairCandySwap(self, A, B): """ :type A: List[int] :type B: List[int] :rtype: List[int] """ diff = (sum(A) - sum(B)) / 2 setB = set(...
rajanil/OrbWeaver
learn_parameters.py
# additional libs import cPickle import argparse import os import pdb # import libs for numerical ops import numpy as np import scipy.stats as stats # optimizer for neural net from keras.optimizers import Adadelta # custom libs import callbacks import model import load def parse_args(): parser = argparse.Argu...
levilucio/SyVOLT
ATLTrans/props/HCommunityPerson_if_CompleteLHS.py
from core.himesis import Himesis, HimesisPreConditionPatternLHS import uuid class HCommunityPerson_if_CompleteLHS(HimesisPreConditionPatternLHS): def __init__(self): """ Creates the himesis graph representing the AToM3 model HCommunityPerson_if_CompleteLHS. """ ...
polentozer/testing_0
serial_test1.py
from __future__ import print_function import time import serial import datetime as dt # Function for writing logs in file def writer(fname, s): t = dt.datetime.now() data = str(t)[-15:] + ',' + s + '\n' with open(fname, 'a') as fout: fout.write(data) # configure the serial connecti...
krunal10/aves
aves/api/models.py
import uuid from django.contrib.auth.models import User from django.db import models class Organization(models.Model): organization_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField...
AlexKuhnle/ShapeWorld
shapeworld/datasets/agreement/quantification_complex.py
from shapeworld.dataset import CaptionAgreementDataset from shapeworld.generators import ReinforcedAttributesGenerator from shapeworld.captioners import CaptionerMixer, RegularAttributeCaptioner, RegularTypeCaptioner, AttributeTypeRelationCaptioner, QuantifierCaptioner, NumberBoundCaptioner, ComparativeQuantifierCaptio...
perrette/webglacier1d
outletglacierapp/models/flowline.py
""" compute flow line """ import pickle import numpy as np from scipy.interpolate import interp2d, RectBivariateSpline import matplotlib.pyplot as plt import dimarray.geo as da from dimarray.geo.crs import get_crs # from greenland_data.velocity import load as load_velocity # from greenland_data.rignot_mouginot2012 im...
hdevalence/cloaked-avenger
imagegen.py
#!/usr/bin/python """Creates some random images. Usage: imagegen.py -W w -H h [-S s] [-D d] (-L l | -P palette) OUTPUT imagegen.py --help Options: -W w Width in blocks -H h Height in blocks -S s Scale, px per block [default: 32] -D d Directionality: 0-1, 1 fully ra...
AxisPhilly/lobbying.ph-django
lobbyingph/migrations/0031_auto__add_expenditure.py
# -*- 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 'Expenditure' db.create_table('lobbyingph_expenditure', ( ('id', self.gf('django....
ddxgz/smartcity-demo
swift-webui/swiftbrowser/ffmpegutils.py
import os import commands import time import string import logging import functools # from utils import funclogger, time2Stamp, stamp2Time logging.basicConfig(level=logging.DEBUG) def create_video_thumb(video, source_folder, cut_time=1, duration_time=0.001): """ """ # cut_video_name = full_video[-34:-13]...
TeamLab/Gachon_CS50_Python_KMOOC
lab_assignment/lab_7/submit.py
# Author: Sungchul Choi, sc82.choi at gachon.ac.kr # Version: 0.1 # Description # 가천대학교 프로그래밍 입문 시간에 활용되는 "숙제 자동 채점 프로그램"의 Client 프로그램입니다. # # HUMAN KNOWLEDGE BELONGS TO THE WORLD. -- From the movie "Antitrust" # Copyright (C) 2015 TeamLab@Gachon University import argparse import pickle import os import types import r...
MapQuest/mapquest-osm-server
src/python/datastore/lrucache.py
# Copyright (c) 2011 AOL Inc. 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 to use, copy, modify, merg...
cynngah/uofthacksIV
jobradar/apps/base/models.py
"""Base models""" from django.db import models class Job(models.Model): id = models.AutoField(primary_key=True) name = models.CharField('job name', max_length=50) company_id = models.ForeignKey('Company') url = models.CharField(max_length=100) description = models.CharField(max_length=200) stil...
akuendig/RxPython
rx/linq/count.py
from rx.observable import Producer import rx.linq.sink class Count(Producer): def __init__(self, source, predicate): self.source = source self.predicate = predicate def run(self, observer, cancel, setSink): sink = self.Sink(self, observer, cancel) setSink(sink) return self.source.subscribeSaf...
lotharwissler/bioinformatics
python/generic/flat2line.py
#!/usr/bin/python import os, sys # low level handling, such as command line stuff import string # string methods available import getopt # comand line argument handling from collections import defaultdict from low import * # custom functions, written by myself # ========================================...
NumberZeroSoftware/PDFINVEST
pdfapp/migrations/0029_auto_20170316_0313.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-16 03:13 from __future__ import unicode_literals from django.db import migrations, models import pdfapp.validators class Migration(migrations.Migration): dependencies = [ ('pdfapp', '0028_auto_20170316_0254'), ] operations = [ ...
WhiteWorld/SellTa
manage.py
#!/usr/bin/env python import os from app import app, db from app.models import User from flask.ext.script import Manager, Shell, Server from flask.ext.migrate import Migrate, MigrateCommand manager = Manager(app) migrate = Migrate(app, db) server = Server(host="0.0.0.0", port=8000) def make_shell_context(): ret...
ragavvenkatesan/Convolutional-Neural-Networks
tests/layers/test_abstract.py
import unittest import numpy import theano import theano.tensor as T from yann.layers.abstract import layer as l,_dropout,_activate from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams try: from unittest.mock import Mock except ImportError: from mock import Mock,patch class TestAbstract(unit...
susanshen/inf1340_2015_asst1
exercise2.py
#!/usr/bin/env python """ Assignment 1, Exercise 2, INF1340, Fall, 2015. Name that shape. This module contains one function name_that_shape(). It prompts the user to input the number of sides in a shape and outputs the name of the shape. """ __author__ = 'Susan Sim' __email__ = "ses@drsusansim.org" __copyright__ = ...
dweinstein/mitmproxy
test/test_protocol_http.py
import socket from io import BytesIO from netlib.exceptions import HttpSyntaxException from netlib.http import http1 from netlib.tcp import TCPClient from netlib.tutils import treq, raises import tutils import tservers class TestHTTPResponse: def test_read_from_stringio(self): s = ( b"HTTP/1.1...