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, 2007 Canonical
#
# Written by Gustavo Niemeyer <gustavo@niemeyer.net>
#
# This file is part of Storm Object Relational Mapper.
#
# Storm 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 Found... | nwokeo/supysonic | venv/lib/python2.7/site-packages/storm/zope/metaconfigure.py | Python | agpl-3.0 | 1,225 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | named-data-ndnSIM/ns-3-dev | src/internet-apps/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 523,787 |
import os
def find_database(dbname):
cwd = os.getcwd()
while True:
dbpath = os.path.join(cwd,dbname)
if os.path.isfile(dbpath):
return dbpath
nwd = os.path.dirname(cwd)
if (nwd == cwd or not os.path.isdir(nwd)):
return None
cwd = nw... | lionicsheriff/tagi | tagi/tagi.py | Python | mit | 440 |
import pytest
@pytest.mark.bashcomp(cmd="deja-dup")
class TestDejaDup:
@pytest.mark.complete("deja-dup -", require_cmd=True)
def test_1(self, completion):
assert completion
@pytest.mark.complete("deja-dup --help ")
def test_2(self, completion):
assert not completion
| algorythmic/bash-completion | test/t/test_deja_dup.py | Python | gpl-2.0 | 302 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | wooga/airflow | airflow/secrets/metastore.py | Python | apache-2.0 | 1,888 |
from __future__ import with_statement
__license__ = 'GPL 3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
'''
Command line interface to conversion sub-system
'''
import sys, os
from optparse import OptionGroup, Option
from collections import OrderedDict
from calibre... | sharad/calibre | src/calibre/ebooks/conversion/cli.py | Python | gpl-3.0 | 14,226 |
#!/usr/bin/env python
'''
demo using ansible to gen config files
'''
# imports
try:
import ansible
import yaml
except ImportError:
print "Could not import a required module.\n Exiting"
raise SystemExit
# Variables
device_file = 'device_list01.yaml'
def main():
'''
main app
'''
# g... | jlcjunk/pynet_pac | class5/exer01.py | Python | gpl-3.0 | 509 |
"""
polaris.ext.world
~~~~~~~~~~~~~~~~~
:copyright: (c) 2013 Eleme, http://polaris.eleme.io
:license: MIT
The world extension will return country geojson based on name.
This extension is mainly for example demo.
"""
import json
from urllib.request import urlopen
from polaris.ext import Polar... | eleme/polaris | polaris/ext/world.py | Python | mit | 1,296 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | david-ragazzi/nupic | nupic/regions/PictureSensorExplorers/rotate_block.py | Python | gpl-3.0 | 3,079 |
import pygame
import os
import sys
from pygame.locals import *
pygame.init()
def parse_message(message,typeMessage=""):
messageList = []
count = 0
part = ''
for char in message:
if count != 0:
if count > len(typeMessage)-1:
if char == "_" or char == "|":
... | mstubinis/Tic-Tac-Pi | Tic-Tac-Pi/resourceManager.py | Python | mit | 1,449 |
from django.conf.urls.defaults import *
GROUP_URL = r'(?P<slug>[-\w]+)/'
PAGE_URL = r'%spages/(?P<page_slug>[-\w]+)/' % GROUP_URL
TOPIC_URL = r'%stopics/(?P<topic_id>\d+)/' % GROUP_URL
MESSAGE_URL = r'%smessages/(?P<message_id>\d+)/' % TOPIC_URL
urlpatterns = patterns('groups.views.groups',
url(r'^create/$', ... | hzlf/openbroadcast | website/apps/groups/urls.py | Python | gpl-3.0 | 2,547 |
# -*- coding: utf-8 -*-
import datetime as dt
import httplib as http
import urllib
import urlparse
from django.apps import apps
from django.utils import timezone
from django.db.models import Q
import bson.objectid
import itsdangerous
from flask import request
import furl
from weakref import WeakKeyDictionary
from werk... | aaxelb/osf.io | framework/sessions/__init__.py | Python | apache-2.0 | 6,887 |
from django.contrib import admin
from bemtevi.apps.reports.models import TestimonyEntry
class TestimonyEntryModelAdmin(admin.ModelAdmin):
date_hierarchy = 'date'
list_display = ('path', 'testcases', 'automated_testcases',
'manual_testcases', 'no_docstring_testcases', 'date')
list_filte... | elyezer/bem-te-vi | bemtevi/apps/reports/admin.py | Python | gpl-3.0 | 404 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import collections
import struct
import sys
import gdb
import pwndbg.events
import pwndbg.memoize
import pwndbg.memory
import pwndbg.regs
import pwndbg.typeinfo
from capstone import *
current = 'i386'
ptrmask = 0xfffffffff
endian = 'little'
ptrsize = pwndbg.typeinfo.ptr... | bj7/pwndbg | pwndbg/arch.py | Python | mit | 1,242 |
#!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... | sunqm/pyscf | pyscf/pbc/df/rsdf.py | Python | apache-2.0 | 30,824 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations... | vero4karu/port_management | port/migrations/0001_initial.py | Python | mit | 2,622 |
import os
import logging
import json
import math
from aiotg import Bot
from database import db, text_search
greeting = """
✋ Welcome to Telegram Music Catalog! 🎧
We are a community of music fans who are eager to share what we love.
Just send your favourite tracks as audio files and they'll be available for every... | bytecrash/iromoozik | bot/bot.py | Python | mit | 5,275 |
#!/usr/bin/env python
# encoding: utf-8
import sys
import requests
from Naked.settings import debug as DEBUG_FLAG
#------------------------------------------------------------------------------
#[ HTTP class]
# handle HTTP requests
# Uses the requests external library to handle HTTP requests and response object (av... | xmission/d-note | venv/lib/python2.7/site-packages/Naked/toolshed/network.py | Python | agpl-3.0 | 19,525 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "webmath.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| tmwebmath/webmath | manage.py | Python | gpl-2.0 | 250 |
def histograms():
temp = {'DMmass':
{#'column' : 25,
'column' : 12,
'file' : 'DMmass',
'bins' : 20,
'min' : 1.,
'max' : 7000.}
,
'vmax':
{'column' : 28,
'file' : 'vmax',
'bins' : 25... | sniemi/SamPy | sandbox/src2/AnalyseFieldEs.py | Python | bsd-2-clause | 7,757 |
# /usr/bin/env python
'''
Written by Kong Xiaolu and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import os
import numpy as np
import torch
import CBIG_pMFM_basic_functions as fc
def CBIG_mfm_test_desikan_main(gpu_index=0):
'''
This function is to implement the test... | ThomasYeoLab/CBIG | stable_projects/fMRI_dynamics/Kong2021_pMFM/part2_pMFM_control_analysis/Primary_gradients/scripts/CBIG_pMFM_step33_test_GradPC2Grad.py | Python | mit | 4,115 |
import sys
import os
import time
import logging
import tempfile
import subprocess
import _thread
import traceback
import tornado.web
import tornado.ioloop
import tornado.gen
import requests
import psutil
from .ssh import SSHRemoteForward
log = logging.getLogger('curlbomb.server')
class CurlbombBaseRequestHandler(to... | EnigmaCurry/curlbomb | curlbomb/server.py | Python | mit | 9,906 |
#!/usr/bin/env python
#
# Gaze tracking calibration
# - use calibration video heatmap and priors
#
# AUTHOR : Mike Tyszka
# PLACE : Caltech
# DATES : 2014-05-15 JMT From scratch
#
# This file is part of mrgaze.
#
# mrgaze is free software: you can redistribute it and/or modify
# it under the terms of the GNU Ge... | jmtyszka/mrgaze | mrgaze/calibrate.py | Python | mit | 16,369 |
from CGATReport.Tracker import *
from cpgReport import *
##########################################################################
class IntervalsSummary(cpgTracker):
"""Summary stats of intervals called by the peak finder. """
mPattern = "_macs_intervals$"
def __call__(self, track, slice=None):
... | CGATOxford/CGATPipelines | CGATPipelines/pipeline_docs/pipeline_cpg/trackers/macs_intervals.py | Python | mit | 5,417 |
# -*- coding: utf-8 -*-
import collections
import httplib as http
import pytz
from flask import request
from modularodm import Q
from framework.exceptions import HTTPError
from framework.auth.decorators import must_be_logged_in
from framework.auth.utils import privacy_info_handle
from framework.forms.utils import san... | lamdnhan/osf.io | website/project/views/comment.py | Python | apache-2.0 | 8,811 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# updater.py
#
# Copyright 2013 Antergos
#
# 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 you... | Acidburn0zzz/archiso-gui | releng/root-image/usr/share/cnchi/src/updater.py | Python | gpl-3.0 | 5,862 |
from atomicbot.cli import main
def test_main():
assert main([]) == 0
| Amunak/AtomicBot | tests/test_atomicbot.py | Python | gpl-3.0 | 76 |
"""
REFERENCES:
1. https://www.blog.pythonlibrary.org/2016/07/26/python-3-an-intro-to-asyncio/
2. https://github.com/python/asyncio/blob/master/examples/simple_tcp_server.py
3. https://hackernoon.com/asyncio-for-the-working-python-developer-5c468e6e2e8e
4. http://asyncio.readthedocs.io/en/latest/he... | ansin218/p2p-voidphone-nse | code/tcp_connect.py | Python | mit | 3,541 |
import logging
from django.conf import settings
from civil_registry.utils import get_citizen_by_national_id
from libya_elections import constants
from text_messages.utils import get_message
from .models import RegistrationCenter, Registration, SMS
from .utils import remaining_registrations
logger = logging.getLog... | SmartElect/SmartElect | register/processors.py | Python | apache-2.0 | 11,302 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# REF [site] >> https://github.com/lumyjuwon/KoreaNewsCrawler
def naver_news_crawling_example():
from korea_news_crawler.articlecrawler import ArticleCrawler
crawler = ArticleCrawler()
crawler.set_category('정치', 'IT과학', 'economy')
#crawler.set_category('politics', '... | sangwook236/general-development-and-testing | sw_dev/python/ext/test/networking/web_crawling_test.py | Python | gpl-2.0 | 732 |
"""The tests for the Home Assistant API component."""
# pylint: disable=protected-access
import json
from unittest.mock import patch
from aiohttp import web
import pytest
import voluptuous as vol
from homeassistant import const
from homeassistant.bootstrap import DATA_LOGGING
import homeassistant.core as ha
from home... | postlund/home-assistant | tests/components/api/test_init.py | Python | apache-2.0 | 17,840 |
# coding: utf-8
# Copyright 2014 Globo.com Player authors. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
ext_x_targetduration = '#EXT-X-TARGETDURATION'
ext_x_media_sequence = '#EXT-X-MEDIA-SEQUENCE'
ext_x_program_date_time = '#EXT-X-PROGRAM... | mx3L/archivczsk | build/plugin/src/resources/libraries/m3u8/protocol.py | Python | gpl-2.0 | 776 |
#---This is the class part---#
class Arit:
def add(self,a,b):
return a+b
def subs(self,a,b):
return a-b
#---This is the part that uses the class---#
n1=10
n2=4
operation=Arit()
print "The addition is", operation.add(n1,n2)
print "The substraction is", operation.subs(n1,n2)
| ActiveState/code | recipes/Python/572212_Simple_Class/recipe-572212.py | Python | mit | 303 |
import os
def unlink_recursive(dir):
if os.path.isdir(dir):
for file in os.listdir(dir):
file_path = os.path.join(dir, file)
if os.path.isdir(file_path):
unlink_recursive(file_path)
else:
os.unlink(file_path)
os.rmdir(dir)
els... | kudrom/genesis2 | genesis2/utils/filesystem.py | Python | gpl-3.0 | 1,132 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2013 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... | pferreir/indico-backup | bin/utils/getAllCatAccess.py | Python | gpl-3.0 | 1,739 |
#!/us/bin/env python3
'''manage fight'''
class Fight:
def __init__(self, entityOne, entityTwo):
self.entityOne = entityOne
self.entityTwo = entityTwo
def faster(self):
vel_ent1 = self.entityOne.velocity * self.entityOne.lvl
vel_ent2 = self.entityTwo.velocity * self.entityTwo.l... | rmariotti/py_cli_rpg | fight.py | Python | gpl-3.0 | 1,699 |
# -*- coding: utf-8 -*-
"""
Created on Aug 14, 2013
@author: Tyranic-Moron
"""
import random
from CommandInterface import CommandInterface
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
class EightBall(CommandInterface):
triggers = ['8ball', 'eightball']
help = '8ball (... | Heufneutje/PyMoronBot | Commands/EightBall.py | Python | mit | 1,487 |
from itertools import combinations as combinations
from operator import attrgetter
import Player as P
###
class PokerPool(P.Player):
'''Derived class for pool of common cards'''
max_cards = 5
def __init__(self, name):
P.Player.__init__(self, name)
self.hand.max_cards = self.max_cards
###
class PokerHand... | rynecarbone/Pokerly | Game.py | Python | mit | 6,020 |
#
# Copyright 2009
# Greg Swift <gregswift@gmail.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, C... | ralphbean/func-ralphbean-devel | func/minion/modules/disk.py | Python | gpl-2.0 | 2,165 |
# -*- coding: utf-8 -*-
# support.py
# Copyright (C) 2015 LEAP
#
# 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.
#
# Thi... | leapcode/soledad | src/leap/soledad/common/couch/support.py | Python | gpl-3.0 | 3,954 |
""".. Ignore pydocstyle D400.
=======================
Elastic Signal Handlers
=======================
"""
from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver
from guardian.models import GroupObjectPermission, UserObjectPermission
from .builder import index_builder
def ... | jberci/resolwe | resolwe/elastic/signals.py | Python | apache-2.0 | 1,451 |
# flake8: noqa I201
from Child import Child
from Node import Node
DECL_NODES = [
# type-assignment -> '=' type
Node('TypeInitializerClause', kind='Syntax',
children=[
Child('Equal', kind='EqualToken'),
Child('Value', kind='Type'),
]),
# typealias-declaration ->... | tjw/swift | utils/gyb_syntax_support/DeclNodes.py | Python | apache-2.0 | 31,769 |
# -*- coding: utf-8 -*-
"""
adam.domain.common.py
~~~~~~~~~~~~~~~~~~~~~
Commonly used schema and domain definitions.
:copyright: (c) 2015 by Nicola Iarocci and CIR2000.
:license: BSD, see LICENSE for more details.
"""
from collections import namedtuple
SchemaKey = namedtuple('SchemaKey', 'company... | kidaa/adam | adam/domain/common.py | Python | bsd-3-clause | 1,274 |
ISO3166 = [
(_("Afghanistan"), "AF", "AFG"),
(_("Aland Islands"), "AX", "ALA"),
(_("Albania"), "AL", "ALB"),
(_("Algeria"), "DZ", "DZA"),
(_("American Samoa"), "AS", "ASM"),
(_("Andorra"), "AD", "AND"),
(_("Angola"), "AO", "AGO"),
(_("Anguilla"), "AI", "AIA"),
(_("Antarctica"), "AQ", "ATA"),
(_("Antigua and B... | OpenPLi/enigma2 | lib/python/Tools/CountryCodes.py | Python | gpl-2.0 | 8,527 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('firestation', '0052_auto_20170731_1345'),
('weather', '0002_auto_20171003_2229'),
]
operati... | FireCARES/firecares | firecares/weather/migrations/0003_auto_20171004_0852.py | Python | mit | 897 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cherrypy
import htpc
import logging
from htpc.manageusers import Manageusers
from sqlobject import SQLObject, SQLObjectNotFound
from sqlobject.col import StringCol
SESSION_KEY = '_cp_username'
logger = logging.getLogger('authentication')
def check_credentials(us... | scith/htpc-manager_ynh | sources/libs/cherrypy/lib/auth2.py | Python | gpl-3.0 | 4,546 |
# Touchy is Copyright (c) 2009 Chris Radek <chris@timeguy.com>
#
# Touchy 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.
#
# Touchy i... | ianmcmahon/linuxcnc-mirror | src/emc/usr_intf/touchy/filechooser.py | Python | lgpl-2.1 | 3,122 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# 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 L... | iwm911/plaso | plaso/parsers/plist_plugins/airport.py | Python | apache-2.0 | 1,728 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Christophe Benz
#
# This file is part of weboob.
#
# weboob 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 3 of the License, or
# (at yo... | laurentb/weboob | weboob/tools/config/iniconfig.py | Python | lgpl-3.0 | 4,388 |
import re
from django.test import TestCase
from iitgauth.constants import LOGIN_SERVERS
class TestServerList(TestCase):
def test_server_ips(self):
"""
Test for login server IPs to match IP pattern.
:return: None
"""
server_ips = [item[0] for item in LOGIN_SERVERS]
... | narenchoudhary/django-iitg-auth | tests/test_constants.py | Python | bsd-3-clause | 787 |
__author__ = 'Byoungwoo'
import __init__
this={
"currentTime": 0,
"startTime": 0,
"state": "NONE",
}
q = {}
logger = __init__.LoggerFactory.getLogger("fecs.FloodCircumstance")
FloorType = __init__.FloorType
def setParameter(key,val):
if key in this : this[key]=val
def trigger():
engine = __init_... | jcooky/fecs | src/main/scripts/FloodCircumstance.py | Python | gpl-2.0 | 1,833 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the main LMS Dashboard (aka, Student Dashboard).
"""
import six
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.lms.dashboard im... | msegado/edx-platform | common/test/acceptance/tests/lms/test_lms_dashboard.py | Python | agpl-3.0 | 5,727 |
# -*- coding: UTF-8 -*-
# Authors: Thomas Hartmann <thomas.hartmann@th-ht.de>
# Dirk Gütlin <dirk.guetlin@stud.sbg.ac.at>
#
# License: BSD-3-Clause
| bloyl/mne-python | mne/io/fieldtrip/tests/__init__.py | Python | bsd-3-clause | 158 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2016-08-08 00:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20160807_2046'),
]
operations = [
migrations.AlterField(
... | MarconiMediaGroup/JobTrak | web/code/mmg/jobtrak/core/migrations/0005_auto_20160807_2047.py | Python | apache-2.0 | 865 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | stgraber/snapcraft | snapcraft/_options.py | Python | gpl-3.0 | 5,191 |
# -*- coding: utf-8 -*-
#
# Copyright 2015-2019 Gabriel Acosta <acostadariogabriel@gmail.com>
#
# This file is part of Pireal.
#
# Pireal 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... | centaurialpha/pireal | src/pireal/main.py | Python | gpl-3.0 | 3,061 |
#
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Saverio Giallorenzo
# Copyright (c) 2018 Saverio Giallorenzo
#
# License: MIT
#
from SublimeLinter.lint import Linter, util # or NodeLinter, PythonLinter, ComposerLinter, RubyLinter
class Lacheck(Linter):
cmd =... | thesave/SublimeLinter-contrib-lacheck | linter.py | Python | mit | 650 |
import re
def snake_to_camel(snake, upper_first=False):
# title-cased words
words = [word.title() for word in snake.split('_')]
if words and not upper_first:
words[0] = words[0].lower()
return ''.join(words)
def camel_to_snake(camel):
# first upper-cased camel
camel = camel[0].uppe... | jfcherng/sublime-TypeShort | functions.py | Python | mit | 401 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Chris Hoffman <christopher.hoffman@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version ... | chepazzo/ansible-modules-extras | packaging/language/npm.py | Python | gpl-3.0 | 8,565 |
# -*- coding: utf-8 -*-
import pytest
from model.group import Group
from fixture.application import Application
@pytest.fixture
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture
def test_add_group(app):
app.session.login(username="admin", password="secret")... | fleksso99/python_training | test/test_add_group.py | Python | apache-2.0 | 422 |
# -*- Mode:Python; test-case-name:flumotion.test.test_common_eventcalendar -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007,2008 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU... | flyapen/UgFlu | flumotion/common/eventcalendar.py | Python | gpl-2.0 | 23,019 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
from django.contrib.auth.models import User
user, created = User.objects.get_or_create(username='kumbu')
... | praekelt/txtalert | txtalert/apps/cd4/migrations/0003_auto__add_field_cd4record_cd4document__chg_field_cd4record_msisdn__add.py | Python | gpl-3.0 | 6,651 |
#!/usr/bin/env python3
import re
class Sigma:
# definição do alfabeto da língua.
# TODO: Ler esse alfabeto a partir de um arquivo, a fim de tornar o script
# mais flexível.
v = r'[aeiouãõáéóíú]'
c = r'[bcçdfgjklLmnñpqrstvxwyz]'
n = r'[mn]'
L = r'(?P<sil>'
R = r')'
Z = r'(' + ... | shoeki/ling | silabas/silabas.py | Python | gpl-2.0 | 2,326 |
VERSION = 1
NAME = _("Poison")
DESCRIPTION = _("Poison your enemy, causing him to lose HP every turn.")
ABILITY_TYPE = ACTION
COST = 5
TARGET_TYPE = HOSTILE
RANGE = Diamond(1, 5, 16)
AOE = Single()
EFFECTS = [Status(Status.POISON, power=0.03, duration=5)]
| jemofthewest/GalaxyMage | data/core/abilities/poison.py | Python | gpl-2.0 | 265 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# gnetplus -- Python module for interfacing with PROMAG RFID card reader
# Copyright © 2013 Red Hat Inc.
#
# Authors:
#
# Chow Loong Jin <lchow@redhat.com>
# Harish Pillay <hpillay@redhat.com>
#
# Initial release: July 31, 2013
# Minor edits: July 31, 2013: giving an e... | harishpillay/gnetplus | gnetplus.py | Python | lgpl-2.1 | 9,372 |
#!/usr/bin/env python
"""
Developer script to convert yaml periodic table to json format.
Created on Nov 15, 2011
"""
import json
import re
from itertools import product
import ruamel.yaml as yaml
from monty.serialization import dumpfn, loadfn
from pymatgen.core import Element
from pymatgen.core.periodic_table impo... | vorwerkc/pymatgen | dev_scripts/update_pt_data.py | Python | mit | 10,164 |
from time import time
start = time()
sum = 0
for i in range(1, 1001):
sum += i ** i
print(str(sum)[-10:])
end = time()
print(end - start)
| kayson-hansen/Project-Euler | Python/048_self_powers.py | Python | mit | 156 |
# -*- coding: utf-8 -*-
"""
WSGI config for studlan project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ... | CasualGaming/studlan | studlan/wsgi.py | Python | mit | 425 |
import unittest
import requests
class TranslationTests(unittest.TestCase):
def setUp(self):
self.url = 'http://127.0.0.1/api/translate'
def test_given_words(self):
"""Should pass for the basic test cases provided"""
test_words = ['pig', 'banana', 'trash', 'happy', 'duck', 'glove',
... | chrswt/vicarious-microservice | tests/translation.py | Python | mit | 2,992 |
from sqlalchemy import Table, Column, Integer, String
from metadata import metadata
__all__ = ["t_restaurant", "t_menu"]
t_restaurant = Table("t_restaurant", metadata,
Column("FId", Integer, primary_key = True),
Column("FName", String(128)),
Column("FType", Integer),
Column("FAddress", String(128)),
... | peixinchen/TravisCITest | src/togo/models/t_restaurant.py | Python | mit | 644 |
from __future__ import print_function, unicode_literals
import pprint
from django.contrib.auth import authenticate
from django.shortcuts import resolve_url
from django.utils.html import escape
from django_functest import FuncBaseMixin
from wiki import models
from wiki.forms import validate_slug_numbers
from wiki.mode... | cXhristian/django-wiki | tests/core/test_views.py | Python | gpl-3.0 | 17,595 |
#imports
import RPi.GPIO as GPIO
from threading import Thread
import time
#init
print('start')
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.cleanup()
#declaring inputs
buttonLeftSwitch = 17
buttonRightSwitch = 18
buttonGarbageUnit = 21
#declaring outputs
LedBlue = 22 ... | InnovationCentre/CommandCentrePrototypes | prototype_logic.py | Python | gpl-2.0 | 4,694 |
import os
import sys
from subprocess import call
from ci import enum
from ci import prettyprint, COLOR as Color
import ci.jenkins.util as util
TASKS = enum(FILECOPY=1, DIRCOPY=2, FILECREATE=3, \
DIRCREATE=4, USERCREATE=5, PERMISSION=6, DAEMON=7)
class TaskException(Exception):
'''
Basic Exception from task e... | infrared5/dev-ops | continuous-integration/ci/jenkins/task.py | Python | mit | 4,900 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from argparse import Namespace
from idb.cli import ClientCommand
from idb.common.types import Client
class KeychainC... | facebook/FBSimulatorControl | idb/cli/commands/keychain.py | Python | mit | 631 |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... | luogangyi/bcec-nova | nova/volume/encryptors/luks.py | Python | apache-2.0 | 4,355 |
# -*- coding: utf-8 -*-
# Space Syntax Toolkit
# Set of tools for essential space syntax network analysis and results exploration
# -------------------
# begin : 2020-09-10
# copyright : (C) 2020 by Petros Koutsolampros / Space Syntax Ltd.
# author : Petros Koutsolampros
# email... | SpaceGroupUCL/qgisSpaceSyntaxToolkit | esstoolkit/tests/test_rcl_cleaner.py | Python | gpl-3.0 | 10,092 |
__docformat__ = "restructuredtext en"
import mdp
from ica_nodes import ICANode
numx, numx_rand, numx_linalg = mdp.numx, mdp.numx_rand, mdp.numx_linalg
mult = mdp.utils.mult
class JADENode(ICANode):
"""
Perform Independent Component Analysis using the JADE algorithm.
Note that JADE is a batch-algorithm. T... | ME-ICA/me-ica | meica.libs/mdp/nodes/jade.py | Python | lgpl-2.1 | 8,744 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-10-29 11:25
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('base', '0378_auto_20181026_1612'),
]
operations = ... | uclouvain/osis_louvain | base/migrations/0379_auto_20181029_1125.py | Python | agpl-3.0 | 1,428 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | wileeam/airflow | tests/cli/commands/test_sync_perm_command.py | Python | apache-2.0 | 2,470 |
import unittest
import numpy
import chainer
from chainer.backends import cuda
import chainer.functions as F
from chainer import testing
from chainer.testing import attr
from chainer.testing import backend
@testing.parameterize(*(testing.product({
'c_contiguous': [True, False],
'cover_all': [True, False],
... | okuta/chainer | tests/chainer_tests/functions_tests/connection_tests/test_convolution_2d.py | Python | mit | 12,685 |
'''
Distributed under the MIT License, see accompanying file LICENSE.txt
'''
import tornado.gen
import tornadoredis
import tornado.websocket
class LatestSocket(tornado.websocket.WebSocketHandler):
channel = 'block_channel'
@tornado.gen.engine
def open(self):
self.client = tornadoredis.Cl... | NewEconomyMovement/blockexplorer | handlers/SocketHandler.py | Python | mit | 996 |
#! /usr/bin/env python
#
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions ... | danakj/chromium | third_party/protobuf/python/google/protobuf/internal/well_known_types_test.py | Python | bsd-3-clause | 24,651 |
# -*- coding: utf-8 -*-
"""
Tests for auth manager PKI access to postgres.
This is an integration test for QGIS Desktop Auth Manager postgres provider that
checks if QGIS can use a stored auth manager auth configuration to access
a PKI protected postgres.
From build dir, run: ctest -R PyQgsAuthManagerPKIPostgresTest ... | gacarrillor/QGIS | tests/src/python/test_authmanager_pki_postgres.py | Python | gpl-2.0 | 5,746 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# iPhone Application Script
#
import os,sys,shutil
template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
sys.path.append(os.path.join(template_dir,'../'))
from tiapp import *
from projector import *
class IPhone(object):
def __init__(s... | arnaudsj/titanium_mobile | support/iphone/iphone.py | Python | apache-2.0 | 4,434 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/schedule_paged.py | Python | mit | 874 |
class WhitespaceTokenizer(object):
def tokenize(self, text):
return text.split()
| kreuks/liven | nlp/tokenizers/whitespace_tokenizer.py | Python | apache-2.0 | 93 |
# -*- coding: utf-8 -*-
# File: base.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
from abc import ABCMeta, abstractmethod
import signal
import re
from six.moves import range
import tqdm
import tensorflow as tf
from .config import TrainConfig
from ..utils import *
from ..utils.timer import *
from ..utils.concurrency im... | czhu95/ternarynet | tensorpack/train/base.py | Python | apache-2.0 | 6,036 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "expense_track.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| zheli/simple-expense | manage.py | Python | apache-2.0 | 256 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Brainly.com sp. z o.o.
#
# 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
#
# U... | brainly/check-zonesync | setup.py | Python | apache-2.0 | 1,009 |
"""Abstraction of an OF table."""
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2017 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... | byllyfish/faucet | faucet/valve_table.py | Python | apache-2.0 | 5,959 |
"""
Commands for running the examples files in various ways.
Like a Makefile: contains a list of targets (and groups of targets)
that specify various commands to run.
E.g.
topographica -c 'from topo.misc.genexamples import generate; generate(targets=["all_quick","saved_examples"])'
Runs the 'all_quick' target if... | jesuscript/topo-mpi | topo/misc/genexamples.py | Python | bsd-3-clause | 9,221 |
import math
class Solution(object):
def integerBreak(self, n):
"""
:type n: int
:rtype: int
"""
if n < 4:
return n - 1
if n % 3 == 1:
return 3 ** ((n - 4) // 3) * 4
elif n % 3 == 2:
return 3 ** ((n - 2) // 3) * 2
e... | wufangjie/leetcode | 343. Integer Break.py | Python | gpl-3.0 | 1,639 |
import numpy as np
from pytest import fixture, raises, mark
from beyond.errors import UnknownFrameError, UnknownBodyError
from beyond.config import config
from beyond.env.jpl import get_orbit, list_frames, create_frames
from beyond.dates import Date
from beyond.orbits import Orbit
from beyond.utils.units import AU
fr... | galactics/beyond | tests/env/test_jpl.py | Python | mit | 2,196 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM14/CPSM/Equipment/Core/BaseVoltage.py | Python | mit | 3,780 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Mega-DatA-Lab/mxnet | python/mxnet/gluon/model_zoo/__init__.py | Python | apache-2.0 | 891 |
from django.contrib import admin
from Assessment.models import Score, Result, Assignment, AssignmentResponse
# Register your models here.
admin.site.register(Score)
admin.site.register(Result)
admin.site.register(Assignment)
admin.site.register(AssignmentResponse)
| IEEEDTU/CMS | Assessment/admin.py | Python | mit | 266 |
# imei.py - functions for handling International Mobile Equipment Identity
# (IMEI) numbers
#
# Copyright (C) 2010, 2011, 2012, 2013 Arthur de Jong
#
# 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 ... | dchoruzy/python-stdnum | stdnum/imei.py | Python | lgpl-2.1 | 3,467 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import Typed
from openpyxl.descriptors.excel import ExtensionList
from .shapes import GraphicalProperties
from .axis import ChartLines
from .descriptors import... | saukrIppl/seahub | thirdpart/openpyxl-2.3.0-py2.7.egg/openpyxl/chart/updown_bars.py | Python | apache-2.0 | 936 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | davidcusatis/horizon | openstack_dashboard/dashboards/admin/flavors/tests.py | Python | apache-2.0 | 37,408 |
# Copyright 2018 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 agreed to in writing, s... | tseaver/google-cloud-python | oslogin/setup.py | Python | apache-2.0 | 2,716 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.