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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
#Game redevelopment by Guy Mann (guydmann atsign gmail dot com)
#Copyright (C) 2008 Guy Mann
#Game developed by Milad Rastian (miladmovie atsign gmail dot com)
#http://home.gna.org/pyhearts/
#I wrote this Game for course Artificial Intelligent in Yazd Jahad University
#Thanks my teacher Mr Asgh... | guydmann/pynapoleon | Player.py | Python | gpl-2.0 | 43,325 |
# This file is part of MyPaint.
# Copyright (C) 2007-2008 by Martin Renold <martinxyz@gmx.ch>
#
# 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 opt... | kragniz/mypaint | lib/helpers.py | Python | gpl-2.0 | 13,491 |
#!/usr/bin/env python
"""
Copyright 2014 Novartis Institutes for Biomedical Research
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 ... | Novartis/yap | bin/yap_exon_count.py | Python | apache-2.0 | 6,781 |
#
# 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 ... | kwhitehall/climate | rcmet/src/main/python/rcmes/toolkit/metrics_kyo.py | Python | apache-2.0 | 27,959 |
# coding=utf-8
""""
These functions are responsible for evaluate item recommendation algorithms (rankings).
They are used by evaluation/item_recommendation.py
"""
# © 2019. Case Recommender (MIT License)
import numpy as np
__author__ = 'Arthur Fortes <fortes.arthur@gmail.com>'
def precision_at_k(ranking,... | ArthurFortes/CaseRecommender | caserec/evaluation/item_recomendation_functions.py | Python | mit | 2,404 |
"""Echo request message tests."""
from pyof.foundation.basic_types import DPID, HWAddress
from pyof.v0x01.common.phy_port import PhyPort, PortConfig, PortState
from pyof.v0x01.controller2switch.features_reply import FeaturesReply
from tests.unit.test_struct import TestStruct
class TestFeaturesReply(TestStruct):
"... | kytos/python-openflow | tests/unit/v0x01/test_controller2switch/test_features_reply.py | Python | mit | 1,926 |
#!/usr/bin/python
# adapted from: http://www.roman10.net/named-pipe-in-linux-with-a-python-example/
import os
# wPipe = write pipe, rPipe = read pipe
wPipe = "./p1"
rPipe = "./p2"
response = ""
# initialize write value with "1"
w = open(wPipe, 'w')
w.write("1")
w.close()
# enter while loop and wait for value
# whi... | bjh7242/SELinux-Benchmarks | Apipe-switch.py | Python | mit | 586 |
#!/usr/bin/env python3
"""
./e09asynctwostage.py http://camlistore.org 1 6
Found 10 urls
http://camlistore.org/ frequencies: [('camlistore', 13), ...]
...
First integer arg is depth, second is minimum word count.
"""
import re
from sys import argv
import asyncio
from e01extract import canonicalize
from e04twostage... | bslatkin/pycon2014 | e09asynctwostage.py | Python | apache-2.0 | 2,046 |
import mon # noqa
import osd # noqa
| alfredodeza/ceph-deploy | ceph_deploy/util/paths/__init__.py | Python | mit | 36 |
"""
Parser for the entity layer in KAF/NAF
"""
# Modified for KAF NAF adaptation
from lxml import etree
from lxml.objectify import dump
import re
import sys
from .external_references_data import CexternalReferences
from .references_data import Creferences
class Centity:
"""
This class encapsulates the entit... | cltl/KafNafParserPy | KafNafParserPy/entity_data.py | Python | gpl-3.0 | 8,174 |
"""
Defines the Config() class.
Summary: When instantiated, the Config() class provides an object that has as its attributes the properties defined in config.ini. The properties are taken from the section defined when instantiating the class.
Usage: Suppose that we are interested in the [email_service] section... | jdgillespie91/trackerSpend | configs/config.py | Python | mit | 1,289 |
from ec.utils import get
from ec.types.basics import yn
print get('Say something', yn)
| Laufire/ec | scripts/tests/utils.py | Python | bsd-3-clause | 88 |
#!/usr/bin/env python
"""
Project: tossing_money_and_coins_away
Description:
A small program that calculates how long a game played with a fair coin toss can go,
considering the player wins $ 1 for heads and loses $ 1.50 for tails given
a starting amount specified by the user.
It is a solution for... | diegoaurino/numerical_python | tossing_money_and_coins_away/tossing_money_and_coins_away/tossing_money_and_coins_away.py | Python | mit | 1,226 |
# coding=utf-8
import os
import sys
import datetime
import inspect
from teamcity import is_running_under_teamcity
from teamcity.common import is_string, get_class_fullname, convert_error_to_string, dump_test_stdout, FlushingStringIO
from teamcity.messages import TeamcityServiceMessages
from .diff_tools import EqualsAs... | apixandru/intellij-community | python/helpers/pycharm/teamcity/nose_report.py | Python | apache-2.0 | 9,389 |
import git
import re
from djtracker import models
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import NoArgsCommand
from django.contrib.contenttypes.models import ContentType
from django.contrib.comments.models import Comment
from django.contrib.sites.models import Site
from ... | f4nt/djtracker | djtracker/management/commands/git_poller.py | Python | bsd-3-clause | 3,063 |
# eliteBonusLogisticEnergyTransferCapNeed2
#
# Used by:
# Ship: Basilisk
# Ship: Etana
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Remote Capacitor Transmitter",
"capacitorNeed", ship.getModifiedItemAttr("eli... | Ebag333/Pyfa | eos/effects/elitebonuslogisticenergytransfercapneed2.py | Python | gpl-3.0 | 403 |
from django import forms
class LoginForm(forms.Form):
username = forms.CharField(max_length=100, required=True)
password = forms.PasswordInput()
client_id = forms.HiddenInput()
client_token = forms.HiddenInput() | JJStoker/cropr_demo | croplet_demo/croplet/forms.py | Python | mit | 229 |
# This BIF tells you the currenlty active namespace
print('We start off in:', __name__)
if __name__ == '__main__':
print('And end up in:', __name__)
| leroneb/headfirstpython | lerone.source/chap5_6_7_9/webapp/dunder.py | Python | gpl-3.0 | 153 |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as django_auth
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from wirecloud.commons import authentication as wc_auth
admin.autodiscover()
urlpatterns = (
... | jpajuelo/wirecloud | src/wirecloud/commons/conf/catalogue_project_template/project_name/urls.py | Python | agpl-3.0 | 909 |
#!/usr/bin/python
#
# Copyright (c) 2019 Zim Kalinowski, (@zikalino)
#
# 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',
... | thaim/ansible | lib/ansible/modules/cloud/azure/azure_rm_hdinsightcluster.py | Python | mit | 20,172 |
import numpy as np
import nibabel as nib
from dipy.data import fetch_stanford_hardi, read_stanford_hardi, get_sphere
from dipy.reconst.shm import CsaOdfModel, normalize_data
from dipy.reconst.odf import peaks_from_model, gfa, minmax_normalize
fetch_stanford_hardi()
img, gtab = read_stanford_hardi()
data = img.get_dat... | mdesco/dipy | dipy/reconst/tests/csa_odf_example.py | Python | bsd-3-clause | 2,312 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from slugify import slugify
from uuid import uuid4
from django.conf import settings
from django.db import models
from django.db.models.signals import post_delete, post_save
from django.core.urlresolvers import reverse, NoReverseMatch
from djan... | CivilHub/CivilHub | userspace/models.py | Python | gpl-3.0 | 10,357 |
"""The macros below aren't reliable (e.g., some fail if ``arg_string`` is `None`)
or safe (``include`` doesn't guard against circular reference). For a more complete example, see
`the code used in the sandbox <http://code.google.com/p/urlminer/source/browse/examples/wiki/macros.py>`_.
"""
import genshi.builder as... | hprid/creoleparser | creoleparser/test_cheat_sheet_plus.py | Python | mit | 2,923 |
from .exceptions import *
from .magic_methods import _eq, _ne, _setattr, _delattr
class ValueObject(type):
def __call__(self, *args, **kwargs):
self._open_class_for_modification()
self._check_fields_have_value(*args, **kwargs)
self._check_one_value_per_field_provided(*args, **kwargs)
... | alejandrodob/value-objects | value_object/value_object.py | Python | gpl-3.0 | 4,075 |
from dmoj.executors.compiled_executor import CompiledExecutor
class Executor(CompiledExecutor):
ext = 'scm'
name = 'SCM'
command = 'chicken-csc'
command_paths = ['chicken-csc', 'csc']
test_program = '(import chicken.io) (map print (read-lines))'
def get_compile_args(self):
return [sel... | DMOJ/judge | dmoj/executors/SCM.py | Python | agpl-3.0 | 538 |
#! /usr/env python
# Script to demultiplex barcoded full-length isoseq reads into their own
# individual fasta files (barcodes are referred to as primers in the sequence
# files because they are technically custom primers. Will use primer/barcode
# interchangably)
import re
import sys
import os
import argparse
impor... | puapinyoying/IsoSeqScripts | DemultiplexFlncFasta.py | Python | mit | 5,154 |
"""Remote helper class for communicating with juju machines."""
import abc
import logging
import os
import subprocess
import sys
import zlib
import winrm
import utility
import jujupy
__metaclass__ = type
def _remote_for_series(series):
"""Give an appropriate remote class based on machine series."""
if ser... | freyes/juju | acceptancetests/remote.py | Python | agpl-3.0 | 13,166 |
# -*- coding: utf-8 -*-
# This file is part of Tryton & Nereid. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import unittest
import trytond.tests.test_tryton
from trytond.transaction import Transaction
from trytond.tests.test_tryton import POOL, USER, ... | PritishC/nereid | nereid/tests/test_pagination.py | Python | gpl-3.0 | 4,741 |
from trycereal import iter_lines, sort_lines, count_duplicates, escape
filename = "./sample_data.txt"
lines = iter_lines(filename)
lines = escape(lines, '\\', '#')
lines = list(lines)
sort_lines(lines)
dup = count_duplicates(lines)
total = len(lines)
print "{} total lines".format(total)
print "{} duplicate lines".fo... | numberoverzero/trycereal | trycereal/test_trycereal.py | Python | mit | 330 |
#
# CDR-Stats License
# http://www.cdr-stats.org
#
# 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/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The Initial Develope... | cdr-stats/cdr-stats | cdr_stats/voip_billing/models.py | Python | mpl-2.0 | 14,486 |
# Copyright 2003, 2004, 2006 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
# Status: ported (danielw)
# Base revision: 56043
# This module defines the 'alias' rule and associated class.
#
# Alias is just a m... | davehorton/drachtio-server | deps/boost_1_77_0/tools/build/src/build/alias.py | Python | mit | 2,867 |
import libtcodpy as libtcod
class Random(object):
def __init__(self, stream_id):
self.stream_id = stream_id
def get_int(self, *args, **kwargs):
""" rand.get_int([start,] stop) -> random integer
Note the non-standard order of default arguments: if a single argument
is provided,... | narc0tiq/NP-Complete | tcod/__init__.py | Python | mit | 23,740 |
"""A module for threading requests and storing their results.
This module currently provides one class - `RequestInfoThread`. It is meant to help
issue get requests using threading, but avoid creating a new connection to a db for each thread. It does this by storing the results of the get request as an attribute
on t... | sahararaju/dataasservices | scraping-job-portals/ziprecruiter/request_threading.py | Python | apache-2.0 | 3,754 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class ScrapostItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
number = scrapy.Field()
status = s... | cusion/scraPost | scraPost/scraPost/items.py | Python | mit | 391 |
# Copyright 2017 Avoin.Systems
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import report_paperformat_parameter
from . import report_paperformat
from . import report
| OCA/reporting-engine | report_wkhtmltopdf_param/models/__init__.py | Python | agpl-3.0 | 194 |
#!/usr/bin/python
# macgen.py script to generate a MAC address for Virtualization guests
#
import random
#
def randomMAC():
mac = [ 0x00, 0x16, 0x3e,
random.randint(0x00, 0x7f),
random.randint(0x00, 0xff),
random.randint(0x00, 0xff) ]
return ':'.join(map(l... | teejalon/eucalyptus-nchooks | macgen.py | Python | gpl-3.0 | 397 |
#!/usr/bin/env python2
# Copyright (c) 2016 The Bitcredit Core developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcreditTestFramework... | dragosbdi/bitcredit-2.0 | qa/rpc-tests/p2p-feefilter.py | Python | mit | 3,612 |
from django.contrib import admin
from zcms.models import *
class ComponentInline(admin.TabularInline):
model = CMSComponentValue
extra = 1
class CMSComponentAdmin(admin.ModelAdmin):
inlines = [ComponentInline,]
admin.site.register(CMSComponent, CMSComponentAdmin)
class TokenInline(admin.TabularInline... | aquamatt/ZCMS | zcms/admin.py | Python | bsd-3-clause | 1,236 |
#!/usr/bin/env python
print "Content-type: text/html"
print
print """<html><head><title>Test URL Encoding</title></head><body>
<a href="http://localhost:8000/testurlcode.py?first=Jack&last=Trades">Link</a>
</body></html>"""
| djphan/c410-Repo | c410-Lab3-CGI/cgi/testlink.py | Python | gpl-3.0 | 227 |
# -*- coding: utf-8 -*-
# Specto , Unobtrusive event notifier
#
# main.py
#
# See the AUTHORS file for copyright ownership information
# 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; eit... | cappert/specto | spectlib/main.py | Python | gpl-2.0 | 14,998 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | timj/scons | test/CacheDir/source-scanner.py | Python | mit | 2,690 |
from functools import wraps
from django.db import IntegrityError, connections, transaction
from django.test import TestCase, ignore_warnings, skipUnlessDBFeature
from django.test.testcases import TestData
from django.utils.deprecation import RemovedInDjango41Warning
from .models import Car, Person, PossessedCar
cla... | elena/django | tests/test_utils/test_testcase.py | Python | bsd-3-clause | 4,953 |
from datetime import datetime
import numpy as np
import pytest
from pandas import DataFrame, Series
from pandas.core.indexes.datetimes import date_range
from pandas.core.indexes.period import period_range
# The various methods we support
downsample_methods = ['min', 'max', 'first', 'last', 'sum', 'mean', 'sem',
... | MJuddBooth/pandas | pandas/tests/resample/conftest.py | Python | bsd-3-clause | 4,198 |
from Crypto.Cipher import AES
func = AES.new('thisisthegoodkey', AES.MODE_ECB)
msg = 'Nguyen Thac Du11'
cipher = func.encrypt(msg)
print cipher.encode('hex')
print func.decrypt(cipher)
| thacdu/crypto101 | Day02/ebc_mode.py | Python | gpl-2.0 | 186 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime
import json
import pandas
from unittest import TestCase
from .core import serialize, json_encode
df = pandas.DataFrame([
{'a': 1, 'b': 2, 'c': 3, 't': datetime.datetime(2015, 1, 1), 's': 's1'},
{'a': 2, 'b': 4, 'c': 6, 't': datet... | spookylukey/pandas-highcharts | pandas_highcharts/tests.py | Python | mit | 4,925 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...worksheet import Worksheet
class TestWriteSheetProtection(unittest.TestCase):
"... | jkyeung/XlsxWriter | xlsxwriter/test/worksheet/test_write_sheet_protection.py | Python | bsd-2-clause | 8,854 |
# -*- coding: utf-8 -*-
#
# version.py - version of QWeeChat
#
# Copyright (C) 2011-2015 Sébastien Helleu <flashcode@flashtux.org>
#
# This file is part of QWeeChat, a Qt remote GUI for WeeChat.
#
# QWeeChat is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | GeoffMaciolek/qweechat | qweechat/version.py | Python | gpl-3.0 | 890 |
"""Example of the Observer pattern using Pyro.
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from copy import copy
# this import has to be here in case we get a Pyro error from an RMI
import Pyro.errors
from remote_object import RemoteObject, NameServer
class Subject(R... | simontakite/sysadmin | pythonscripts/thinkpython/Subject.py | Python | gpl-2.0 | 2,318 |
from django.conf import settings
def should_use_staticfiles():
return 'django.contrib.staticfiles' in settings.INSTALLED_APPS
| paxnovem/django-mailviews | mailviews/helpers.py | Python | apache-2.0 | 132 |
#MenuTitle: Clear Backgrounds in Selected Layers...
# -*- coding: utf-8 -*-
__doc__="""
Deletes stuff from selected layers and more.
"""
import vanilla
import GlyphsApp
class ClearBackgroundsInSelectedLayers( object ):
def __init__( self ):
# Window 'self.w':
edY = 22
txY = 17
sp = 10
btnX = 160
btnY = 2... | Tosche/Glyphs-Scripts | Clear Backgrounds in Selected Layers.py | Python | apache-2.0 | 3,760 |
# -*- coding: utf-8 -*-
"""
flask.wrappers
~~~~~~~~~~~~~~
Implements the WSGI wrappers (request and response).
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from werkzeug.wrappers import Request as RequestBase, Response as ResponseBase
from w... | jeremydane/Info3180-Project4 | server/lib/flask/wrappers.py | Python | apache-2.0 | 6,893 |
import yaml
from django.core.management.base import BaseCommand, CommandError
from workshops.views import _export_instructors
class Command(BaseCommand):
args = 'no arguments'
help = 'Display YAML for airports.'
def handle(self, *args, **options):
print(yaml.dump(_export_instructors()).rstrip())
| shapiromatron/amy | workshops/management/commands/export_airports.py | Python | mit | 319 |
#!/usr/bin/python
# -*- coding:utf-8 -*-
# Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.
#
# Find all the elements that appear twice in this array.
#
# Could you do it without extra space and in O(n) runtime?
class Solution(object):
def findDuplica... | pandaoknight/leetcode | neo_medium/array/find-all-duplicates-in-an-array/main.py | Python | gpl-2.0 | 1,131 |
#!/usr/bin/python
# Numbers.py
"""
Copyright (C) 2010 Peter Hewitt
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 ... | i5o/numbers | Numbers.py | Python | gpl-2.0 | 17,263 |
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Romain Bignon
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | laurentb/weboob | modules/hds/module.py | Python | lgpl-3.0 | 3,210 |
(S'8e2b709bff3f0c766b79cd4b80999eee'
p1
(ihappydoclib.parseinfo.moduleinfo
ModuleInfo
p2
(dp3
S'_namespaces'
p4
((dp5
S'wxMixin'
p6
(ihappydoclib.parseinfo.classinfo
ClassInfo
p7
(dp8
g4
((dp9
(dp10
S'_drawPoly'
p11
(ihappydoclib.parseinfo.functioninfo
FunctionInfo
p12
(dp13
g4
((dp14
(dp15
tp16
sS'_exception_info'
p17... | tuffery/Frog2 | frowns/Depict/.happydoc.wxMoleculeDrawer.py | Python | gpl-3.0 | 4,024 |
# -*- coding: utf-8 -*-
from ..Node import Node
class UniOpNode(Node):
"""Generic node for performing any operation like Out = In.fn()"""
def __init__(self, name, fn):
self.fn = fn
Node.__init__(self, name, terminals={
'In': {'io': 'in'},
'Out': {'io': 'out', 'bypass': '... | ibressler/pyqtgraph | pyqtgraph/flowchart/library/Operators.py | Python | mit | 2,010 |
# encoding: utf-8
from django import forms
from main.models import *
from django.db import models
from django.forms import ModelForm
class CompanyCreateForm(forms.ModelForm):
class Meta:
model = Company
exclude = []
def __init__(self, *args, **kwargs):
kwargs.setdefault('label_suffix'... | yelbuke/VeMEY | main/forms.py | Python | gpl-2.0 | 6,383 |
""" functions in charge of creating graph objects and populating
them with the requested information"""
import os
import ast
import modulefinder
import networkx
import astunparse
from codeink.atelier import secretary
from codeink.atelier import scientist
from codeink.parchment import peephole
def sketch_blocks(modu... | carocad/CodeInk | codeink/atelier/draftsman.py | Python | apache-2.0 | 8,119 |
from typing import Dict, Union
from merakicommons.cache import lazy_property
from merakicommons.container import searchable
from ...data import Region, Platform
from ..common import CoreData, CassiopeiaGhost, get_latest_version, provide_default_region, ghost_load_on
from ...dto.staticdata import realm as dto
######... | sserrot/champion_relationships | venv/Lib/site-packages/cassiopeia/core/staticdata/languagestrings.py | Python | mit | 2,198 |
# This file is part of Codeface. Codeface 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even... | dauer-afk/codeface | codeface/bugtracker/scraper/generic.py | Python | gpl-2.0 | 2,382 |
from functools import partial
from collections import Counter
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.db.models import TextField
from django.db i... | City-of-Helsinki/kerrokantasi | democracy/admin/__init__.py | Python | mit | 17,148 |
from mockdata import * | alcemirsantos/algorithms-py | src/data_structures/__init__.py | Python | mit | 22 |
from django.test import TestCase
try:
from django.contrib.staticfiles.templatetags.staticfiles import static
except ImportError:
from django.templatetags.static import static
try:
from django.core.urlresolvers import reverse
except ImportError:
from django.urls import reverse
from ..templatetags.adja... | snogaraleal/adjax | adjax/tests/test_templatetags.py | Python | mit | 1,451 |
#-------------------------------------------------------------------------------
# Copyright (C) 2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#--------------------------------------------------... | noslenfa/tdjangorest | uw/lib/python2.7/site-packages/IPython/kernel/inprocess/tests/test_kernel.py | Python | apache-2.0 | 3,193 |
# -*- coding: utf-8 -*-
# pylint: disable=W0201, W0141
"""
Build suite with normal django tests
"""
from django.test.simple import build_suite, build_test
from django.db.models import get_app, get_apps
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django_jenkins.tasks imp... | MiltosD/CEF-ELRC | lib/python2.7/site-packages/django_jenkins/tasks/django_tests.py | Python | bsd-3-clause | 1,196 |
###
# Copyright (c) 2004, James Vega
# 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, a... | kg-bot/SupyBot | plugins/Grasshoppaz/test.py | Python | gpl-3.0 | 3,296 |
#/usr/bin/python
# -*- coding: utf-8 -*-
import time
from pysnmp.proto import errind
from shinken.log import logger
from client import SnmpRuntimeError
def get_snmp_object(snmp_client, cls, subindex):
# print 'get_snmp_object1'
snmp_object = cls()
cls_properties = getattr(cls, 'properties')
try:
... | rednach/krill | shinken/krill/snmp/objects.py | Python | agpl-3.0 | 8,656 |
from math import sin, cos
def gradientni_spust(tocka, gradient, korak):
nova_tocka = list(tocka[:])
for i in range(len(tocka)):
nova_tocka[i] -= gradient[i](*tocka) * korak
return nova_tocka
grad_x = lambda x, y: 2*x + (60*(x - 1)**3)/((x-1)**4 + y**2 + 3)**2 + 2*cos(x*y)*y
grad_y = lambda x, y: (... | KrozekGimVic/machine-learning | Learning/gradient.py | Python | gpl-3.0 | 558 |
# -*- coding: utf-8 -*-
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
class MembersApphook(CMSApp):
name = _("Members Apphook")
app_name = 'members'
def get_urls(self, page=None, language=None, **kwargs):
return [... | allink/allink-apps | members/cms_apps.py | Python | bsd-3-clause | 388 |
from __future__ import print_function
import numpy as np
import time
# Go to the next pick type (in alphabetical order)
def togglePickMode(*args,**kwargs):
curMode=args[0]
availPickModes=sorted([str(key) for key in args[1].keys()])
if curMode in availPickModes:
idx=availPickModes.index(cur... | AndrewReynen/Lazylyst | lazylyst/Plugins/Examples.py | Python | mit | 5,007 |
"""
Events for asyncio
In order for your class to have an event, just use it like so:
class Spam:
egged = Event("The spam has been egged")
To trigger an event, just call it like a method:
>>> Spam().egged(5)
All the positional and keyword arguments get passed to the handlers.
To register an event handler, use ... | astronouth7303/aioevents | aioevents/__init__.py | Python | mit | 3,947 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | tonybaloney/st2contrib | packs/networking_utils/tests/networking_utils_base_test_case.py | Python | apache-2.0 | 1,736 |
# -*- coding: utf-8 -*-
""" VITA Disaster Victim Identification, Models
@author: nursix
@author: khushbu
@see: U{http://eden.sahanafoundation.org/wiki/BluePrintVITA}
"""
module = "dvi"
if deployment_settings.has_module(module):
# ---------------------------------------------------------------------... | ptressel/sahana-eden-madpub | models/dvi.py | Python | mit | 21,985 |
"""
The Python API other app should use to work with Teams feature
"""
import logging
from enum import Enum
from django.db.models import Count, Q
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.stu... | eduNEXT/edx-platform | lms/djangoapps/teams/api.py | Python | agpl-3.0 | 15,642 |
"""RGB color handling."""
# Copyright © 2014 Mikko Ronkainen <firstname@mikkoronkainen.com>
# License: MIT, see the LICENSE file.
import numpy as np
class Color:
def __init__(self, r=0.0, g=0.0, b=0.0, a=1.0):
"""
:param float r: The red channel.
:param float g: The green chann... | mikoro/pymazing | pymazing/color.py | Python | mit | 1,594 |
class Runner(object):
"""{'FVlevel': '2', 'FVinsMax': '3', 'FVboardX': '4', 'FVterrainString': '.X......X......X', 'FVinsMin': '2', 'FVboardY': '4'}"""
def __init__(self, data):
self.data = data
self.level = int(data["FVlevel"])
self.terrain_string = data["FVterrainString"]
self... | SkyZH/memory-dump | Hacker.org/Runner.py | Python | cc0-1.0 | 1,797 |
# -*- Mode: Python; python-indent-offset: 4 -*-
#
# Time-stamp: <2018-02-28 21:06:08 alex>
#
# --------------------------------------------------------------------
# PiProbe
# Copyright (C) 2016-2017 Alexandre Chauvin Hameau <ach@meta-x.org>
#
# This program is free software: you can redistribute it and/or modify
# it... | achauvinhameau/netProbe | net-probe-srv/config/config.py | Python | gpl-3.0 | 14,221 |
"""A script to generate a cloudbuild yaml."""
import os
import yaml
import util
# Add directories for new tests here.
TEST_DIRS = [
'gcp_build_test', 'packages_test', 'packages_lock_test',
'destination_test', 'metadata_test', 'npmrc_test'
]
_TEST_DIR = '/workspace/ftl/node/testdata'
_NODE_BASE = 'gcr.io/gae... | nkubala/runtimes-common | ftl/integration_tests/ftl_node_integration_tests_yaml.py | Python | apache-2.0 | 1,609 |
# -*- coding: utf-8 -*-
#
# jolly_roger documentation build configuration file, created by
# sphinx-quickstart on Sun Feb 17 11:46:20 2013.
#
# 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.
#
#... | ainmosni/jolly_roger | docs/conf.py | Python | bsd-3-clause | 7,755 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, _
from odoo.exceptions import AccessError
class Digest(models.Model):
_inherit = 'digest.digest'
kpi_account_total_revenue = fields.Boolean('Revenue')
kpi_account_total_rev... | ddico/odoo | addons/account/models/digest.py | Python | agpl-3.0 | 1,559 |
"""Checks import order rule in a right case"""
# pylint: disable=unused-import,ungrouped-imports,import-error,no-name-in-module
# Standard imports
import os
from sys import argv
# external imports
import isort
from six import moves
# local_imports
from . import my_package
from .my_package import myClass
| ruchee/vimrc | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/w/wrong_import_order2.py | Python | mit | 310 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.db.models import F
class Migration(migrations.Migration):
dependencies = [
('flows', '0028_populate_flowrun_orgs'),
]
def populate_flowrun_modified_on(apps, schema_editor):
... | reyrodrigues/EU-SMS | temba/flows/migrations/0029_populate_run_modified_on.py | Python | agpl-3.0 | 1,132 |
"""
Component that will help set the level of logging for components.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/logger/
"""
import logging
from collections import OrderedDict
import voluptuous as vol
import homeassistant.helpers.config_validation... | persandstrom/home-assistant | homeassistant/components/logger.py | Python | apache-2.0 | 3,869 |
from __future__ import division
from pyglet.gl import gl, glu
class ModelView(object):
'''
Manage modelview matrix, performing the MVC's 'view' parts of the 'camera'
'''
def __init__(self, camera):
self.camera = camera
def set_identity(self):
gl.glMatrixMode(gl.GL_MO... | tartley/pyweek11-cube | source/view/modelview.py | Python | bsd-3-clause | 682 |
#!/usr/bin/env python
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework 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.or... | alexandrul-ci/robotframework | src/robot/testdoc.py | Python | apache-2.0 | 9,873 |
import sys
def readTab(infile): # read in txt file
with open(infile, 'r') as input_file:
# read in tab-delim text
output = []
for input_line in input_file:
input_line = input_line.strip()
temp = input_line.split('\t')
output.append(temp)
return output
def ... | bornea/APOSTL | Network Tools/toolshed_version/plotForce_EV.py | Python | gpl-2.0 | 11,308 |
import exercise5
import unittest
class TemplateTest(unittest.TestCase):
def setUp(self):
self.input_data = ""
self.expected_output = ""
def _check_run(self):
self.assertEqual(exercise5.run(self.input_data), self.expected_output)
def test_1(self):
self.input_data =... | gonditeniz/cracking-coding-interview | python/chapter1/exercise5_test.py | Python | mit | 521 |
# -*- coding: utf-8 -*-
"""
flaskbb.app
~~~~~~~~~~~~~~~~~~~~
manages the app creation and configuration process
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
import os
import logging
import datetime
import time
from sqlalchemy import event
from sqlalch... | zky001/flaskbb | flaskbb/app.py | Python | bsd-3-clause | 9,546 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import sys
import os
import ast
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from py2cpp.converter import Converter
from py2cpp import cpp
def main(argv):
parser = argparse.ArgumentParser()
parser.add_argument("input", type=arg... | mugwort-rc/py2cpp | tools/cpp_dump.py | Python | gpl-3.0 | 580 |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... | dirkmueller/kiwi | kiwi/tasks/result_bundle.py | Python | gpl-3.0 | 12,198 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-bigquery-migration | samples/generated_samples/bigquerymigration_v2alpha_generated_migration_service_list_migration_workflows_async.py | Python | apache-2.0 | 1,657 |
#
# The Python Imaging Library.
# $Id$
#
# transform wrappers
#
# History:
# 2002-04-08 fl Created
#
# Copyright (c) 2002 by Secret Labs AB
# Copyright (c) 2002 by Fredrik Lundh
#
# See the README file for information on usage and redistribution.
#
from PIL import Image
class Transform(Image.ImageTransformHandler)... | DanteOnline/free-art | venv/lib/python3.4/site-packages/PIL/ImageTransform.py | Python | gpl-3.0 | 2,878 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-17 10:13
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0003_auto_20171017_1108'),
]
operations = [
migrations.RenameField(
... | mansonul/events | project/users/migrations/0004_auto_20171017_1113.py | Python | mit | 435 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'UserExtra.regid'
db.add_column(u'siteup_api_userextra', '... | JoseTomasTocino/SiteUp | web/siteup_api/migrations/0009_auto__add_field_userextra_regid.py | Python | gpl-2.0 | 11,886 |
import mock
import numpy as np
import unittest
from ddt import ddt, data, unpack
from circlesunion import circles
@ddt
class TestCirclesMethods(unittest.TestCase):
def test_create_circles(self):
array = [1, 1, 5, 1.2, 1.7, 8, 1.5, 1, 3]
print circles.create_circles(array)
self.assertItem... | camilasousa/circlesunion | circlesunion/tests/circles_test.py | Python | mit | 2,044 |
#!/usr/bin/env python
"""
The following functions save or load instances of all `Study` types using the Python package `dill`.
"""
from __future__ import division, print_function
import dill
def save(filename, study):
"""
Save an instance of a bayesloop study class to file.
Args:
filename(str): ... | christophmark/bayesloop | bayesloop/fileIO.py | Python | mit | 947 |
import sys
# So we can find the bgui module
sys.path.append('../..')
import bgui
import bge
import time
class MySys(bgui.System):
"""
A subclass to handle our game specific gui
"""
def __init__(self):
# Initialize the system
bgui.System.__init__(self)
self.clear_time = time.time()
self.note_visible = Fa... | Remwrath/bgui | examples/notification/blender_test.py | Python | mit | 3,144 |
import logging
logger = logging.getLogger("modDig")
class ExperimentData:
def __init__(self, cpoints, repeat):
errors = []
self._check_cpoints(cpoints, errors)
self._check_repeat(repeat, errors)
if errors:
for error in errors:
logger.error(error)
... | pablobovina/ModuloDigital | source/experiment_data.py | Python | gpl-3.0 | 1,683 |
"""
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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.
T... | AMOboxTV/AMOBox.LegoBuild | plugin.video.salts/scrapers/movieshd_scraper.py | Python | gpl-2.0 | 3,991 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.