code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
#
# 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, modi... | Nexenta/s3-tests | virtualenv/lib/python2.7/site-packages/boto/manage/volume.py | Python | mit | 16,296 |
import random as rand
class Tree:
"""Implementation basique d'un arbre
depth = the depth of the deepest leaf"""
def __init__(self,node = None, branches = None):
self.node = node
if branches != None:
self.branches = branches
else:
self.branches = []
... | BadrYoubiIdrissi/TIPE-Algorithme-Genetique | Source/AlgoGenBasique/Tree.py | Python | gpl-3.0 | 5,504 |
file = open("train_tmp.txt", "r")
toWrite = open("train_lemma", "w")
for line in file:
values = line.split("\t")
if len(values) >= 4:
lemma = values[2]
label = values[3]
toWrite.write(lemma + "\t" + label)
else:
toWrite.write("\n")
| marcomanciniunitn/Final-LUS-project | CRF/data/changeToLemma.py | Python | gpl-3.0 | 245 |
"""Class for setting HQ states"""
from datetime import datetime
import sys
class HQFunctions(object):
def join(self, channel, callback, msg=None, nck=None, hq=None, keys=None, pb=None):
"""
Join users to HQ, update the status
"""
#Open HQ if its closed
if hq.hq_status is 'c... | fast90/christian | commands/hqfunctions.py | Python | gpl-3.0 | 4,760 |
#!/usr/bin/env python -Es
"""
Script to set up a custom genome for bcbio-nextgen
"""
from __future__ import print_function
from argparse import ArgumentParser
import collections
import gzip
import os
from Bio import SeqIO
import toolz as tz
from bcbio.utils import safe_makedir, file_exists, chdir, is_gzipped
from bcb... | a113n/bcbio-nextgen | scripts/bcbio_setup_genome.py | Python | mit | 15,182 |
#!/usr/bin/python
# begin boilerplate
import sys
import os
scriptName = os.path.basename(sys.argv[0])
scriptPath = os.path.dirname(sys.argv[0])
sharedPath = os.path.join(scriptPath, "../shared/")
sys.path.append(os.path.abspath(sharedPath))
import Scripts
import Pieces
import Utils
#end boilerplate
class Script(Scri... | mikefullerton/Piecemeal-Scripts | Scripts/utils/yank-all.py | Python | mit | 1,200 |
#!/usr/bin/python2.5
from PyQt4.QtCore import *
from PyQt4.QtSql import *
from blur.Stone import *
from blur.Classes import *
from verifier_plugin_factory import *
import ConfigParser
import sys
import wenv
def jobMatchesRule(job, v):
if job.name().contains(v[0]) or v[0] == "%":
if job.use... | lordtangent/arsenalsuite | python/scripts/verifier_plugins/addServices.py | Python | gpl-2.0 | 2,279 |
"""
An example script for performing Harris feature detection and matching.
"""
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from compvis.feature.detectors import harris, select_scores, select_scores_anms
from compvis.feature.descriptors import match_points
print "Creating images..."
obj ... | pauljxtan/pystuff | pycompvis/compvis/examples/match_features.py | Python | mit | 1,665 |
# -*- coding: utf-8 -*-
# pinched from django-moderation.
# modified to include rather than exclude, fields
import re
import difflib
def get_changes_between_models(model1, model2, include=[]):
from django.db.models import fields
changes = {}
for field_name in include:
field = type(model1)._meta.ge... | ixc/glamkit-eventtools | eventtools/utils/diff.py | Python | bsd-3-clause | 2,524 |
#!/usr/bin/python
#
# 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 required by applicab... | mirzak/zephyr-os | samples/task_profiler/profiler/scripts/contextswitch_parse.py | Python | apache-2.0 | 13,115 |
# Copyright 2015 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, ... | GoogleCloudPlatform/psq | psq/__init__.py | Python | apache-2.0 | 1,405 |
#!/usr/bin/env python
import sys; sys.path[:0] = ["../.."]
from pyx import *
c = canvas.canvas()
s = svgfile.svgfile_pt(100, 200, 'data/testsvg.svg', width_pt=450, parsed=True)
c.insert(s)
c.stroke(s.bbox().enlarged(-style.linewidth.normal.width/2).rect())
c.fill(path.circle_pt(105, 205, 5))
c.fill(path.circle_pt(10... | mjg/PyX-svn | test/functional/test_svgfile.py | Python | gpl-2.0 | 732 |
from aes import *
class Node(object):
""" A node is just an identifier and a hash key"""
def __init__(self, node_id):
self.__id = node_id
self.__key = create_key() # shared with KDC
self.__key_dict = {}
self.__messages = {}
# below some general functions to interact with... | pabloriutort/Aula | KDC-Simulator/node.py | Python | mit | 1,611 |
import ctypes
import sys
import platform
import time
import os
from ctypes import c_int, Structure, pointer
from ctypes import util
class POINT(Structure):
_fields_ = [("x", c_int),
("y", c_int)]
class EmotivError(Exception):
"""An exception for general emotiv-related errors"""
pass
class Use... | GGGG1020/Emotiv-Cursor-Control | ExpressivMouseControl.py | Python | mit | 8,045 |
from numpy import array, lexsort, pi, cos, arccos, log10, complex
def solve_cubic(abcd):
""" solve cubic polynomial - Tartaglia-Cardano
ref. Polyanin, Manzhirov Handbook of Mathematics for engineers
and scientists
a*x^3+b*x^2+c*x+d=0
params:
abc: list [a,b,c,d] of parameters
returns:
... | santiago-salas-v/walas | poly_3_4.py | Python | mit | 5,753 |
# Copyright (c) 2012 Cloudera, 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 o... | brightchen/Impala | tests/util/thrift_util.py | Python | apache-2.0 | 2,495 |
import cv2.cv as cv
import tesseract
import time
start = time.time()
image=cv.LoadImage("app2.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE)
api = tesseract.TessBaseAPI()
api.Init("E:\\Tesseract-OCR\\test-slim","eng",tesseract.OEM_DEFAULT)
#api.SetPageSegMode(tesseract.PSM_SINGLE_WORD)
api.SetPageSegMode(tesseract.PSM_AUTO)
te... | mabotech/mabo.io | py/vision/test1/ocr_test.py | Python | mit | 1,130 |
import eventlet
import requests
requests.get('https://www.google.com/').status_code
| collinstocks/eventlet | tests/manual/regress-226-unpatched-ssl.py | Python | mit | 84 |
"""
This implements the common managers that are used by the
abstract models in dbobjects.py (and which are thus shared by
all Attributes and TypedObjects).
"""
from functools import update_wrapper
from django.db import models
from django.db.models import Q
from src.utils import idmapper
from src.utils.utils import mak... | google-code-export/evennia | src/typeclasses/managers.py | Python | bsd-3-clause | 10,401 |
from setuptools import setup, find_packages
setup(name='latimes-mappingla-geopy',
version='0.93-latimes',
description='Python Geocoding Toolbox',
author='Ben Welsh from original work by Brian Beck',
author_email='Benjamin.Welsh@latimes.com',
url='http://github.com/datadesk/latimes-mapping... | datadesk/latimes-mappingla-geopy | setup.py | Python | mit | 1,045 |
# Copyright (c) 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 ... | takeshineshiro/cinder | cinder/volume/drivers/san/__init__.py | Python | apache-2.0 | 981 |
class Tagger(object):
tags = []
def __call__(self, tokens):
raise NotImplementedError
def check_tag(self, tag):
return tag in self.tags
class PassTagger(Tagger):
def __call__(self, tokens):
for token in tokens:
yield token
class TaggersComposition(Tagger):
... | bureaucratic-labs/yargy | yargy/tagger.py | Python | mit | 632 |
from mirror import app
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', threaded=True) | RagnarHal/Spegill | run.py | Python | gpl-2.0 | 102 |
#!/usr/bin/python3
"""
This bot is used for checking external links found at the wiki.
It checks several pages at once, with a limit set by the config variable
max_external_links, which defaults to 50.
The bot won't change any wiki pages, it will only report dead links such that
people can fix or remove the links the... | wikimedia/pywikibot-core | scripts/weblinkchecker.py | Python | mit | 27,333 |
# coding: utf-8
from django.views.generic import CreateView, UpdateView, DeleteView
from django.http import HttpResponse, HttpResponseRedirect
from django.template.loader import render_to_string
from django.template import RequestContext
from django.core.serializers.json import DjangoJSONEncoder
from django.conf import... | kobox/achilles.pl | src/static/fm/views.py | Python | mit | 4,377 |
import sys
if __name__ == '__main__':
with open('/dev/input') as input_fp:
with open('/dev/output', 'a') as output_fp:
output_fp.write(input_fp.read())
msg = 'Zapp registered!'
resp = """\
HTTP/1.1 201 Created
Content-Type: message/http
Content-Length: %(msg_len)s
%(m... | larsbutler/zpa | publish/store.py | Python | apache-2.0 | 399 |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2016
import unittest
import sys
import itertools
import tempfile
import os
# Import the SPL decorators
from streamsx.spl import spl
import sys
def spl_namespace():
return "com.ibm.streamsx.topology.pytest.pyexceptions"
class EnterExit(ob... | ddebrunner/streamsx.topology | test/python/spl/testtkpy/opt/python/streams/op_exception.py | Python | apache-2.0 | 5,210 |
from . import _meta
from collections import deque
__version__ = _meta.version
__version_info__ = _meta.version_info
class Bucket(object):
"""
Encloses a function that produces results from
an item of an iterator, accumulating any results
in a deque.
"""
def __init__(self, func):
self... | johnwlockwood/stream_tap | stream_tap/__init__.py | Python | apache-2.0 | 1,389 |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 8 11:03:33 2013
@author: pczorniej
"""
from openerp.osv import fields, osv
from openerp.tools.translate import _
class jp_employee(osv.Model):
_name = "jp.employee"
_inherit = 'mail.thread'
_description = 'Employee'
_columns = {
'name': fields.... | mkieszek/jobsplus | jobsplus_recruitment/jp_employee.py | Python | agpl-3.0 | 1,053 |
__version__ = (0, 3, 7)
| jespino/sampledata | sampledata/__init__.py | Python | bsd-3-clause | 24 |
from pyvisdk.esxcli.executer import execute_soap
from pyvisdk.esxcli.base import Base
class IscsiPlugin(Base):
'''
Operations that can be performed on iSCSI management plugins
'''
moid = 'ha-cli-handler-iscsi-plugin'
def list(self, adapter=None, plugin=None):
'''
List IMA plugins.
... | xuru/pyvisdk | pyvisdk/esxcli/handlers/ha_cli_handler_iscsi_plugin.py | Python | mit | 723 |
#!/usr/bin/python
# recursive function
def permutation(prefix, current):
if len(current) == 0:
print prefix
else:
for i in range(len(current)):
permutation(prefix + current[i], current[0:i] + current[i+1:])
# iterative function
def permute(string):
print string
for i i... | chaitan64arun/algo-ds | string-permutation.py | Python | mit | 680 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | jmesteve/saas3 | openerp/addons/purchase/res_config.py | Python | agpl-3.0 | 5,643 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import ckeditor.fields
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Content',
fields=[
('id'... | django-emerge/django-richcontentblocks | richcontentblocks/migrations/0001_initial.py | Python | mit | 1,239 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
GBM parameter class
~~~~~~~~~~~~~~~~~~~
"""
from __future__ import print_function, division
import numpy as np
from .param_generic import GenericParam
__all__ = ['GBMparam']
class GBMparam(GenericParam):
"""Parameter storage for GBM model.
Attributes
... | khrapovs/diffusions | diffusions/param_gbm.py | Python | mit | 2,683 |
def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split()
return words
def sort_words(words):
"""Sorts the words"""
return sorted(words)
def print_first_word(words):
word = words.pop(0)
print word
def print_last_word(words):
word = words.pop(-1)
... | Supernovapsy/python | learn/one.py | Python | mit | 711 |
__author__ = 'cmantas'
import socket, struct, sys
multicast_group = '224.3.29.71'
server_address = ('', 10000)
# Create the socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Bind to the server address
sock.bind(server_address)
# Tell the operating system to add the socket to the multicast group
# o... | cmantas/cluster_python_tool | lookup_service/mc_listener.py | Python | apache-2.0 | 808 |
import re
import textwrap
import unittest
class BaseTestCase(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
# Python < 3.2 does not have assertNotRegex
if not hasattr(self, 'assertNotRegex'):
self.assertNotRegex = sel... | priomsrb/vimswitch | vimswitch/test/BaseTestCase.py | Python | gpl-2.0 | 1,064 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Red Hat, Inc.
#
# bugyou_plugins 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.
#
# bugyo... | sayanchowdhury/bugyou_plugins | bugyou_plugins/commands/cntrl.py | Python | gpl-3.0 | 2,758 |
"""Support for HLK-SW16 switches."""
import logging
from homeassistant.components.switch import ToggleEntity
from homeassistant.const import CONF_NAME
from . import DATA_DEVICE_REGISTER, DOMAIN as HLK_SW16, SW16Device
DEPENDENCIES = [HLK_SW16]
_LOGGER = logging.getLogger(__name__)
def devices_from_config(hass, do... | jamespcole/home-assistant | homeassistant/components/hlk_sw16/switch.py | Python | apache-2.0 | 1,466 |
#!/usr/bin/env python
import sys
from client import WechatClient
wechat_client = WechatClient()
with open(sys.argv[1], 'r') as f:
msgs = f.read().split('\n')
msgs = [msg.decode('utf-8') for msg in msgs]
groups = sys.argv[2].split()
print msgs
print groups
portal_uri = wechat_client.get_portal_uri()
wechat_cl... | bingosummer/wechat-group-manager | wechat_group_manager/app/console.py | Python | apache-2.0 | 371 |
from __future__ import absolute_import, unicode_literals
from django.http import HttpResponseBadRequest
from django.shortcuts import render_to_response
from django.views.decorators.csrf import csrf_exempt
from debug_toolbar.decorators import require_show_toolbar
from debug_toolbar.panels.sql.forms import SQLSelectFor... | barseghyanartur/django-debug-toolbar | debug_toolbar/panels/sql/views.py | Python | bsd-3-clause | 4,348 |
r"""
This module contains :py:meth:`~sympy.solvers.ode.dsolve` and different helper
functions that it uses.
:py:meth:`~sympy.solvers.ode.dsolve` solves ordinary differential equations.
See the docstring on the various functions for their uses. Note that partial
differential equations support is in ``pde.py``. Note t... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/sympy/solvers/ode.py | Python | gpl-3.0 | 215,264 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutSets(Koan):
def test_sets_make_keep_lists_unique(self):
highlanders = ['MacLeod', 'Ramirez', 'MacLeod', 'Matunas', 'MacLeod', 'Malcolm', 'MacLeod']
there_can_only_be_only_one = set(highlanders)
self.assert... | makougi/koans | python3/koans/about_sets.py | Python | mit | 2,190 |
"""
Apple Push Notification Service
Documentation is available on the iOS Developer Library:
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html
"""
import time
from apns2 import client as apns2_client
from apns2 import credentials as apns2_c... | shigmas/django-push-notifications | push_notifications/apns.py | Python | mit | 5,297 |
#!/usr/bin/env python
import sys
sys.path.extend(["./","../","../.."])
from lightk import base, ui
top = base.Window("centralized","escapable",resizable=True)
ca = base.tk.Canvas(top,bg="#fff",highlightthickness=0)
base.default_pack(ca)
menu_g = ui.MenuGroup(ca,2,2,width=640-4,height=400,theme=ui.themes.LIGHT_BTN,
ra... | cptx032/lightk | examples/simple_menu.py | Python | gpl-3.0 | 1,030 |
from __future__ import absolute_import
from django.shortcuts import render_to_response, redirect
from django.core.exceptions import ObjectDoesNotExist
from django.template import loader
from django.http import Http404, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from proj.arcs.models import DTRUse... | strikedebt/debtcollective-web | be/proj/arcs/dtr.py | Python | gpl-2.0 | 7,999 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 28 15:58:28 2016
@author: fergal
$Id$
$URL$
"""
__version__ = "$Id$"
__URL__ = "$URL$"
import numpy as np
import dave.pipeline.clipboard as dpc
import dave.fileio.mastio as mastio
import dave.fileio.tpf as tpf
#Bad values in input detrendings are replaced with thi... | barentsen/dave | fileio/loadMultipleDetrendings.py | Python | mit | 4,730 |
from __future__ import division
from builtins import map
from builtins import zip
from builtins import object
from copy import deepcopy
import csv
import datetime as dt
import json
import math
from lxml import etree, objectify
from collections import defaultdict, namedtuple
from decimal import Decimal
from collections ... | NREL/hescore-hpxml | hescorehpxml/base.py | Python | bsd-2-clause | 132,371 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###############################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
# Credits## ################################... | 3dfxsoftware/cbss-addons | account_invoice_line_currency/model/res_currency.py | Python | gpl-2.0 | 2,332 |
#!/usr/bin/env python
from datetime import datetime, timedelta
from collections import OrderedDict
import calendar
import sys
from ecmwfapi import ECMWFDataServer
import time
from dateutil.relativedelta import *
import os
import logging
start_time = time.time()
server = ECMWFDataServer()
def retrieve_interim(strtDat... | joelfiddes/topoMAPP | getERA/eraRetrievePLEVEL.py | Python | mit | 4,603 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2014, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | BoltzmannBrain/nupic.research | projects/sensorimotor/experiments/capacity/run.py | Python | agpl-3.0 | 4,104 |
from flask import Blueprint
from ..authentication import requires_authentication
main = Blueprint('main', __name__)
main.before_request(requires_authentication)
from .errors import *
from app.main.views import search
| RichardKnop/digitalmarketplace-search-api | app/main/__init__.py | Python | mit | 220 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for L{twisted.logger._util}.
"""
from twisted.trial import unittest
from .._observer import LogPublisher
from .._util import formatTrace
class UtilTests(unittest.TestCase):
"""
Utility tests.
"""
def test_trace... | Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/logger/test/test_util.py | Python | gpl-3.0 | 2,714 |
# coding: utf-8
# Account Loop Ping
#
# Script that adds time.
#
# Script that get all the users on the system, sets their mins.
# In[16]:
import os
import json
import socket
# In[17]:
myhn = socket.gethostname()
# In[18]:
myhn
# In[18]:
# In[19]:
lisho = os.listdir('/home')
# In[20]:
lisho
# I... | wcmckee/signinlca | aclooping.py | Python | mit | 616 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-03-10 03:10
from __future__ import unicode_literals
from django.db import migrations, models
import finder.models
class Migration(migrations.Migration):
dependencies = [
('finder', '0002_auto_20170303_0253'),
]
operations = [
... | dretta/EmbassyEmergency | finder/migrations/0003_auto_20170309_2010.py | Python | agpl-3.0 | 634 |
# Copyright 2020 NOKIA
#
# 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... | nuagenetworks/nuage-openstack-neutron | nuage_neutron/db/migration/alembic_migrations/versions/queens/contract/45aaef218f29_remove_redundant_column_from_switchport.py | Python | apache-2.0 | 950 |
from datetime import datetime
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from markdown import markdown
import bleach
from flask import current_app, request,Flask
from flask_sqlalchemy import SQLAlchemy
f... | micknh/EdFirst | app/models.py | Python | mit | 18,202 |
# Copyright (C) 2019 Vasiliy Sheredeko
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
from __future__ import annotations
import dataclasses
@dataclasses.dataclass(order=True, repr=False)
class Position:
# Line position in a document (one... | orcinus-lang/orcinus | orcinus/locations.py | Python | mit | 2,480 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# process.py - Copyright (C) 2012 Red Hat, Inc.
# Written by Fabian Deutsch <fabiand@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; ver... | oVirt/Node | src/ovirt/node/utils/process.py | Python | gpl-2.0 | 3,527 |
"""
A Pillow loader for .ftc and .ftu files (FTEX)
Jerome Leclanche <jerome@leclan.ch>
The contents of this file are hereby released in the public domain (CC0)
Full text of the CC0 license:
https://creativecommons.org/publicdomain/zero/1.0/
Independence War 2: Edge Of Chaos - Texture File Format - 16 October 2001
... | ryfeus/lambda-packs | pytorch/source/PIL/FtexImagePlugin.py | Python | mit | 3,322 |
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit for the Earth and Planetary Sciences
# Copyright (C) 2012 - 2015 by the BurnMan team, released under the GNU
# GPL v2 or later.
# This module provides the functions required to process the standard burnman formula compositions
# ProcessChemist... | ian-r-rose/burnman | burnman/processchemistry.py | Python | gpl-2.0 | 10,871 |
#!/usr/bin/python
# Copyright (C) 2008, 2014 Red Hat Inc.
#
# This file is part of systemtap, and is free software. You can
# redistribute it and/or modify it under the terms of the GNU General
# Public License (GPL); either version 2, or (at your option) any
# later version.
# This script monitors a remote system ... | serhei/stap-experiments | scripts/kprobes_test/monitor_system.py | Python | gpl-2.0 | 2,739 |
from sympy import bernoulli, Symbol, harmonic, Rational, oo, zoo, pi, bell, \
fibonacci, lucas
x = Symbol('x')
def test_bernoulli():
assert bernoulli(0) == 1
assert bernoulli(1) == Rational(-1,2)
assert bernoulli(2) == Rational(1,6)
assert bernoulli(3) == 0
assert bernoulli(4) == Rational(... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/sympy/functions/combinatorial/tests/test_comb_numbers.py | Python | agpl-3.0 | 2,024 |
#!/usr/bin/python
#
# 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... | davelab6/nototools | nototools/lint_config.py | Python | apache-2.0 | 22,271 |
from .dssim import DSSIMObjective
from .jaccard import jaccard_distance
from .crf_losses import crf_loss, crf_nll
| farizrahman4u/keras-contrib | keras_contrib/losses/__init__.py | Python | mit | 114 |
import glob, re
def MakeVTM(o, stem, blocks, timestep):
print >>o, '<VTKFile type="vtkMultiBlockDataSet" version="1.0" byte_order="LittleEndian">'
print >>o, '<vtkMultiBlockDataSet>'
for i, b in enumerate(blocks):
print >>o, '<DataSet index="%d" file="%s.%s.%s.vts"/>' % (i, stem, b, timestep)
print >>o, '</vt... | butakun/gus.mb | Tests/M-1-Stage-Unsteady/MakeVTMs.py | Python | gpl-3.0 | 892 |
# 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 collections
import json
from telemetry.core import util
from telemetry.page import page_benchmark
class SunSpiderBenchark(page_benchmark.PageBe... | timopulkkinen/BubbleFish | tools/perf/perf_tools/sunspider.py | Python | bsd-3-clause | 1,167 |
'''
gdrive for KODI / XBMC Plugin
Copyright (C) 2013-2016 ddurdle
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 late... | wndias/bc.repository | plugin.video.gdrive/resources/lib/gdrive_api2.py | Python | gpl-2.0 | 73,596 |
from flask import Flask
from flask import render_template
from .. import app
@app.route('/')
def index():
user = {'first_name': 'Lance', 'last_name': 'Anderson'}
return render_template('index.html', user=user)
@app.route('/user/<user_id>/board/<board_id>')
@app.route('/new_board')
def board(user_id=None, boa... | Lancea12/sudoku_solver | sudoku/views/index.py | Python | mit | 445 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from string... | nistormihai/superdesk-core | superdesk/commands/data_updates.py | Python | agpl-3.0 | 11,097 |
# orm/evaluator.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import operator
from ..sql import operators
class UnevaluatableError(Exception):
... | Br3nda/calcalcal | pylib/sqlalchemy/orm/evaluator.py | Python | mit | 4,279 |
# Copyright (C) 2013, Walter Bender
#
# 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.
#
# This program is distributed in... | quozl/sugar | tests/views/webaccount.py | Python | gpl-3.0 | 1,344 |
import unittest
import sys
from mock import MockSys
from pacha.util import run_command
class RunCommand(unittest.TestCase):
def test_run_command_stdout(self):
sys.stderr = MockSys()
actual = run_command(std="stdout", cmd="""echo "foo" """)
expected = ['foo\n']
self.assertEqual(act... | alfredodeza/pacha | pacha/tests/test_util.py | Python | mit | 620 |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from _... | mozilla/ChangeDetector | pyLibrary/queries/qb.py | Python | mpl-2.0 | 34,420 |
# -*- coding: utf-8 -*-
""" Hard code l'exemple du cours pour tester l'algorithme de Kruskal et Prim
Argument 1 : 0 = Kruskal
1 = Prim (défaut)
"""
import sys
from graph import Graph
from node import Node
from edge import Edge
from algoMST import kruskal, prim
kruskal_activated = False
if len(sys.ar... | Amathlog/MTH6412B | TP1/exempleCours.py | Python | mit | 1,240 |
from os import path
import setuptools
# Get long description from README.
with open('README.rst') as fh:
long_description = fh.read()
# Get package metadata from 'rolca.__about__.py' file.
base_dir = path.abspath(path.dirname(__file__))
about = {}
with open(path.join(base_dir, 'src', 'rolca', '__about__.py')) as ... | dblenkus/rolca | setup.py | Python | apache-2.0 | 2,499 |
"""
Forms
~~~~~~~~~~~~~~
Validation is provided for each column.
:copyright: (c) 2014 by Dario Coco
:license: GPLv3, see LICENSE for more details.
"""
import re
from flask_wtf import Form
from wtforms import TextField
from wtforms.validators import DataRequired, Regexp, ValidationError
clas... | moloch/flask_addressbook | addressbook/forms.py | Python | gpl-3.0 | 1,418 |
"""
merged implementation of the cache provider
the name cache was not chosen to ensure pluggy automatically
ignores the external pytest-cache
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import os
from collections import OrderedDict
imp... | hackebrot/pytest | src/_pytest/cacheprovider.py | Python | mit | 13,931 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
from teamscale_client import TeamscaleClient
from teamscale_client.constants import AssessmentMetricColors
from teamscale_client.data import Baseline
T... | cqse/teamscale-client-python | examples/example_baselines.py | Python | apache-2.0 | 1,192 |
import os
import shutil
from docutils import nodes, utils
from docutils.nodes import Body, Element
from docutils.parsers.rst import directives
from sphinx.util import relative_uri
from sphinx.util.nodes import set_source_info
from sphinx.util.compat import Directive
class asciicast(Body, Element):
pass
class A... | walac/linux | Documentation/sphinx/asciicast.py | Python | gpl-2.0 | 1,374 |
import posixpath
class UrlPackage:
""" Represents a package specified as a Url """
def __init__(self, url):
""" Initialize with the url """
if ':' in url:
self.url = url
else:
self.url = posixpath.join('git+git://github.com', url)
@p... | cloew/tidypip | tidypip/packages/url_package.py | Python | mit | 604 |
"""
LrCollection.py
Heikki.Huttunen@tut.fi, Jul 29th, 2014
Defines the class LrCollection: A hierarchical two-layer
structure for MEG decoding. The input consists of time slices
and sensor slices. Each 1st layer classifier will see one
slice of the data either in time or sensor dimension.
The 1s... | mahehu/decmeg | LrCollection.py | Python | bsd-3-clause | 9,264 |
import random
random.seed()
def main():
pass
if __name__ == '__main__':
main()
| autodrive/utils3 | utils3/get_files.py | Python | apache-2.0 | 92 |
# coding: utf-8
__version__ = '2.0.6'
| Mim0oo/cryptomon | coinbase/wallet/__init__.py | Python | gpl-3.0 | 38 |
"""
The SpatialProxy object allows for lazy-geometries and lazy-rasters. The proxy
uses Python descriptors for instantiating and setting Geometry or Raster
objects corresponding to geographic model fields.
Thanks to Robert Coup for providing this functionality (see #4322).
"""
from django.db.models.query_utils import ... | ar4s/django | django/contrib/gis/db/models/proxy.py | Python | bsd-3-clause | 3,122 |
# 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 agreed to in... | eayunstack/neutron | neutron/tests/unit/db/test_provisioning_blocks.py | Python | apache-2.0 | 6,841 |
## @file Recommender.py
# @brief Script responsible for gathering, vetting, and adding songs to the user playlist
# @details This script is designed to be run periodically to generate new recommendations
# for the user. The script will instantiate a user, determine if the profile needs
# to be updated, gather and filt... | SLongofono/448_Project4 | Recommender.py | Python | mit | 10,131 |
from django.utils.datastructures import MultiValueDict
from rest_framework import serializers
class BasicObject:
"""
A mock object for testing serializer save behavior.
"""
def __init__(self, **kwargs):
self._data = kwargs
for key, value in kwargs.items():
setattr(self, ke... | callorico/django-rest-framework | tests/test_serializer_lists.py | Python | bsd-2-clause | 10,736 |
from rest_framework import serializers
from django.conf import settings
from apps.users.models import User
class UserSerializer(serializers.ModelSerializer):
registered_at = serializers.DateTimeField(format='%H:%M %d.%m.%Y', read_only=True)
avatar = serializers.SerializerMethodField(read_only=True)
ful... | vchaptsev/cookiecutter-django-vue | {{cookiecutter.project_slug}}/backend/apps/users/serializers.py | Python | bsd-3-clause | 988 |
from django.contrib.auth.models import User
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
from django.utils import timezone
from students.models import Exam, Group
class TestExamsList(TestCase):
"""Test for ExamsList view"""
@classmethod
def setUpTestData(cls):
... | hddn/studentsdb | students/tests/test_exams_list.py | Python | mit | 2,698 |
########################
# Incomplete code from Pong
# Repeated code
def draw(c):
global paddle1_pos, paddle2_pos
paddle_width = 80
if paddle_width/2 <= paddle1_pos + paddle1_vel <= width - paddle_width/2:
paddle1_pos += paddle1_vel
if paddle_width/2 <= paddle2_pos + paddle2_vel <= width ... | Crescent-Saturn/Hello_Python | Week7/examples-tips7.py | Python | gpl-3.0 | 6,636 |
from .abstract_standard_media import AbstractStandardMedia
class AudioMedia(AbstractStandardMedia):
def __init__(self, name, group_id, segment_path, encoding_id, stream_id, muxing_id, drm_id=None,
start_segment_number=None, end_segment_number=None, language=None, assoc_language=None,
... | bitmovin/bitmovin-python | bitmovin/resources/models/manifests/hls/audio_media.py | Python | unlicense | 2,318 |
#!/usr/bin/env python
from setuptools import setup, find_packages
with open('requirements.txt') as f:
requirements = f.read().splitlines()
version = '0.3.1'
setup(
name='praw-oauth2util',
version=version,
install_requires=requirements,
author='Benjamin Schmid',
author_email='bsgame27@gmail.c... | 13steinj/praw-OAuth2Util | setup.py | Python | mit | 1,263 |
# 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 ... | Azure/azure-sdk-for-python | sdk/security/azure-mgmt-security/azure/mgmt/security/operations/_connectors_operations.py | Python | mit | 13,366 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | nirbheek/cerbero | test/test_cerbero_packages_package.py | Python | lgpl-2.1 | 8,235 |
#! /usr/bin/env python
#adam: this is an older version of cosmos_sim.py from ~/wtgpipeline, which probably won't be needed anymore, but should be saved anyway (just in case)
# I've incorporated two of the changes cause I basically knew they were right:
# (1) ID/id is an input for more functions now
# (2) we don't appen... | deapplegate/wtgpipeline | non_essentials/cosmos_sim_old.py | Python | mit | 20,068 |
# -*- coding: utf-8 -*-
"""
Python Flight Mechanics Engine (PyFME).
Copyright (c) AeroPython Development Team.
Distributed under the terms of the MIT License.
Test functions for trimmer
These values are hardcoded from the function results with the current costants.
--------------------------
"""
from numpy.testing ... | olrosales/PyFME | src/pyfme/utils/tests/test_trimmer.py | Python | mit | 1,981 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Fast R-CNN config system.
This file specifies default config option... | JosephKJ/SDD-RFCN-python | lib/fast_rcnn/config.py | Python | mit | 9,486 |
import sys
import tensorflow as tf
from vahun.Text import Text
import numpy as np
from vahun.tools import Timer
from vahun.tools import explog
from vahun.autoencoder import Autoencoder_ffnn
from vahun.variational_autoencoder import Variational_autoencoder
from vahun.genetic import evolution
from vahun.genetic import ex... | evelkey/vahun | experiment_FINAL.py | Python | apache-2.0 | 4,608 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.