repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
rodrigolucianocosta/ControleEstoque | rOne/Storage101/django-localflavor/django-localflavor-1.3/localflavor/cl/forms.py | 4 | 3308 | """
Chile specific form helpers.
"""
from __future__ import unicode_literals
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
... | gpl-3.0 |
40423132/2017springcd_ag3 | plugin/summary/summary.py | 317 | 2852 | """
Summary
-------
This plugin allows easy, variable length summaries directly embedded into the
body of your articles.
"""
from __future__ import unicode_literals
from pelican import signals
from pelican.generators import ArticlesGenerator, StaticGenerator, PagesGenerator
def initialized(pelican):
from pelican... | agpl-3.0 |
ptchankue/youtube-dl | youtube_dl/extractor/twitter.py | 89 | 2232 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urllib_request
from ..utils import (
float_or_none,
unescapeHTML,
)
class TwitterCardIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?twitter\.com/i/cards/tfw/v1/(?P<id>\d+)'
_TEST = {... | unlicense |
PXke/invenio | invenio/legacy/webcomment/webinterface.py | 1 | 47067 | # -*- coding: utf-8 -*-
## Comments and reviews for records.
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## publi... | gpl-2.0 |
eentzel/myeventbot | gdata/photos/service.py | 162 | 24363 | #!/usr/bin/env python
# -*-*- encoding: utf-8 -*-*-
#
# This is the service file for the Google Photo python client.
# It is used for higher level operations.
#
# $Id: service.py 144 2007-10-25 21:03:34Z havard.gulldahl $
#
# Copyright 2007 Håvard Gulldahl
#
# Licensed under the Apache License, Version 2.0 (the "Licen... | mit |
filipenf/ansible | contrib/inventory/zone.py | 138 | 1466 | #!/usr/bin/env python
# (c) 2015, Dagobert Michelsen <dam@baltic-online.de>
#
# This file is part of Ansible,
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# ... | gpl-3.0 |
IAAAIAAIA/studyGroup | steffen/pytorch/charRNN.py | 2 | 4962 | import os
import unidecode
import string
import random
import re
import time
import math
import torch
import torch.nn as nn
from torch.autograd import Variable
import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('-s', '--save_path', help='Relative file location ... | mit |
ecoal95/servo | tests/wpt/web-platform-tests/webdriver/tests/support/merge_dictionaries.py | 74 | 1788 | def iteritems(d):
"""Create a key-value iterator for the given dict in both Python 2.x and
Python 3.x environments"""
if hasattr(d, "iteritems"):
return d.iteritems()
return d.items()
def merge_dictionaries(first, second):
"""Given two dictionaries, create a third that defines all specified... | mpl-2.0 |
wilvk/ansible | lib/ansible/modules/windows/win_iis_website.py | 47 | 4032 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Henrik Wallström <henrik@wallstroms.nu>
#
# 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 t... | gpl-3.0 |
BlackPole/vuplus-kernel | Documentation/target/tcm_mod_builder.py | 3119 | 42754 | #!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... | gpl-2.0 |
ondrokrc/gramps | gramps/gen/filters/rules/media/_hasattribute.py | 2 | 1792 | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2008 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any... | gpl-2.0 |
cirrusone/phantom2 | src/qt/qtwebkit/Tools/Scripts/webkitpy/common/read_checksum_from_png_unittest.py | 124 | 3570 | # Copyright (C) 2011 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:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | bsd-3-clause |
colaftc/webtool | app/weixin.py | 1 | 1518 | # -*- coding:utf-8 -*-
import time
from app.models import WeixinTextResponse
class AccessToken:
def __init__(self,wx):
self.weixin=wx
self._load_token()
def _load_token(self):
fp=open('token','r')
line=fp.readline()
token,expires_at=line.split('|')
if token=='' or time.time(expires_at)>time.time():
... | mit |
ntiufalara/openerp7 | openerp/addons/auth_ldap/__openerp__.py | 108 | 4839 | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | mit |
tswast/google-cloud-python | securitycenter/google/cloud/securitycenter_v1/proto/source_pb2.py | 2 | 5893 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/securitycenter_v1/proto/source.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1"))
from google.protobuf import descriptor as _descriptor
from google.protobuf import m... | apache-2.0 |
Peddle/hue | desktop/libs/liboozie/src/liboozie/submittion_tests.py | 10 | 9798 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apache-2.0 |
gmjosack/gsh | gsh/plugins/executors/paramiko.py | 1 | 4911 | import cStringIO
import getpass
import gevent
import select
import socket
import termios
import threading
import tty
import time
from gsh.plugin import BaseExecutor, BaseInnerExecutor
class _ParamikoThread(threading.Thread):
def __init__(self, executor):
self.executor = executor
super(_ParamikoTh... | mit |
vstoykov/django-filer | filer/templatetags/filer_image_tags.py | 24 | 3120 | #-*- coding: utf-8 -*-
from django.template import Library
from django.utils import six
import re
register = Library()
RE_SIZE = re.compile(r'(\d+)x(\d+)$')
def _recalculate_size(size, index, divisor=0, padding=0,
keep_aspect_ratio=False):
new_one = size[index]
if divisor:
new_... | bsd-3-clause |
n0trax/ansible | test/units/plugins/lookup/test_password.py | 71 | 18937 | # -*- coding: utf-8 -*-
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.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
# (a... | gpl-3.0 |
benofben/interactive-brokers-api | Martingale Simulation/RandomWalkPrice.py | 1 | 1126 | import random
def run():
results=[]
for unused_i in range(0,100000):
result=simulateOneMartingale()
results.append(result)
plot(results)
def simulateOneMartingale():
initialMargin=5060
maintenanceMargin=4600
transactionCost=2
capital=20000
numberOfOpenContracts=1
while numberOfOpenC... | mit |
bcorbet/SickRage | autoProcessTV/lib/requests/utils.py | 11 | 19641 | # -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import cgi
import codecs
import collections
import io
import os
import platform
import re
import sys
import socket
import struct
from . i... | gpl-3.0 |
thurt/arangodb | 3rdParty/V8-4.3.61/third_party/python_26/Lib/multiprocessing/pool.py | 52 | 17699 | #
# Module providing the `Pool` class for managing a process pool
#
# multiprocessing/pool.py
#
# Copyright (c) 2007-2008, R Oudkerk --- see COPYING.txt
#
__all__ = ['Pool']
#
# Imports
#
import threading
import Queue
import itertools
import collections
import time
from multiprocessing import Process, cpu_count, Ti... | apache-2.0 |
mesosphere/mesos-cli | mesos/cli/cmds/cat.py | 2 | 1360 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
apache/airflow | airflow/providers/qubole/operators/qubole.py | 3 | 12380 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 |
moto-timo/ironpython3 | Src/StdLib/Lib/unittest/test/testmock/testpatch.py | 77 | 53730 | # 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/
import os
import sys
import unittest
from unittest.test.testmock import support
from unittest.test.testmock.support import SomeClass, is_instance
from unittest.mock import... | apache-2.0 |
Frank-the-Obscure/iDoulist | output/function0_output.py | 2 | 1069 | # -*- coding: utf-8 -*-
# Author Frank Hu
# iDoulist Function 0 - output
'''
std test
output_list = ['http://book.douban.com/subject/1139336/',
'http://book.douban.com/subject/25724948/']
'''
def output_CLI(output_doulist):
print 'iDoulist: your input doulist link contains: '
for i in output_doulist... | mit |
ZirkCoin/ZirkCoin | contrib/bitrpc/bitrpc.py | 2348 | 7835 | from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:8332")
else:
access = Ser... | mit |
konstruktoid/ansible-upstream | lib/ansible/modules/cloud/azure/azure_rm_mysqldatabase.py | 2 | 10586 | #!/usr/bin/python
#
# Copyright (c) 2017 Zim Kalinowski, <zikalino@microsoft.com>
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
wyom/sympy | sympy/series/tests/test_limits.py | 28 | 14446 | from itertools import product as cartes
from sympy import (
limit, exp, oo, log, sqrt, Limit, sin, floor, cos, ceiling,
atan, gamma, Symbol, S, pi, Integral, Rational, I,
tan, cot, integrate, Sum, sign, Function, subfactorial, symbols)
from sympy.series.limits import heuristics
from sympy.series.order imp... | bsd-3-clause |
nathania/networkx | networkx/algorithms/traversal/tests/test_bfs.py | 41 | 1362 | #!/usr/bin/env python
from nose.tools import *
import networkx as nx
class TestBFS:
def setUp(self):
# simple graph
G = nx.Graph()
G.add_edges_from([(0, 1), (1, 2), (1, 3), (2, 4), (3, 4)])
self.G = G
def test_successor(self):
assert_equal(nx.bfs_successors(self.G, so... | bsd-3-clause |
simone/django-gb | django/contrib/auth/backends.py | 21 | 5225 | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
class ModelBackend(object):
"""
Authenticates against settings.AUTH_USER_MODEL.
"""
def authenticate(self, username=None, password=None, **kwargs):
UserMode... | bsd-3-clause |
reingart/gestionlibre.gui | widget.py | 2 | 10012 | # -*- coding: utf-8 -*-
# This is a Python open source project for migration of modules
# and functions from GestionPyme and other ERP products from Sistemas
# Ágiles.
#
# Copyright (C) 2012 Sistemas Ágiles.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... | agpl-3.0 |
albalitz/save-api | src/app.py | 1 | 1804 | #!/usr/bin/env python3
"""The app's main module.
This module needs to import the following modules:
- tasks module
So that Celery can find the tasks
- every module containing routes
So that the routes are actually added to the app and don't cause 404 errors.
"""
from flask_security import Security, SQLAlchemyU... | mit |
heemanshu/swift_juno | swift/proxy/controllers/account.py | 4 | 6789 | # Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | apache-2.0 |
wimoverwater/Sick-Beard | cherrypy/_cpchecker.py | 35 | 14612 | import os
import warnings
import cherrypy
class Checker(object):
"""A checker for CherryPy sites and their mounted applications.
on: set this to False to turn off the checker completely.
When this object is called at engine startup, it executes each
of its own methods whose name... | gpl-3.0 |
ampax/edx-platform-backup | common/djangoapps/student/migrations/0029_add_lookup_table_between_user_and_anonymous_student_id.py | 114 | 16366 | # -*- 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 'AnonymousUserId'
db.create_table('student_anonymoususerid', (
('id', self.gf('dj... | agpl-3.0 |
andrebellafronte/stoq | stoqlib/gui/dialogs/inventorydetails.py | 2 | 5391 | # -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2013-2014 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU Lesser General Public License as published by
## the Free Softw... | gpl-2.0 |
paweljasinski/ironpython3 | Src/StdLib/Lib/unittest/test/support.py | 81 | 3872 | import unittest
class TestEquality(object):
"""Used as a mixin for TestCase"""
# Check for a valid __eq__ implementation
def test_eq(self):
for obj_1, obj_2 in self.eq_pairs:
self.assertEqual(obj_1, obj_2)
self.assertEqual(obj_2, obj_1)
# Check for a valid __ne__ impl... | apache-2.0 |
DirtyPiece/dancestudio | Build/Tools/Python27/Lib/site-packages/pip/_vendor/distlib/util.py | 190 | 51230 | #
# Copyright (C) 2012-2013 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
from collections import deque
import contextlib
import csv
from glob import iglob as std_iglob
import io
import json
import logging
import os
import py_compile
import re
import shutil
import socket
import... | mit |
msarana/selenium_python | ENV/Lib/encodings/iso8859_14.py | 593 | 13908 | """ Python Character Mapping Codec iso8859_14 generated from 'MAPPINGS/ISO8859/8859-14.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 |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/numpy/fft/info.py | 159 | 7235 | """
Discrete Fourier Transform (:mod:`numpy.fft`)
=============================================
.. currentmodule:: numpy.fft
Standard FFTs
-------------
.. autosummary::
:toctree: generated/
fft Discrete Fourier transform.
ifft Inverse discrete Fourier transform.
fft2 Discrete Fourier tr... | mit |
healthchecks/healthchecks | hc/accounts/decorators.py | 2 | 1683 | from functools import wraps
import secrets
from django.core.signing import TimestampSigner, SignatureExpired
from django.shortcuts import redirect, render
from hc.api.models import TokenBucket
from hc.lib import emails
def _session_unsign(request, key, max_age):
if key not in request.session:
return None... | bsd-3-clause |
Montana-Studio/PI_Landing | node_modules/node-gyp/gyp/tools/pretty_vcproj.py | 2637 | 9586 | #!/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 the format of a vcproj really pretty.
This script normalize and sort an xml. It also fetches all the properties
inside linked... | mit |
RedHat-Israel/ROSE | docs/course_materials/exercises/test_exercises/rose_check.py | 2 | 4765 | #!/usr/bin/env python3
import argparse
import importlib
import logging
import os
from pathlib import Path
import sys
from configparser import ConfigParser
import pytest
import linux_tester
HOME = ''
LINUX_FOLDER = './01_Linux/'
def load_file(file_path):
'''
Load the file as module
Arguments:
fi... | gpl-2.0 |
carrerasrodrigo/django-post_office | post_office/migrations/0001_initial.py | 1 | 5654 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import jsonfield.fields
import post_office.fields
import post_office.validators
import post_office.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.... | mit |
shiquanwang/numba | numba/nodes/usernode.py | 1 | 2475 | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from numba.nodes import *
#----------------------------------------------------------------------------
# User-extensible nodes
#----------------------------------------------------------------------------
class UserNodeMeta(type... | bsd-2-clause |
petecummings/django | tests/forms_tests/widget_tests/test_checkboxselectmultiple.py | 161 | 4824 | from django.forms import CheckboxSelectMultiple
from .base import WidgetTest
class CheckboxSelectMultipleTest(WidgetTest):
widget = CheckboxSelectMultiple()
def test_render_value(self):
self.check_html(self.widget, 'beatles', ['J'], choices=self.beatles, html=(
"""<ul>
<li><l... | bsd-3-clause |
Versent/ansible-modules-core | cloud/rackspace/rax_cbs.py | 157 | 7106 | #!/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 distributed... | gpl-3.0 |
c960657/dd-agent | utils/tailfile.py | 3 | 3449 | # (C) Datadog, Inc. 2010-2016
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import binascii
import os
from stat import ST_INO, ST_SIZE
class TailFile(object):
CRC_SIZE = 16
def __init__(self, logger, path, callback):
self._path = path
self._f = None
sel... | bsd-3-clause |
danielricks/autoplay | agents/agentBaseClass.py | 1 | 1789 | import random as rand
import scholar.scholar as sch
class AgentBaseClass:
def __init__(self, initial_epsilon, training_cycles):
#sets all initial learning variables
#or behavior parameters
pass
def refresh(self):
#prepares the agent for a new round of training
#(i.e. prepares to restart the game, but doe... | gpl-3.0 |
clumsy/intellij-community | python/lib/Lib/optparse.py | 88 | 60532 | """A powerful, extensible, and easy-to-use option parser.
By Greg Ward <gward@python.net>
Originally distributed as Optik.
For support, use the optik-users@lists.sourceforge.net mailing list
(http://lists.sourceforge.net/lists/listinfo/optik-users).
"""
__version__ = "1.5.3"
__all__ = ['Option',
'SUPPRE... | apache-2.0 |
konstruktoid/ansible-upstream | test/units/modules/network/f5/test_bigip_gtm_monitor_tcp_half_open.py | 23 | 5653 | # -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# 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
import os
import json
import pytest
import sys
from nose.plugins.skip i... | gpl-3.0 |
SnakeJenny/TensorFlow | tensorflow/contrib/stat_summarizer/python/stat_summarizer_test.py | 123 | 2884 | # 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 applicable ... | apache-2.0 |
Hutspace/odekro | mzalendo/core/migrations/0015_set_blank_position_end_dates_to_future.py | 5 | 12644 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Change all empty end_dates to be 'future'"
for position in orm.Position.objects.filter(end_date=''):
p... | agpl-3.0 |
spallavolu/scikit-learn | sklearn/metrics/tests/test_pairwise.py | 71 | 25104 | import numpy as np
from numpy import linalg
from scipy.sparse import dok_matrix, csr_matrix, issparse
from scipy.spatial.distance import cosine, cityblock, minkowski, wminkowski
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing impo... | bsd-3-clause |
teknologkoren/Strequelistan | strecklista/models.py | 1 | 5634 | from django.core.validators import RegexValidator
from django.db import models
import decimal
from django.core.mail import send_mail
from EmailUser.models import MyUser
# Create your models here.
class RegisterRequest(models.Model):
email = models.EmailField(
verbose_name='email address',
max_length=... | mpl-2.0 |
seem-sky/kbengine | kbe/res/scripts/common/Lib/lib2to3/fixer_util.py | 71 | 15256 | """Utility functions, node construction macros, etc."""
# Author: Collin Winter
from itertools import islice
# Local imports
from .pgen2 import token
from .pytree import Leaf, Node
from .pygram import python_symbols as syms
from . import patcomp
###########################################################
### Common... | lgpl-3.0 |
funkring/fdoo | addons/account/report/account_report.py | 144 | 12839 | # -*- 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 |
tschaume/pymatgen | pymatgen/analysis/ewald.py | 2 | 24867 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from math import pi, sqrt, log
from datetime import datetime
from copy import deepcopy, copy
from warnings import warn
import bisect
import numpy as np
from scipy.special import erfc, comb
import scipy.consta... | mit |
teltek/edx-platform | common/lib/xmodule/xmodule/modulestore/split_mongo/id_manager.py | 189 | 1433 | """
An implementation of IdReader and IdGenerator that manages ids for the SplitMongo storage
mechanism.
"""
from opaque_keys.edx.locator import LocalId, DefinitionLocator
from xmodule.x_module import OpaqueKeyReader, AsideKeyGenerator
from xmodule.modulestore.split_mongo import BlockKey
# TODO: Migrate split_mongo ... | agpl-3.0 |
algebrology/ghost | node_modules/pygmentize-bundled/vendor/pygments/build-3.3/pygments/formatters/_mapping.py | 94 | 5509 | # -*- coding: utf-8 -*-
"""
pygments.formatters._mapping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter mapping defintions. This file is generated by itself. Everytime
you change something on a builtin formatter defintion, run this script from
the formatters folder to update it.
Do not alter the FORMA... | mit |
dgarciam/Sick-Beard | lib/unidecode/x0fc.py | 253 | 3595 | data = (
'', # 0x00
'', # 0x01
'', # 0x02
'', # 0x03
'', # 0x04
'', # 0x05
'', # 0x06
'', # 0x07
'', # 0x08
'', # 0x09
'', # 0x0a
'', # 0x0b
'', # 0x0c
'', # 0x0d
'', # 0x0e
'', # 0x0f
'', # 0x10
'', # 0x11
'', # 0x12
'', # 0x13
'', # 0x14
'', # 0x15
'',... | gpl-3.0 |
EichlerLab/chm1_scripts | PrintAssemblies.py | 2 | 1711 | #!/usr/bin/env python
from Bio import Seq
from Bio import SeqIO
from Bio import SeqRecord
import Tools
import sys
import os
import glob
import argparse
ap = argparse.ArgumentParser(description="Concatenate Celera assemblies into one output file.")
ap.add_argument("--base", help="Basename of table. For each entry in t... | mit |
xxshutong/openerp-7.0 | openerp/addons/fleet/fleet.py | 51 | 46100 | # -*- 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 |
liorvh/Veil-Evasion | modules/payloads/ruby/meterpreter/rev_https_contained.py | 12 | 4116 | """
Reads in metsrv.dll, patches it with appropriate options for a
meterpreter reverse_https payload compresses/base64 encodes it
and then builds a ruby injection wrapper to inject the contained
meterpreter dll into memory.
A lot of code taken from the python contained modules and modified for ruby
Original python co... | gpl-3.0 |
rcbops/glance-buildpackage | glance/common/cfg.py | 2 | 38272 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | apache-2.0 |
sujithshankar/anaconda | pyanaconda/ui/gui/spokes/advstorage/iscsi.py | 1 | 20228 | # iSCSI configuration dialog
#
# Copyright (C) 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distribute... | gpl-2.0 |
andresriancho/PyGithub | github/tests/Exceptions.py | 1 | 4492 | # -*- coding: utf-8 -*-
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
# PyGithub is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
# as published by the Free Softwar... | gpl-3.0 |
adailsonfilho/DarwinEye | sammon/sammon.py | 1 | 5898 | def sammon(x, n = 2, display = 2, inputdist = 'raw', maxhalves = 20, maxiter = 500, tolfun = 1e-9, init = 'pca', distancefunc = None):
#from scipy.spatial.distance import pdist, squareform
import numpy as np
"""Perform Sammon mapping on dataset x
y = sammon(x) applies the Sammon nonlinear mappin... | mit |
akrherz/iem | htdocs/plotting/auto/scripts/p25.py | 1 | 3705 | """Distrubution of daily high and low temperatures"""
import datetime
import psycopg2.extras
import numpy as np
from scipy.stats import norm
import pandas as pd
from pyiem import reference
from pyiem.plot.use_agg import plt
from pyiem.util import get_autoplot_context, get_dbconn
from pyiem.exceptions import NoDataFoun... | mit |
chronicwaffle/PokemonGo-DesktopMap | app/pywin/Lib/filecmp.py | 110 | 9588 | """Utilities for comparing files and directories.
Classes:
dircmp
Functions:
cmp(f1, f2, shallow=1) -> int
cmpfiles(a, b, common) -> ([], [], [])
"""
import os
import stat
from itertools import ifilter, ifilterfalse, imap, izip
__all__ = ["cmp","dircmp","cmpfiles"]
_cache = {}
BUFSIZE=8*1024
def cmp(... | mit |
tnkteja/myhelp | virtualEnvironment/lib/python2.7/site-packages/setuptools/site-patch.py | 720 | 2389 | def __boot():
import sys
import os
PYTHONPATH = os.environ.get('PYTHONPATH')
if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH):
PYTHONPATH = []
else:
PYTHONPATH = PYTHONPATH.split(os.pathsep)
pic = getattr(sys,'path_importer_cache',{})
stdpath = sys.path[le... | mit |
miketamis/CouchPotatoServer | libs/requests/packages/urllib3/__init__.py | 482 | 2055 | """
urllib3 - Thread-safe connection pooling and re-using.
"""
__author__ = 'Andrey Petrov (andrey.petrov@shazow.net)'
__license__ = 'MIT'
__version__ = '1.10.4'
from .connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
connection_from_url
)
from . import exceptions
from .filepost import en... | gpl-3.0 |
user-none/calibre | src/calibre/utils/config.py | 14 | 14365 | from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
'''
Manage application-wide preferences.
'''
import os, cPickle, base64, datetime, json, plistlib
from copy import deepcopy
import optparse
from calibre.constan... | gpl-3.0 |
mauriceyap/ccm-assistant | src/resources/sermons.py | 1 | 1179 | import requests
from xml.etree import ElementTree
import utils
import config
def get_sermon(date, service):
try:
response = requests.get(config.SERMONS_XML_URL)
tree = ElementTree.fromstring(response.content)
for item in tree.getchildren()[0].findall("item"):
if (date == utils... | mit |
GustavoHennig/ansible | lib/ansible/modules/network/illumos/ipadm_addr.py | 20 | 12093 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Adam Števko <adam.stevko@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 L... | gpl-3.0 |
emiquelito/django-cms-2.0 | cms/utils/__init__.py | 1 | 10978 | # TODO: this is just stuff from utils.py - should be splitted / moved
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from cms.utils.i18n import get_default_language
# !IMPORTANT: Pag... | bsd-3-clause |
amitjamadagni/sympy | sympy/physics/quantum/tests/test_qft.py | 28 | 1689 | from sympy import exp, I, Matrix, pi, sqrt, Symbol
from sympy.physics.quantum.qft import QFT, IQFT, RkGate
from sympy.physics.quantum.gate import (ZGate, SwapGate, HadamardGate, CGate,
PhaseGate, TGate)
from sympy.physics.quantum.qubit import Qubit
from sympy.physics.quantum.qap... | bsd-3-clause |
t11e/django | django/contrib/gis/gdal/geomtype.py | 404 | 2967 | from django.contrib.gis.gdal.error import OGRException
#### OGRGeomType ####
class OGRGeomType(object):
"Encapulates OGR Geometry Types."
wkb25bit = -2147483648
# Dictionary of acceptable OGRwkbGeometryType s and their string names.
_types = {0 : 'Unknown',
1 : 'Point',
2 ... | bsd-3-clause |
bretttegart/treadmill | lib/python/treadmill/plugins.ref/sproc/servers.py | 1 | 1153 | """Syncronizes cell Zookeeper with LDAP data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from treadmill import admin
from treadmill import context
from treadmill.scheduler import master
def sync_servers():
... | apache-2.0 |
OWStimpson/oscar_webstore | oscar_webstore_root/forked_apps/basket/migrations/0001_initial.py | 12 | 3081 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Basket',
fields=[
('id', models.AutoField(auto_... | bsd-3-clause |
pixie-lang/pixie | pixie/vm/array.py | 1 | 6729 | import pixie.vm.rt as rt
import pixie.vm.object as object
from pixie.vm.object import affirm
from pixie.vm.code import extend, as_var
from pixie.vm.numbers import Integer
from pixie.vm.primitives import nil
import pixie.vm.stdlib as proto
import rpython.rlib.jit as jit
from rpython.rtyper.lltypesystem import lltype
fro... | gpl-3.0 |
parenthetical-e/timecourse | bin/vox_condsplit.py | 1 | 2831 | #! /usr/local/bin/python
""" Reformats *_vox.txt files from fidl into a tabular format easily
progamatically used. New files are created for every condition, and some
fidl specific metadata is lost.
NOTE: If you have levels, or any character data in the timecourse data proper,
it must be in lower case ONLY. Uppe... | bsd-2-clause |
conda/kapsel | conda_kapsel/internal/test/test_default_conda_manager.py | 1 | 11769 | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright © 2016, Continuum Analytics, Inc. All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------------------------------------------------------... | bsd-3-clause |
tecan/xchat-rt | plugins/scripts/encryption/supybot-code-6361b1e856ebbc8e14d399019e2c53a35f4e0063/src/dynamicScope.py | 14 | 2243 | ###
# Copyright (c) 2004-2005, Jeremiah Fincher
# 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 co... | gpl-2.0 |
harshilasu/LinkurApp | y/google-cloud-sdk/.install/.backup/lib/googlecloudsdk/gcloud/sdktools/auth/print_refresh_token.py | 11 | 1051 | # Copyright 2013 Google Inc. All Rights Reserved.
"""A hidden command that prints access tokens.
"""
from oauth2client import client
from googlecloudsdk.calliope import base
from googlecloudsdk.calliope import exceptions as c_exc
from googlecloudsdk.core import log
from googlecloudsdk.core.credentials import store a... | gpl-3.0 |
nowopen/scrapy | tests/test_downloadermiddleware_cookies.py | 116 | 10382 | import re
import logging
from unittest import TestCase
from testfixtures import LogCapture
from scrapy.http import Response, Request
from scrapy.spiders import Spider
from scrapy.utils.test import get_crawler
from scrapy.exceptions import NotConfigured
from scrapy.downloadermiddlewares.cookies import CookiesMiddleware... | bsd-3-clause |
Ayub-Khan/edx-platform | lms/djangoapps/shoppingcart/processors/CyberSource2.py | 37 | 28163 | """
Implementation of the CyberSource credit card processor using the newer "Secure Acceptance API".
The previous Hosted Order Page API is being deprecated as of 9/14.
For now, we're keeping the older implementation in the code-base so we can
quickly roll-back by updating the configuration. Eventually, we should repl... | agpl-3.0 |
Trinitaria/namebench | nb_third_party/jinja2/tests.py | 285 | 3313 | # -*- coding: utf-8 -*-
"""
jinja2.tests
~~~~~~~~~~~~
Jinja test functions. Used with the "is" operator.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
from jinja2.runtime import Undefined
# nose, nothing here to test
__test__ = False
number_r... | apache-2.0 |
shannonshsu/Arduino | arduino-core/src/processing/app/i18n/python/requests/cookies.py | 209 | 14024 | # -*- coding: utf-8 -*-
"""
Compatibility code to be able to use `cookielib.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
"""
import collections
from .compat import cookielib, urlparse, Morsel
try:
import threading
# grr, pyflakes: this fixes "redefinition of unused... | lgpl-2.1 |
shurihell/testasia | openedx/core/djangoapps/profile_images/tests/helpers.py | 117 | 1742 | """
Helper methods for use in profile image tests.
"""
from contextlib import contextmanager
import os
from tempfile import NamedTemporaryFile
from django.core.files.uploadedfile import UploadedFile
from PIL import Image
@contextmanager
def make_image_file(dimensions=(320, 240), extension=".jpeg", force_size=None):
... | agpl-3.0 |
xingyepei/edx-platform | lms/envs/cms/dev.py | 132 | 1508 | """
Settings for the LMS that runs alongside the CMS on AWS
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=wildcard-import, unused-wildcard-import
from ..dev import *
FEATURES['AUTH_USE_CERTIFICATES'] = False
SUBDOMAIN_... | agpl-3.0 |
gg7/sentry | src/sentry/migrations/0136_auto__add_field_organizationmember_email__chg_field_organizationmember.py | 36 | 28229 | # -*- 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 field 'OrganizationMember.email'
db.add_column('sentry_organizationmember', 'email',
... | bsd-3-clause |
beol/rbtools | docs/releasenotes/conf.py | 7 | 6569 | # -*- coding: utf-8 -*-
#
# Release Notes build configuration file, created by
# sphinx-quickstart on Thu Feb 12 02:10:34 2009.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# The contents of this file are pickled, so don't put values in the
# namespace that aren't pickleable (m... | mit |
schmidtc/pysal | pysal/cg/segmentLocator.py | 14 | 13803 | import math
import scipy
import numpy
from pysal.cg.shapes import Rectangle, Point, LineSegment
from pysal.cg.standalone import get_segment_point_dist, get_bounding_box
import random
import time
__all__ = ["SegmentGrid", "SegmentLocator",
"Polyline_Shapefile_SegmentLocator"]
DEBUG = False
class BruteSegme... | bsd-3-clause |
bitwiseman/js-beautify | python/jsbeautifier/javascript/beautifier.py | 1 | 63014 | # The MIT License (MIT)
#
# Copyright (c) 2007-2018 Einar Lielmanis, Liam Newman, and contributors.
#
# 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 ... | mit |
beconomist/baowenchen | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/pygments/formatter.py | 198 | 2921 | # -*- coding: utf-8 -*-
"""
pygments.formatter
~~~~~~~~~~~~~~~~~~
Base formatter class.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import codecs
from pygments.util import get_bool_opt
from pygments.styles import get_style_by_nam... | mit |
fenginx/django-mailer-2 | django_mailer/lockfile.py | 179 | 15120 |
"""
lockfile.py - Platform-independent advisory file locks.
Requires Python 2.5 unless you apply 2.4.diff
Locking is done on a per-thread basis instead of a per-process basis.
Usage:
>>> lock = FileLock('somefile')
>>> try:
... lock.acquire()
... except AlreadyLocked:
... print 'somefile', 'is locked alread... | mit |
rschnapka/bank-statement-reconcile | account_statement_completion_voucher/__openerp__.py | 4 | 1573 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joel Grand-Guillaume
# Copyright 2011-2012 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 a... | agpl-3.0 |
sudheesh001/oh-mainline | vendor/packages/Django/tests/regressiontests/special_headers/tests.py | 64 | 2744 | from django.contrib.auth.models import User
from django.test import TestCase
from django.test.utils import override_settings
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class SpecialHeadersTest(TestCase):
fixtures = ['data.xml']
urls = 'regressiontests.special_head... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.