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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from django import template
register = template.Library()
@register.filter
def product_url(product, category=None):
return product.get_absolute_url(category=category)
| fusionbox/satchless | satchless/category/templatetags/category.py | Python | bsd-3-clause | 197 |
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_07_01/operations/__init__.py | Python | mit | 3,510 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from setuptools import setup, find_packages
import codecs
def _read_file(name, encoding='utf-8'):
"""
Read the contents of a file.
:param name: The name of the file in the current directory.
:param encoding: The encoding of the file; def... | gebn/nibble | setup.py | Python | mit | 1,923 |
# -*- coding: utf-8 -*-
import time
import EafIO
import warnings
class Eaf:
"""Read and write Elan's Eaf files.
.. note:: All times are in milliseconds and can't have decimals.
:var dict annotation_document: Annotation document TAG entries.
:var dict licences: Licences included in the file.
:va... | acuriel/Nixtla | nixtla/core/tools/pympi/Elan.py | Python | gpl-2.0 | 33,330 |
# coding=utf-8
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANT... | CalthorpeAnalytics/urbanfootprint | footprint/main/models/database/information_schema.py | Python | gpl-3.0 | 17,077 |
from heapq import heappush, heappop
def heapsort(v):
h = []
for x in v:
heappush(h, x)
return [heappop(h) for i in range(len(h))]
from random import shuffle
v = list(range(8))
shuffle(v)
print (v)
v = heapsort(v)
print (v) | Gigers/data-struct | Aulas/aula11/teacher_code/heapSort.py | Python | bsd-2-clause | 233 |
from random import randint
board = []
for x in range(5):
board.append(["O"] * 5)
def print_board(board):
for row in board:
print " ".join(row)
print "Let's play Battleship!"
print_board(board)
def random_row(board):
return randint(0, len(board) - 1)
def random_col(board):
return randint(0,... | mandeepjadon/python-game | battleship.py | Python | mit | 1,203 |
"""Run all test cases.
"""
import sys
import os
import unittest
try:
# For Pythons w/distutils pybsddb
import bsddb3 as bsddb
except ImportError:
# For Python 2.3
import bsddb
if sys.version_info[0] >= 3 :
charset = "iso8859-1" # Full 8 bit
class logcursor_py3k(object) :
... | Jeff-Tian/mybnb | Python27/Lib/bsddb/test/test_all.py | Python | apache-2.0 | 19,765 |
from ptypes import *
v = 0 # FIXME: this file format is busted
class seq_parameter_set_rbsp(pbinary.struct):
class __pic_order_type_1(pbinary.struct):
_fields_ = [
(1, 'delta_pic_order_always_zero_flag'),
(v, 'offset_for_non_ref_pic'),
(v, 'offset_for_top_to_botto... | arizvisa/syringe | template/video/h264.py | Python | bsd-2-clause | 2,279 |
# textGridworldDisplay.py
# -----------------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to ht... | hsgui/interest-only | deeplearning/reinforcementlearning/textGridworldDisplay.py | Python | gpl-2.0 | 13,229 |
from django.conf.urls import url
from .conf import settings
from .views import (
BlogIndexView,
DateBasedPostDetailView,
ManageCreatePost,
ManageDeletePost,
ManagePostList,
ManageUpdatePost,
SecretKeyPostDetailView,
SectionIndexView,
SlugUniquePostDetailView,
StaffPostDetailView... | pinax/pinax-blog | pinax/blog/urls.py | Python | mit | 1,697 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Water Supply model
- WaterSupplySectorModel implements SectorModel
- wraps ExampleWaterSupplySimulationModel
- instantiate a model instance
"""
import logging
import numpy as np
from smif.model.sector_model import SectorModel
class WaterSupplySectorModel(SectorMode... | nismod/smif | src/smif/sample_project/models/water_supply.py | Python | mit | 5,099 |
import _plotly_utils.basevalidators
class HoverinfosrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="hoverinfosrc", parent_name="treemap", **kwargs):
super(HoverinfosrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name... | plotly/python-api | packages/python/plotly/plotly/validators/treemap/_hoverinfosrc.py | Python | mit | 453 |
from datetime import datetime, timedelta
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.utils import timezone
import factory
from . import models
UserModel = get_user_model()
class UserFactory(factory.django.DjangoModelFactory):
email = factory.Sequence... | oleg-chubin/let_me_play | let_me_app/factories.py | Python | apache-2.0 | 3,328 |
import numpy as np
import cudarray as ca
from ..feedforward.layers import Activation, FullyConnected
from ..loss import Loss
from ..base import Model, PickleMixin
from ..input import Input
from ..parameter import Parameter
class Autoencoder(Model, PickleMixin):
def __init__(self, n_out, weights, bias=0.0, bias_pr... | lre/deeppy | deeppy/autoencoder/autoencoder.py | Python | mit | 5,076 |
import unittest
import urllib
from nose.tools import nottest
from mock import patch
from lsapi import lsapi
from tests.mocks.ls_socket import SocketMocks
class LsapiHostsTestCase(unittest.TestCase):
version = 'v1'
testhost = 'host-aut-1af.example.com'
host_filter_correct = '{"eq":["display_name","%s"]}'... | zwopiR/lsapi | tests/lsapi_hosts_tests.py | Python | mit | 6,431 |
# $Id: body.py 7267 2011-12-20 14:14:21Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Directives for additional body elements.
See `docutils.parsers.rst.directives` for API details.
"""
__docformat__ = 'reStructuredText'
import sys
from doc... | JulienMcJay/eclock | windows/Python27/Lib/site-packages/docutils/parsers/rst/directives/body.py | Python | gpl-2.0 | 9,243 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... | vincent-noel/libSigNetSim | libsignetsim/data/ListOfExperimentalData.py | Python | gpl-3.0 | 3,811 |
#!/usr/bin/env python
# Copyright (c) 2008-14 Qtrac Ltd. All rights reserved.
# This program or module is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 2 of the License, or
# version 3 of the Lic... | manashmndl/LearningPyQt | pyqt/chap05/numberformatdlg2.py | Python | mit | 4,502 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sys import getrefcount
import sys
import copy
class Leaf(object):
"""Leaf of an red-black tree."""
def __init__(self):
self.color = "BLACK"
self.parent = None
def insert(self, interval):
node = RBIntervalNode(interval, "RED", sel... | AlgoLab/PIntron-scripts | cutfiller/rbtree.py | Python | agpl-3.0 | 15,824 |
import base64
from datetime import datetime
import requests
class TwitterConnection:
"""
Twitter API client for searching tweets
:cvar timeout: Requests timeout in seconds
:cvar tweet_api_url: API URL for searching tweets
:ivar session: Twitter authorized session (connection)
"""
timeout... | MarekSuchanek/PYT-TwitterWall | twitterwall/common.py | Python | mit | 3,887 |
"""
Attempt to generate templates for module reference with Sphinx
To include extension modules, first identify them as valid in the
``_uri2path`` method, then handle them in the ``_parse_module_with_import``
script.
Notes
-----
This parsing is based on import and introspection of modules.
Previously functions and cl... | mdesco/dipy | doc/tools/apigen.py | Python | bsd-3-clause | 17,931 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018, Simon Weald <ansible@simonweald.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... | alxgu/ansible | lib/ansible/modules/cloud/memset/memset_dns_reload.py | Python | gpl-3.0 | 5,850 |
import web
login_form = web.form.Form(
web.form.Textbox('usuario', web.form.notnull),
)
search_form = web.form.Form(
web.form.Textbox('buscar', web.form.notnull),
)
useradd_form = web.form.Form(
web.form.Textbox('username', web.form.notnull),
web.form.Textbox('name', web.form.notnull),
)
gradeadd_fo... | vicnala/ampabooks | forms.py | Python | gpl-3.0 | 1,426 |
import numpy as np
import spm1d
#(0) Load dataset:
dataset = spm1d.data.uv0d.anova2onerm.Santa23()
dataset = spm1d.data.uv0d.anova2onerm.Southampton2onerm()
# dataset = spm1d.data.uv0d.anova2onerm.RSXLDrug()
# dataset = spm1d.data.uv0d.anova2onerm.SPM1D3x3()
# dataset = spm1d.data.uv0d.anova2onerm.SP... | 0todd0000/spm1d | spm1d/examples/nonparam/0d/ex_anova2onerm.py | Python | gpl-3.0 | 1,031 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-07-30 11:54
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [("release_changed", "0001_initial")]
operations = [
migrations.AddField(
model_name="releasechang... | sipwise/repoapi | release_changed/migrations/0002_add_label.py | Python | gpl-3.0 | 980 |
import collections
import numpy as np
import pandas as pd
import pickers as pck
def col_contains(value):
def cell_contains_value(cell_list):
return value in cell_list
return cell_contains_value
class BaseFrame(pd.DataFrame):
# Overriding the DataFrame constructor so that new instances
# der... | kochhar/cric | cric/wrappers.py | Python | agpl-3.0 | 2,225 |
from pandac.PandaModules import *
from direct.gui.DirectGui import *
from pandac.PandaModules import *
from toontown.toonbase import ToontownGlobals
from direct.showbase import DirectObject
from direct.fsm import ClassicFSM, State
from direct.fsm import State
from direct.directnotify import DirectNotifyGlobal
from otp.... | Spiderlover/Toontown | toontown/toon/ToonTeleportPanel.py | Python | mit | 11,675 |
from datetime import datetime, timedelta
import json
from django.conf import settings
from django.contrib.sites.models import Site
from django.core import mail
from django.core.cache import cache
import mock
from nose.tools import eq_, nottest
from kitsune.products.tests import ProductFactory, TopicFactory
from kits... | anushbmx/kitsune | kitsune/wiki/tests/test_templates.py | Python | bsd-3-clause | 121,308 |
from calculadora_tests import Calculadora
class CalculadoraHP(Calculadora):
def obter_entradas(self):
valor = input('Digite o sinal da operação desejada: ')
self.sinal = valor
valor = input('Digite o primeiro número: ')
self.entrada = int(valor)
valor = input('Digite o segu... | renzon/reqgithub | calculadora_extendida.py | Python | mit | 373 |
"""Configuration for ACLs."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2019 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file e... | REANNZ/faucet | faucet/acl.py | Python | apache-2.0 | 33,575 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 later version.
#
# This program is distrib... | Microvellum/Fluid-Designer | win64-vc/2.78/scripts/addons/io_scene_obj/export_obj.py | Python | gpl-3.0 | 38,130 |
#!/usr/bin/env python
'''
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")... | zouzhberk/ambaridemo | demo-server/src/main/python/ambari_server/properties.py | Python | apache-2.0 | 7,241 |
import codecs
from setuptools import setup
VERSION = '0.2.0'
def read_long_description():
long_desc = []
with codecs.open('README.rst', 'r', 'utf8') as longdesc:
long_desc.append(longdesc.read())
with codecs.open('HISTORY.rst', 'r', 'utf8') as history:
long_desc.append(history.read())
... | scardine/image_size | setup.py | Python | mit | 776 |
#!/usr/bin/env python3
# License MIT
# Copyright 2016-2021 Alex Winkler
# Version 3.0.0
import discord
from discord.ext import commands
from dislash import *
from ftsbot import secrets
from ftsbot.cogs.antispam import antispam
from ftsbot.cogs.channelmoderation import channelmoderation
from ftsbot.cogs.presence impor... | FO-nTTaX/Liquipedia-Discord-Bot | discordbot.py | Python | mit | 847 |
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | radez/python-heatclient | heatclient/v1/shell.py | Python | apache-2.0 | 7,499 |
"""
@summary:
"""
from argparse import ArgumentParser
# parse command line arguments
parser = ArgumentParser( description = """Computes position-specific conservation scores
given a multiple sequence alignment.""" )
parser.add_argument( '-i', '--input', dest = 'msa', required = True,
hel... | computbiolgeek/seq_utils | src/score_residue_conservation.py | Python | gpl-3.0 | 1,637 |
#!/usr/bin/env python
# test_homeDirectory.py vi:ts=4:sw=4:expandtab:
#
# Scalable Periodic LDAP Attribute Transmogrifier
# Authors:
# Nick Barkas <snb@threerings.net>
# Based on ssh key helper tests by:
# Landon Fuller <landonf@threerings.net>
# Will Barton <wbb4@opendarwin.org>
#
# Copyright (c) 200... | threerings/splatd | splat/helpers/test/test_homeDirectory.py | Python | bsd-3-clause | 6,191 |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class PostFleetsFleetIdMembersForbidden(object):
"""
NOT... | minlexx/pyevemon | esi_client/models/post_fleets_fleet_id_members_forbidden.py | Python | gpl-3.0 | 3,027 |
# Copyright 2013 Daniel Narvaez
#
# 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 writi... | dnarvaez/osbuild | osbuild/utils.py | Python | apache-2.0 | 983 |
from __future__ import division
import utm as UTM
import pytest
try:
import numpy as np
use_numpy = True
except ImportError:
use_numpy = False
def assert_utm_equal(a, b):
if use_numpy and isinstance(b[0], np.ndarray):
assert np.allclose(a[0], b[0])
assert np.allclose(a[1], b[1])
... | Turbo87/utm | test/test_utm.py | Python | mit | 10,049 |
'''
Created on Dec 3, 2013
@author: bogdan
requires python3
'''
import os, sys, re
from collections import defaultdict
import math
import md060graphonoLev
class clCrossLevenshtein(object):
'''
classdocs
'''
def __init__(self, SFInA, SFInB, SLangIDa, SLangIDb):
'''
Constructor
... | bogdanbabych/morphosyntax | src/s010cognatematch/md070crosslevenshteinPhonV05.py | Python | apache-2.0 | 8,375 |
# -*- coding: utf-8 -*-
"""
@attention: 校验方法封装
@author: lizheng
@date: 2013-12-09
"""
import re
class VerifyError(Exception):
pass
def vlen(s, min_l, max_l):
if min_l <= len(s) <= max_l:
return
raise VerifyError, u"长度超过范围(%s,%s)" % (min_l, max_l)
def vemail(s, min_len=3, max_len=50):
r... | lantianlz/zx | common/validators.py | Python | gpl-2.0 | 1,739 |
# Ardclient
#
# Author: Dan Keder <dan.keder@gmail.com>
import popen2
import struct
import sys
def hexdump(data):
''' Hexdump data.
'''
(fout, fin) = popen2.popen2("/usr/bin/hexdump -Cv")
fin.write(data)
fin.close()
return fout.read()
def dump(filename, data):
f = open(filename, "w")
... | dankeder/ardclient | ardclient/debug.py | Python | gpl-2.0 | 765 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2017 CERN.
#
# INSPIRE 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 ... | kaplun/inspire-next | inspirehep/modules/forms/bundles.py | Python | gpl-3.0 | 1,950 |
from newf import Application, Response, ResponseRedirect
def foo(request):
return Response("<h1>Hello World!</h1>")
def bar(request):
return ResponseRedirect("/foo")
def test_debug(request):
raise Exception, 'I am the exception'
urls = (
(r'^/foo$', foo),
(r'^/bar$', bar... | lucky/newf | example_app.py | Python | mit | 559 |
#!/usr/bin/env python3
# more.py
#
# Simple implementation of Unix "more" command.
#
# Allows more than one file on command line. Checks all files before generating
# output (note race condition here).
#
# AMJ
# 2017-03-29
import argparse
from shutil import get_terminal_size
def file_exists (filename):
"""Det... | TonyJenkins/cfs2160-python | 03unix/more.py | Python | unlicense | 3,318 |
# -*- coding: utf-8 -*-
'''
Aggregation plug-in to copy all FCS files under a specified FLOW element
to the user folder.or to the session workspace for download.
@author: Aaron Ponti
'''
from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria
from ch.systemsx.cisd.openbis.generic.shared.api.v1.d... | aarpon/obit_flow_core_technology | core-plugins/flow/4/dss/reporting-plugins/export_flow_datasets/export_flow_datasets.py | Python | apache-2.0 | 43,482 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.utils
from frappe.utils.oauth import get_oauth2_authorize_url, get_oauth_keys, login_via_oauth2, login_via_oauth2_id_token, login_oauth_user as _login_... | vjFaLk/frappe | frappe/www/login.py | Python | mit | 4,110 |
# -*- coding: utf-8 -*-
from collections import defaultdict
import io
import logging
import operator
import os.path
import socket
from babelfish import Language
from pkg_resources import EntryPoint
import requests
from stevedore import EnabledExtensionManager, ExtensionManager
from .subtitle import compute_score, get... | duramato/SickRage | lib/subliminal/api.py | Python | gpl-3.0 | 17,713 |
"""Test fixtures for unit tests only"""
from typing import Dict
import pytest
import responses
@pytest.fixture(scope="module")
def project_token() -> str:
"""Project API token"""
return "0" * 32
@pytest.fixture(scope="module")
def project_urls() -> Dict[str, str]:
"""Different urls for different mock p... | redcap-tools/PyCap | tests/unit/conftest.py | Python | mit | 889 |
import zmq
class Sender():
def __init__(self):
self.port = '5555'
self.context = zmq.Context()
self.socket = self.context.socket(zmq.PAIR)
self.socket.connect("tcp://localhost:%s" % self.port)
def send(self, command):
try:
self.socket.send(command, flags=zm... | uberspaceguru/GiantTetris | python/tetris_web/app/models.py | Python | mit | 381 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Cloudbase Solutions Srl
#
# Author: Alessandro Pilotti <apilotti@cloudbasesolutions.com>
#
# 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 Lic... | citrix-openstack-build/ceilometer | tests/compute/virt/hyperv/test_inspector.py | Python | apache-2.0 | 4,550 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | BeenzSyed/tempest | tempest/api/compute/limits/test_absolute_limits_negative.py | Python | apache-2.0 | 1,868 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# django-yaat documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 7 12:10:33 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
... | pombredanne/django-yaat | docs/source/conf.py | Python | mit | 9,320 |
# Copyright 2018 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.
import latindance
class XConstruct(latindance.Latinlike):
def __init__(self, delegate):
self._delegate = delegate
self._k... | google/adiantum | python/xconstruct.py | Python | mit | 1,523 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import time
import json
import random
import urllib
import logging
import argparse
import coloredlogs
from pyquery import PyQuery
BASEDIR = os.path.dirname(os.path.abspath(__name__))
OUTPUTDIR = os.path.join(BASEDIR, 'data/output')
coloredlogs.install()
clas... | shanzi/thesiscode | topiccrawler.py | Python | bsd-2-clause | 4,289 |
# -*- coding: utf-8 -*-
"""The QCOW image file-like object."""
import pyqcow
from dfvfs import dependencies
from dfvfs.file_io import file_object_io
from dfvfs.lib import errors
from dfvfs.resolver import resolver
dependencies.CheckModuleVersion(u'pyqcow')
class QcowFile(file_object_io.FileObjectIO):
"""Class t... | jorik041/dfvfs | dfvfs/file_io/qcow_file_io.py | Python | apache-2.0 | 1,285 |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
from pyramid.view import view_config
from pyramid.httpexceptions import HTTPFound
from dace.util import getSite
from dace.processinstance.core import DEFAULTMAPPING_A... | ecreall/lagendacommun | lac/views/services_processes/import_service/see_service.py | Python | agpl-3.0 | 1,732 |
# Copyright 2015, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | wfxiang08/Nuitka | nuitka/__past__.py | Python | apache-2.0 | 1,988 |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.contrib.auth import logout
from django.contrib.auth import login
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.urlresolvers import reverse
from django.utils.decorators import method_decorator
from... | django-bmf/django-bmf | djangobmf/account/views.py | Python | bsd-3-clause | 2,544 |
#!/usr/bin/env python
'''
@file ion/services/sa/instrument/test/test_int_data_acquisition_management_service.py
@author Maurice Manning
@test ion.services.sa.acquisition.DataAcquisitionManagementService integration test
'''
#from pyon.ion.endpoint import ProcessRPCClient
from pyon.public import log, IonObject, PRED, ... | ooici/coi-services | ion/services/sa/acquisition/test/test_bulk_data_ingestion.py | Python | bsd-2-clause | 43,234 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RLimsolve(RPackage):
"""Solving Linear Inverse Models
Functions that (1) find the min... | LLNL/spack | var/spack/repos/builtin/packages/r-limsolve/package.py | Python | lgpl-2.1 | 1,250 |
# Copyright (c) 2016 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | aria-tosca/aria-cli | aria_cli/print_utils.py | Python | apache-2.0 | 2,652 |
"""
Copyright (c) 2013, SMART Technologies ULC
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 an... | smysnk/sikuli-framework | examples/textedit/baseline/os/mac/TextEdit/TextEdit-1.py | Python | bsd-3-clause | 2,077 |
# Configuration settings for electoral address GUI
from PyQt4.QtCore import *
import ElectoralAddress.Database as Database
organisationName='Land Information New Zealand'
applicationName='Electoral Address Loader'
_settings=None
def settings():
global _settings
if not _settings:
_sett... | SPlanzer/AIMS | ElectoralAddress/Gui/Config.py | Python | bsd-3-clause | 1,936 |
#Calculating user's salary according to the number of days given by user and capturing the output in a file
#PsuedoCode
#Step 1 : User Input from stdin, Enter number of days
#step 2 : Take the days as argument to the condition
#step 3 : Check the condition if the number of days are valid i.e. 1 to 366 inclusive
#ste... | stirumer/Python | Python #3/Salary_psuedo_program.py | Python | mit | 3,401 |
#!/usr/bin/env python
# Copyright 2014 Roland Knall <rknall [AT] gmail.com>
#
# Wireshark - Network traffic analyzer
# By Gerald Combs <gerald@wireshark.org>
# Copyright 1998 Gerald Combs
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# a... | sodzawic/tk | doc/extcap_example.py | Python | gpl-2.0 | 9,150 |
import unittest
import os
from auctionTheory.src import StoreTickData
from auctionTheory.tests import HTMLTestRunner
class RunTests(object):
def executeTests(self):
# get the directory path to output report file
static_folder_root=os.path.dirname(os.path.dirname(__file__))
# get all test... | gullyy/auctionTheory | auctionTheory/tests/RunTests.py | Python | mit | 1,058 |
import os.path
from wptserve.utils import isomorphic_decode
def main(request, response):
header = [(b'Content-Type', b'text/html')]
if b'test' in request.GET:
with open(os.path.join(os.path.dirname(isomorphic_decode(__file__)), u'blank.html'), u'r') as f:
body = f.read()
return (header, body)
if ... | scheib/chromium | third_party/blink/web_tests/external/wpt/service-workers/service-worker/resources/sandboxed-iframe-fetch-event-iframe.py | Python | bsd-3-clause | 653 |
#! /usr/bin/env python
#
# ProjectEuler.net - problem #003
#
# Summary: The prime factors of 13195 are 5, 7, 13 and 29.
# What is the largest prime factor of the number 600851475143 ?
import sys
from sets import Set
import time
import math
n = 600851475143
queue = [n]
factors = Set([])
def debug(message):
if deb... | olivereggert/euler | euler003.py | Python | mit | 1,976 |
# -*- coding: utf-8 -*-
#
# PyService documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 8 11:31:42 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | iLoveTux/pyservice | docs/source/conf.py | Python | gpl-2.0 | 9,807 |
import bpy
import bmesh
from math import radians
def get_bmesh(ob):
me = ob.data
if ob.mode == 'OBJECT':
bm = bmesh.new()
bm.from_mesh(me)
return bm
bm = bmesh.from_edit_mesh(me)
return bm
def finalize_bmesh(bm, ob):
me = ob.data
if ob.mode == 'OBJECT':
bm... | BlenderShare/templates | TemplatesFiles/blender-2.79/bmesh/select_sharp.py | Python | gpl-3.0 | 1,483 |
"""
Author: Ioana Butoi
Date: Apr 2005
Project: Two robots play soccer against each other
Each of them controls half of the arena. Each half of the court is
colored differenly.
Robot: Aibo ERS-7
"""
from pyrobot.brain.behaviors.fsm import *
from time import sleep
import random
matchBall = 25
match... | emilydolson/forestcat | pyrobot/plugins/brains/AiboSoccer.py | Python | agpl-3.0 | 21,594 |
"""
Models for User Information (students, staff, etc)
Migration Notes
If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py lms schemamigration student --auto description_of_... | iivic/BoiseStateX | common/djangoapps/student/models.py | Python | agpl-3.0 | 77,328 |
from django.db import models
class PostQuerySet(models.QuerySet):
def released(self):
return self.filter(released=True)
def not_released(self):
return self.filter(released=False)
| arineto/arineto-website | apps/blog/managers.py | Python | mit | 207 |
import judicious
# judicious.register("http://127.0.0.1:5000")
# judicious.register("https://imprudent.herokuapp.com")
scenario = "A drug cartel has hidden 1 kilogram of cocaine somewhere on the person or in the luggage of a passenger on a commercial flight. Where do you think the cocaine might be hidden?"
response =... | suchow/judicious | tests/test45.py | Python | mit | 356 |
import os
import csv
import fnmatch
import datetime
import pandas as pd
import win32com.client
def num(s):
try:
if s == "" or s == "None" or str(float(s)) == "nan":
return 0
return str(int(s))
except:
return s
def arrs_to_xlsx(filename, header=[], arr=[]):
i = 1
xl = win32com.client.Dispatch('Excel.App... | frederick623/HTI | recon/fa_mssd_recon.py | Python | apache-2.0 | 5,991 |
# -*- coding: utf-8 -*-
# This file is part of pygal
#
# A python svg graph plotting library
# Copyright © 2012-2014 Kozea
#
# This library 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
# Software Foundation, either version... | mytliulei/DCNRobotInstallPackages | windows/win32/pygal-1.7.0/pygal/graph/horizontalstackedbar.py | Python | apache-2.0 | 1,002 |
import sys, re
filename = sys.argv[1] + '/src/gui/image/qjpeghandler.pri'
print " patching ", filename
s = open(filename).read()
s = re.sub(r'win32:\s*LIBS \+= libjpeg.lib', 'win32: LIBS += jpeg.lib', s)
open(filename, "w").write(s)
filename = sys.argv[1] + '/src/gui/image/qpnghandler.pri'
print " patc... | ukoethe/ilastik-build | patches/patch_qt.py | Python | gpl-2.0 | 1,169 |
'''
Created on Mar 18, 2012
@author: mchrzanowski
'''
from math import floor, sqrt
from ProjectEulerLibrary import isNumberPalindromic
from time import time
def main():
rollingTotal = 1 # 1 ** 2 is special as it's palindromic, but it's only 1 number.
# so start the total ... | mchrzanowski/ProjectEuler | src/python/Problem125.py | Python | mit | 1,532 |
import unittest
from urh.awre.CommonRange import CommonRange
class TestCommonRange(unittest.TestCase):
def test_ensure_not_overlaps(self):
test_range = CommonRange(start=4, length=8, value="12345678")
self.assertEqual(test_range.end, 11)
# no overlapping
self.assertEqual(test_ran... | jopohl/urh | tests/awre/test_common_range.py | Python | gpl-3.0 | 1,223 |
# This file is part of eventmq.
#
# eventmq 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
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# eventmq is distributed in the ... | com4/eventmq | eventmq/router.py | Python | lgpl-2.1 | 37,314 |
import enum
import sys
import unittest
from vendor.enum import Enum, IntEnum, unique, EnumMeta
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
pyver = float('%s.%s' % sys.version_info[:2])
try:
any
except NameError:
def any(iterable):
for element in iterable:
if element:
... | bernardorufino/pick | src/vendor/enum/test_enum.py | Python | mit | 62,290 |
# -*- coding: utf-8 -*-
###############################################################################
#
# CSW Client
# ---------------------------------------------------------
# QGIS Catalog Service client.
#
# Copyright (C) 2010 NextGIS (http://nextgis.org),
# Alexander Bruy (alexander.bruy@gmail... | CS-SI/QGIS | python/plugins/MetaSearch/dialogs/maindialog.py | Python | gpl-2.0 | 38,568 |
import pygame
import pygame.locals
from pygame.locals import *
import math
import time
class GameObject(object):
height = 10
width = 10
backgroundColor = (0, 0, 0)
pos = None
rect = None
surface = None
classification = None
uniqueid = None
def __init... | jeremyosborne/python | third_party/pygame/10_petri/gameobject.py | Python | mit | 1,280 |
# encoding: UTF-8
import psutil
import uiBasicWidget
from PyQt4 import QtGui
uiBasicWidget.BASIC_FONT = QtGui.QFont(u'微软雅黑', 10)
from uiBasicWidget import *
# from ctaAlgo.uiCtaWidget import CtaEngineManager
from ctaAlgo.uiCtaWidget import CtaEngineManager2
# from dataRecorder.uiDrWidget import DrEngineManager
from r... | freeitaly/Trading-System | vn.trader/ctaAlgo/uiStrategyWindow.py | Python | mit | 16,851 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "ConstantTrend", cycle_length = 5, transform = "Integration", sigma = 0.0, exog_count = 20, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Integration/trend_ConstantTrend/cycle_5/ar_12/test_artificial_32_Integration_ConstantTrend_5_12_20.py | Python | bsd-3-clause | 270 |
#!/usr/bin/python
#This fabric script must be used with `RHEL/CentOS/Fedora` systems
from fabric.api import sudo, run, env, cd
import sys
import os
import configuration as config
import instances
if os.stat('hosts_file').st_size == 0:
print "hosts_file is empty\n"
sys.exit(1)
env.hosts = open('hosts_file', 'r').... | marshyski/aws-fabric | fabfile.py | Python | apache-2.0 | 2,489 |
#!/usr/bin/env python
import sys
def read_params(args):
import argparse as ap
import textwrap
p = ap.ArgumentParser( description= "TBA" )
p.add_argument( '--in', metavar='INPUT_FILE', type=str,
nargs='?', default=sys.stdin,
help= "the Qiime OTU table fi... | geoffrosen/vaginal-microbiome | bin/custom_lefse/qiime2lefse.py | Python | mit | 2,945 |
# Copyright 2014 NEC Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | ntymtsiv/tempest | tempest/api/compute/v3/test_version.py | Python | apache-2.0 | 1,043 |
"""
Test if Matplotlib is using PyQt4 as backend
"""
def test_matplotlib_qt_backend():
print ("testing matplotlib qt backend ...")
try:
# Matplot changed its file structure several times in history, so we
# must test all
try:
from matplotlib.backends.qt_compat import QtCore... | jjhelmus/artview | tests/qt.py | Python | bsd-3-clause | 1,431 |
import pycurl
import json
import csv
import certifi
import io
from openpyxl import Workbook
from openpyxl.styles import Alignment,Font
### Setup Variables ###
URL='https://{id}.live.dynatrace.com/api/v1/'
APITOKEN='XXXXXXXXXXXXXXXXXXXXX'
DEST_FILENAME='dt-export.xlsx'
### function to go get the data
def dtApiQuer... | ruxit/data-export-api | ExcelExport/dt-excel.py | Python | bsd-3-clause | 6,726 |
# 1.1.3 Write a program that takes three integer command-line arguments and
# prints equal if all three are equal, and not equal otherwise.
# Needed to get command line arguments
import sys
def main(argv=None):
'''
Function called to run main script including unit tests
INPUT: List of arguments from the... | timgasser/algorithms_4ed | ch1_fundamentals/ex1.1.3.py | Python | mit | 2,468 |
"""
Render to gtk from agg
"""
import os
import matplotlib
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
show, draw_if_interactive,\
error_msg_gtk, NavigationToolbar, PIXEL... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/matplotlib/backends/backend_gtkagg.py | Python | gpl-3.0 | 4,299 |
#!c:\users\adebayo\myedge\myvenv\scripts\python.exe
#
# The Python Imaging Library
# $Id$
#
# this demo script illustrates pasting into an already displayed
# photoimage. note that the current version of Tk updates the whole
# image every time we paste, so to get decent performance, we split
# the image into a set of ... | tadebayo/myedge | myvenv/Scripts/painter.py | Python | mit | 2,141 |
import re
import sys
import whoisSrvDict
import whoispy_sock
import parser_branch
OK = '\033[92m'
FAIL = '\033[91m'
ENDC = '\033[0m'
def query(domainName):
rawMsg = ""
tldName = ""
whoisSrvAddr = ""
regex = re.compile('.+\..+')
match = regex.search(domainName)
if not match:
# Invalid ... | nemumu/whoispy | whoispy/whoispy.py | Python | gpl-3.0 | 1,198 |
import os
import json
LATEST_SCHEMA_VERSION = 2
def _id_to_name(id):
return ' '.join(id.split('_'))
def _name_to_id(name):
return '_'.join(name.split(' '))
def ensure_schema_structure(schema):
schema['pages'] = schema.get('pages', [])
schema['title'] = schema['name']
schema['version'] = schema.g... | jnayak1/osf.io | website/project/metadata/schemas.py | Python | apache-2.0 | 1,660 |
# -*- coding: utf-8 -*-
"""
xccdf.models.notice includes the class Notice
to create or import a <xccdf:notice> element.
This module is part of the xccdf library.
Author: Rodrigo Núñez <rnunezmujica@icloud.com>
"""
# XCCDF
from xccdf.models.html_element import HTMLElement
from xccdf.exceptions import RequiredAttribu... | Dalveen84/xccdf | src/xccdf/models/notice.py | Python | lgpl-3.0 | 1,634 |
from Crypto.Cipher import AES
import base64
mode = AES.MODE_OFB
iv = "\x00" * 16
PYEXFIL_DEFAULT_PASSWORD = base64.b64decode('VEhBVElTQURFQURQQVJST1Qh')
""" START Symmetric stream mode for AES """
def AESEncryptOFB(key, text):
if type(key) == str:
key = bytes(key, 'ascii')
pad_len = (-len(text))... | ytisf/PyExfil | pyexfil/includes/encryption_wrappers.py | Python | mit | 1,543 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.