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 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... | openstack/python-neutronclient | neutronclient/client.py | Python | apache-2.0 | 16,747 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-04 13:06
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('team', '0003_auto_20170128_1404'),
]
operations = [
migrations.RemoveField(
... | vollov/lotad | team/migrations/0004_remove_player_active.py | Python | mit | 388 |
#!/usr/bin/python
#######################################################################
#
# Analysing Apache log files to get some general insights about the accessablility of a web application
#
# Author: Ahmed ElShafei [elshafei.ah@gmail.com]
#
# NOTE: consider changing the constants in the conf.py file
#
# Descr... | Aelshafei/a2lr | a2lr.py | Python | apache-2.0 | 21,273 |
import os, errno
from sklearn.externals import joblib
from digoie.conf.storage import __ml_models_dir__
# ML_MODEL_PATH = __root_dir__ + 'classifier/mla/models/'
MODEL_EXT = '.pkl'
def save_model(model_name, clf):
# os.remove(model_name) if os.path.exists(model_name) else None
path = os.path.join(__ml_models... | ZwEin27/digoie-annotation | digoie/core/ml/dataset/model.py | Python | mit | 617 |
from HMMchain import HMMchain
def setUp(self):
self.states = ('AG_rich', 'CT_rich')
self.observations = (0, 1, 2, 3)
self.start_probability = {'AG_rich': 0.6, 'CT_rich': 0.4}
self.transition_probability = {
'AG_rich' : {'AG_rich': 0.8, 'CT_rich': 0.2},
... | edenhuangSH/STA663_Final_Project | linearhmm/test_HMMchain.py | Python | gpl-3.0 | 907 |
#!/usr/bin/env python3
"""docstring"""
import os
import sys
args = sys.argv[1:]
if len(args) != 1:
print('Usage: {} WORD'.format(os.path.basename(sys.argv[0])))
sys.exit(1)
word = args[0]
number = 0
for letter in word:
number += ord(letter)
print('"{}" = "{}"'.format(word, number))
| kyclark/metagenomics-book | python/map/gematria2.py | Python | gpl-3.0 | 301 |
"""
/***************************************************************************
Name : Composer Data Source Selector
Description : Widget for selecting a database table or view that will
be used across the composition by the STDM data labels.
Date : ... | olivierdalang/stdm | ui/composer/composer_data_source.py | Python | gpl-2.0 | 3,563 |
# .\_iso4217a.py
# -*- coding: utf-8 -*-
# PyXB bindings for NM:f9dcf879a5f7be5b1c0f8faa708fbb3a510f2212
# Generated 2015-08-12 15:54:17.336000 by PyXB version 1.2.4 using Python 2.7.0.final.0
# Namespace http://ddex.net/xml/20100121/iso4217a [xmlns:iso4217a]
from __future__ import unicode_literals
import pyxb
import ... | Trax-air/ddexreader | ddexreader/ern312/_iso4217a.py | Python | mit | 20,742 |
#!/usr/bin/env python3
"""Loads an HDF5 file representing Landsat data into a triple store via
SPARQL."""
from argparse import ArgumentParser
from base64 import b64encode
from io import StringIO, BytesIO
from itertools import islice, chain
from dateutil.parser import parse as date_parse
import h5py
import numpy as n... | ANU-Linked-Earth-Data/middleware | batch-demo/import_agdc_data.py | Python | apache-2.0 | 12,109 |
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
for first in range(len(nums)):
for second in range(len(nums)):
if first == second:
continue
... | kiss7night/LeetCode | 004. Two Sum/solution.py | Python | mit | 417 |
from Tkinter import *
import math
from PIL import ImageTk
from enum import Enum
from lib.SenselGestureFramework.sensel_framework_simple import Direction
WHEEL_SIDE = 200.0
SMALL_WHEEL_SIDE = WHEEL_SIDE/5
LINE_L = WHEEL_SIDE*math.sqrt(2)/4
BACK_COLOR = "#97D6FF"
HIGH_COLOR = "#90FF74"
LINE_COLOR = "#FFFFFF"
LINE_WIDTH... | SenselWebDev/SenselWebDeveloper | wheel_menu_framework.py | Python | mit | 3,605 |
# Test cases for Cobbler
#
# Michael DeHaan <mdehaan@redhat.com>
import sys
import unittest
import os
import subprocess
import tempfile
import shutil
import traceback
from cobbler.cexceptions import *
from cobbler import settings
from cobbler import collection_distros
from cobbler import collection_profiles
from c... | brenton/cobbler | tests/tests.py | Python | gpl-2.0 | 37,355 |
# Caesar Cipher
SYMBOLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
MAX_KEY_SIZE = len(SYMBOLS)
def getMode():
while True:
print('Do you wish to encrypt or decrypt a message?')
mode = input().lower()
if mode in ['encrypt', 'e', 'decrypt', 'd']:
return mode
e... | triplefox/2017STDIOGameJam | asweigart/caesar_cipher/cipher.py | Python | mit | 1,452 |
# -*- coding: utf-8 -*-
"""
Created on Feb 14 13:17:15 2015
@author: Alan Yorinks
Copyright (c) 2015 Alan Yorinks All right reserved.
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 ... | MrYsLab/esp4s | esp4s_command_handlers.py | Python | gpl-3.0 | 10,277 |
# 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
# d... | openstack/tempest | tempest/lib/api_schema/response/compute/v2_54/servers.py | Python | apache-2.0 | 2,965 |
# -*- 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):
# Changing field 'Profile.converted_by'
db.alter_column(u'tango_in_blood... | jhud/Tango-In-Blood | tango_in_blood_app/migrations/0002_auto__chg_field_profile_converted_by.py | Python | gpl-3.0 | 4,764 |
# -*- coding: utf-8 -*-
import click
import ndef
from ndeftool.cli import command_processor, dmsg
@click.command(short_help="Change the identifier of the last record.")
@click.argument('name')
@command_processor
def cmd(message, **kwargs):
"""The *identifier* command either changes the current last record's
... | nfcpy/ndeftool | src/ndeftool/commands/IDentifier.py | Python | isc | 902 |
"""Support for SimpliSafe freeze sensor."""
from simplipy.entity import EntityTypes
from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_FAHRENHEIT
from homeassistant.core import callback
from . import SimpliSafeEntity
from .const import DATA_CLIENT, DOMAIN, LOGGER
async def async_setup_entry(hass, entry,... | balloob/home-assistant | homeassistant/components/simplisafe/sensor.py | Python | apache-2.0 | 2,020 |
__author__ = 'Jody Shumaker'
| jshumaker/LoA | utility/__init__.py | Python | mit | 29 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os, subprocess
import sys, traceback
import crypt
print("Kopiere: .my.cnf kann das Passwort und Benutzername von MySQL-Nutzern hinterlegt werden. Achtung: Sicherheitsrisiko!")
cmd1 = os.system("cp my.cnf ~/.my.cnf")
# Update Upgrade
print("Update und Upgrade des Be... | joergre/workshops | LF7/EMail/1Stunde.py | Python | cc0-1.0 | 1,487 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... | kdart/pycopia | core/pycopia/OS/Linux/proc/devices.py | Python | apache-2.0 | 1,668 |
from collections import defaultdict, OrderedDict
from operator import and_
from functools import reduce
import operator
import numpy as np
import gc
import uuid
from scipy.interpolate import interp1d
import sys
sys.path.insert(0, '../')
from timeseries import TimeSeries
import os
import procs
from procs.isax import i... | Planet-Nine/cs207project | tsdb/persistentdb.py | Python | mit | 23,824 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
class Event(models.Model):
# Oracle can have problems with a column named "date"
date = models.DateField(db_column="event_date")
class Parent(models.Model):
name = models.CharField(max_length=128)
class Child(model... | openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/admin_changelist/models.py | Python | apache-2.0 | 2,489 |
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl
#
# 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 u... | maheshcn/memory-usage-from-ldfile | openpyxl/charts/chart.py | Python | gpl-2.0 | 3,792 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from . import account_invoice_refund
# vim:expand... | adhoc-dev/odoo-addons | account_refund_invoice_fix/__init__.py | Python | agpl-3.0 | 373 |
# Natural Language Toolkit: Interface to Theorem Provers
#
# Author: Dan Garrette <dhgarrette@gmail.com>
# Ewan Klein <ewan@inf.ed.ac.uk>
#
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
from nltk.sem.logic import ApplicationExpression, Operator, LogicParser
import tableau
im... | hectormartinez/rougexstem | taln2016/icsisumm-primary-sys34_v1/nltk/nltk-0.9.2/nltk/inference/inference.py | Python | apache-2.0 | 3,449 |
# Copyright 2014: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | yeming233/rally | tests/unit/plugins/openstack/wrappers/test_cinder.py | Python | apache-2.0 | 4,204 |
# Generated by Django 2.2.12 on 2020-05-01 16:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0279_message_recipient_subject_indexes'),
]
operations = [
migrations.AddField(
model_name='userprofile',
... | showell/zulip | zerver/migrations/0280_userprofile_presence_enabled.py | Python | apache-2.0 | 416 |
#***************************************************************************
#* *
#* Copyright (c) 2012 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This pr... | sanguinariojoe/FreeCAD | src/Mod/Start/StartPage/EnableDownload.py | Python | lgpl-2.1 | 1,734 |
"""
This module contains the logic for handling the user specials model in the template
"""
from __future__ import unicode_literals, print_function
import json
import logging.config
from flask import request, jsonify, Blueprint
from flask_login import current_user
from google.appengine.ext import ndb
from handlers.... | aaleotti-unimore/ComicsScraper | views/user_specials.py | Python | apache-2.0 | 2,561 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/models/object_detection/trainer_test.py | Python | bsd-2-clause | 6,635 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tool for automatically creating .nmf files from .nexe/.pexe executables.
As well as creating the nmf file this tool can also fi... | ChromiumWebApps/chromium | native_client_sdk/src/tools/create_nmf.py | Python | bsd-3-clause | 26,299 |
import re
import subprocess
class ArpScraper(object):
# this entire class is obviously full of peril and shame
# ... only tested on Ubuntu 14.04...
# A cursory search for python arp libraries returned immature
# libraries focused on crafting arp packets rather than querying
# known system data, so ... | timfreund/ceph-libvirt-clusterer | cephlvc/network.py | Python | mit | 1,099 |
#!/usr/bin/python
#Audio Tools, a module and set of tools for manipulating audio data
#Copyright (C) 2007-2012 Brian Langenberger
#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... | Excito/audiotools | test/test_formats.py | Python | gpl-2.0 | 272,152 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000210',
version=20140916,
description='BIOMD0000000210 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000210',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/BIOMD0000000210 | setup.py | Python | cc0-1.0 | 377 |
from django.conf.urls import url
from django.contrib import admin
from .views import (
CommentListAPIView,
CommentDetailAPIView,
CommentCreateAPIView,
)
urlpatterns = [
url(r'^$', CommentListAPIView.as_view(), name='list'),
url(r'^create/$', CommentCreateAPIView.as_view(), name='create'),
... | timle1/try_django_1_10 | comments/api/urls.py | Python | mit | 459 |
from django.core.management.base import BaseCommand, CommandError
from moderation.lists.poll import poll_lists_members
class Command(BaseCommand):
help = ("Poll lists of Twitter account, download their members, "
"update UserModerationRelationship table")
def handle(self, *args, **options):
... | jeromecc/doctoctocbot | src/moderation/management/commands/poll_lists_members.py | Python | mpl-2.0 | 424 |
import pickle
import numpy as np
import scipy.stats
from abc import ABCMeta, abstractmethod
class KeypressEventReceiver(object):
'''A class that receives keypress events through a callback'''
__metaclass__=ABCMeta
KEY_DOWN, KEY_UP= 0, 1
@abstractmethod
def on_key(self, key, event_type, time_ms... | 4905ab/Keystroke_Dynamics_Accidentally_Kangaroo | Windows/#outed/core.py | Python | gpl-3.0 | 7,100 |
# -*- coding: utf-8 -*-
import re
import socket
import struct
import sys
from os import makedirs
from os.path import exists, join
from select import select
from time import time
from module.plugins.Hoster import Hoster
from module.utils import save_join
class Xdcc(Hoster):
__name__ = "Xdcc"
__type__ ... | immenz/pyload | module/plugins/hoster/Xdcc.py | Python | gpl-3.0 | 6,756 |
import datetime
import collections
import boto3
cloudtrail = boto3.client('cloudtrail')
def lambda_handler(event, context):
account_id = event['account_id']
time_discovered = event['time_discovered']
username = event['username']
deleted_key = event['deleted_key']
exposed_location = event['exposed... | robperc/Trusted-Advisor-Tools | ExposedAccessKeys/lambda_functions/lookup_cloudtrail_events.py | Python | apache-2.0 | 3,195 |
import json
import os
import re
from website.settings import GITHUB_API_TOKEN
from subprocess import check_output
GIT_LOGS_FILE = os.path.join('website', 'static', 'built', 'git_logs.json')
GIT_STATUS_FILE = os.path.join('website', 'static', 'built', 'git_branch.txt')
def gather_pr_data(current_branch='develop', mas... | jnayak1/osf.io | scripts/meta/gatherer.py | Python | apache-2.0 | 2,201 |
# -*- coding: utf-8 -*-
import json
import os
import time
import urllib.request
from pyload.core.network.http.http_request import FormFile
from pyload.core.utils import parse
from ..base.downloader import BaseDownloader
from ..helpers import exists
class LinksnappyComTorrent(BaseDownloader):
__name__ = "Linksn... | vuolter/pyload | src/pyload/plugins/downloaders/LinksnappyComTorrent.py | Python | agpl-3.0 | 7,604 |
import csv
import datetime
import logging
import re
from io import StringIO
from urllib.parse import urljoin, urlparse
import pymongo
from bson.son import SON
from celery.task import Task, task
from django.conf import settings
from django.core.mail import EmailMessage
from django.db.models import Q
from django.utils.h... | edx-solutions/api-integration | edx_solutions_api_integration/tasks/get_assets_with_incorrect_urls.py | Python | agpl-3.0 | 9,506 |
from brightness_vars import *
from models import *
from step_algorithms import *
from chain_generators import *
| HIPS/firefly-monte-carlo | flymc/__init__.py | Python | mit | 112 |
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import LaserScan
def callback(data):
# Option 1) Conform data to specified input/output ranges
# data.ranges = [data.range_max if range_val>data.range_max else (data.range_min if range_val<data.range_min else range_val) for range_val in data.ranges]
... | chrisl8/ArloBot | arlobot_ros/scripts/laser_filter.py | Python | mit | 1,311 |
from . import test_stock_orderpoint_move_link
| OCA/stock-logistics-warehouse | stock_orderpoint_move_link/tests/__init__.py | Python | agpl-3.0 | 46 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | tedi3231/openerp | openerp/addons/base/ir/workflow/workflow.py | Python | agpl-3.0 | 8,979 |
from haystack import indexes
from haystack import site
from dinette.models import Ftopics, Reply, DinetteUserProfile
class TopicIndex(indexes.SearchIndex):
text = indexes.CharField(document=True, use_template=True)
subject = indexes.CharField(model_attr="subject")
message = indexes.CharField(model_attr="_... | agiliq/Dinette | dinette/search_indexes.py | Python | bsd-3-clause | 922 |
# -*- coding: utf-8 -*-
from django.dispatch import Signal
post_ondelta_signal = Signal(providing_args=['fields_changed', 'instance'])
| adamhaney/django-ondelta | ondelta/signals.py | Python | mit | 136 |
#!/usr/bin/env python
"""
A simple script for making random passwords, WITHOUT 1,l,O,0. Because
those characters are hard to tell the difference between in some fonts.
"""
#Import Modules
import sys
from random import Random
rng = Random()
righthand = '23456qwertasdfgzxcvbQWERTASDFGZXCVB'
lefthand = '789yuiophjknm... | ActiveState/code | recipes/Python/473852_Password_Generator/recipe-473852.py | Python | mit | 929 |
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2010 Task Coach developers <developers@taskcoach.org>
Task Coach 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
... | wdmchaft/taskcoach | tests/unittests/guiTests/CategoryEditorTest.py | Python | gpl-3.0 | 5,369 |
# -*- coding: utf-8 -*-
from south.db import db
from django.db import models
from cms.models import *
import datetime
class Migration:
def forwards(self, orm):
# Adding field 'Title.meta_keywords'
db.add_column('cms_title', 'meta_keywords', models.CharField(_("keywords"), max_length=2... | team-xue/xue | xue/cms/migrations/0009_added_meta_fields.py | Python | bsd-3-clause | 7,114 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import os,shlex,shutil,traceback,errno,sys,stat
from waflib import Utils,Configure,Logs,Options,ConfigSet,Context,Errors,Build,Node
build_dir_override=None
no_climb_com... | bit-trade-one/SoundModuleAP | lib-src/lv2/sratom/waflib/Scripting.py | Python | gpl-2.0 | 10,970 |
import os
from errno import EEXIST, EPERM
from unittest import TestCase
from mock import Mock, patch
from pulp.server.content.storage import mkdir, ContentStorage, FileStorage, SharedStorage
class TestMkdir(TestCase):
@patch('os.makedirs')
def test_succeeded(self, _mkdir):
path = 'path-123'
... | mibanescu/pulp | server/test/unit/server/content/test_storage.py | Python | gpl-2.0 | 8,916 |
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | cernops/keystone | keystone/tests/unit/test_v3_identity.py | Python | apache-2.0 | 37,174 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, unittest
test_records = frappe.get_test_records('Fiscal Year')
test_ignore = ["Company"]
class TestFiscalYear(unittest.TestCase):
def... | ESS-LLP/erpnext-medical | erpnext/accounts/doctype/fiscal_year/test_fiscal_year.py | Python | gpl-3.0 | 700 |
from kapteyn import maputils
import numpy
from service import *
fignum = 6
fig = plt.figure(figsize=figsize)
frame = fig.add_axes(plotbox)
title = r"Stereographic projection (STG) diverges at $\theta=-90^\circ$. (Cal. fig.9)"
header = {'NAXIS' : 2, 'NAXIS1': 100, 'NAXIS2': 80,
'CTYPE1' : 'RA---STG',
... | kapteyn-astro/kapteyn | doc/source/EXAMPLES/allskyf6.py | Python | bsd-3-clause | 1,138 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0f38a0.py | Python | mit | 4,160 |
from __future__ import unicode_literals
import boto3
import boto.rds
import boto.vpc
from boto.exception import BotoServerError
import sure # noqa
from moto import mock_ec2_deprecated, mock_rds_deprecated, mock_rds
from tests.helpers import disable_on_py3
@mock_rds_deprecated
def test_create_database():
conn =... | william-richard/moto | tests/test_rds/test_rds.py | Python | apache-2.0 | 11,441 |
#!/usr/bin/env python
from __future__ import print_function
import rospy
import time, threading
from std_msgs.msg import String
from ros_status_cli.srv import *
NODE_NAME="dummy_node"
class DummyNode(object):
def periodic_publish(self):
self.pub.publish("test")
threading.Timer(0.01, self.period... | team-diana/ros_status_cli | test/rostest/dummy_node.py | Python | mit | 1,898 |
#-*- coding: UTF-8
import re
splitter = re.compile(
ur'([,\.!\?:;\s\n\t])'
, re.UNICODE)
def tokenize(string):
'''Split string to words'''
return [
item.strip() for item in splitter.split(string) if len(item.strip()) > 0
]
if __name__ == '__main__':
import unittest
class TokenizerTest(unittest.TestCase... | trunk/littlebrother | littlebrother/ident/utils.py | Python | mit | 594 |
from pathlib import Path
from typing import Union
from ..base import ParametrizedValue
from ..utils import listify
class HookAction(ParametrizedValue):
pass
class ActionMount(HookAction):
"""Mount or unmount filesystems.
Examples:
* Mount: proc none /proc
* Unmount: /proc
"""
... | idlesign/uwsgiconf | uwsgiconf/options/main_process_actions.py | Python | bsd-3-clause | 4,593 |
"""CommMessages API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class CommMessagesAPI(BaseCanvasAPI):
"""CommMessages API Version 1.0."... | tylerclair/py3canvas | py3canvas/apis/comm_messages.py | Python | mit | 7,448 |
from awards.forms import AwardForm
from awards.models import JudgeAllowance
from awards.models import Award
from challenges.decorators import judge_required
from challenges.models import Submission
from django.contrib import messages
from django.http import Http404, HttpResponseRedirect
from django.views.decorators.htt... | mozilla/mozilla-ignite | apps/awards/views.py | Python | bsd-3-clause | 2,471 |
from __future__ import unicode_literals
import os
from django.conf import settings
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.geoip import GeoIP, GeoIPException
from django.utils import unittest
from django.utils import six
# Note: Requires use of both the GeoIP country and city dataset... | azurestandard/django | django/contrib/gis/geoip/tests.py | Python | bsd-3-clause | 4,742 |
# Copyright 2015-2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Account Due List Aging Comment",
"version": "14.0.1.0.0",
"category": "Generic Modules/Payment",
"author": "Eficent," "Odoo Community Association (OCA),... | OCA/account-payment | account_due_list_aging_comment/__manifest__.py | Python | agpl-3.0 | 539 |
#!/usr/bin/env python
traindat = '../data/fm_train_byte.dat'
testdat = '../data/fm_test_byte.dat'
parameter_list=[[traindat,testdat],[traindat,testdat]]
def kernel_linear_byte (train_fname=traindat,test_fname=testdat):
from shogun import LinearKernel, ByteFeatures, CSVFile
feats_train=ByteFeatures(CSVFile(train_fn... | cfjhallgren/shogun | examples/undocumented/python/kernel_linear_byte.py | Python | gpl-3.0 | 634 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from django.utils.translation import activate
from django.conf import settings
from core.models import Declaration, Person, Company
from core.importers.company import CompanyImporter
from core.importers... | dchaplinsky/pep.org.ua | pepdb/tasks/management/commands/apply_beneficiaries.py | Python | mit | 9,604 |
# -*- coding: utf-8 -*-
import opster
import macspoof
spoof_options = [
('a', 'airport', False, 'treat interface as airport card'),
]
@opster.command(usage='INTERFACE <mac>', options=spoof_options)
def spoof(interface, mac=None, **opts):
"""spoofs mac address of given interface
"""
if interface in macspoof... | kennethreitz-archive/macspoof | macspoof/cli.py | Python | mit | 696 |
import traceback
from sanic.log import log
HOST = '127.0.0.1'
PORT = 42101
class SanicTestClient:
def __init__(self, app):
self.app = app
async def _local_request(self, method, uri, cookies=None, *args, **kwargs):
import aiohttp
if uri.startswith(('http:', 'https:', 'ftp:', 'ftps://... | jrocketfingers/sanic | sanic/testing.py | Python | mit | 3,419 |
import sys
import numpy as np
import matplotlib.pyplot as plt
from codim1.core import *
from codim1.assembly import *
from codim1.fast_lib import *
from codim1.post import *
import codim1.core.tools as tools
x_pts = 30
y_pts = 30
n_elements = 40
degree = 1
quad_min = degree + 1
quad_max = 3 * degree
quad_logr = 3 * d... | tbenthompson/codim1 | examples/dislocation.py | Python | mit | 3,530 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2009,2010,2011,2012,2013,2014,2015 Contributor
#
# 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... | guillaume-philippon/aquilon | lib/aquilon/worker/commands/search_machine.py | Python | apache-2.0 | 7,348 |
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^admin/', include(admin.site.urls)),
(r'^sentry/', include('sentry.urls')),
)
urlpatterns += patterns('django.views.generic.simple',
(r'^$', 'direct_to_template', {'template': 'site... | tmitchell/django-watchdog | urls.py | Python | bsd-3-clause | 336 |
import logging
import struct
_LOGGER = logging.getLogger(__name__)
typical_types = {
0x11: {
"desc": "T11: ON/OFF Digital Output with Timer Option", "size": 1,
"name": "Switch Timer",
"state_desc": { 0x00: "off",
0x01: "on"}
},
... | maoterodapena/pysouliss | souliss/Typicals.py | Python | mit | 9,295 |
#!/usr/bin/env python
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2016 NIWA
#
# 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 yo... | benfitzpatrick/cylc | lib/parsec/util.py | Python | gpl-3.0 | 9,720 |
"""Support for IHC devices."""
import logging
import os.path
from defusedxml import ElementTree
from ihcsdk.ihccontroller import IHCController
import voluptuous as vol
from homeassistant.components.binary_sensor import DEVICE_CLASSES_SCHEMA
from homeassistant.config import load_yaml_config_file
from homeassistant.con... | aronsky/home-assistant | homeassistant/components/ihc/__init__.py | Python | apache-2.0 | 12,995 |
"""
Custom-written pure go meterpreter/reverse_https stager.
Module built by @b00stfr3ak44
"""
from modules.common import shellcode
from modules.common import helpers
from random import randint
class Payload:
def __init__(self):
# required options
self.description = "pure windows/meterpreter... | jorik041/Veil-Evasion | modules/payloads/go/meterpreter/rev_https.py | Python | gpl-3.0 | 5,164 |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 03 15:39:01 2014
@author: FábioPhillip
"""
#!/usr/bin/python
# coding: utf-8
import facebook
import urllib
import urlparse
import subprocess
import warnings
# Hide deprecation warnings. The facebook module isn't that up-to-date (facebook.GraphAPIError).
warnings.filter... | Topicos-3-2014/friendlyadvice | tentativaFacebookToken.py | Python | epl-1.0 | 1,977 |
# -*- coding: utf-8 -*-
import collections
import json
import bleach
def strip_html(unclean, tags=None):
"""Sanitize a string, removing (as opposed to escaping) HTML tags
:param unclean: A string to be stripped of HTML tags
:return: stripped string
:rtype: str
"""
if not tags:
tags ... | crcresearch/osf.io | website/util/sanitize.py | Python | apache-2.0 | 4,413 |
# -*- coding: utf-8 -*-
from base_writer import BaseWriter
class LuaWriter(BaseWriter):
def begin_write(self):
super(LuaWriter, self).begin_write()
self.output("module(...)", "\n\n")
def write_sheet(self, name, sheet):
self.write_value(name, sheet)
if name == "main_sheet":
self.write_value("main_length... | youlanhai/ExcelToCode | xl2code/writers/lua_writer.py | Python | mit | 2,039 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/bcftools/package.py | Python | lgpl-2.1 | 2,053 |
import os.path
def settingConfig():
settings = dict()
settings['template_path'] = os.path.join(os.path.dirname(__file__), 'template')
settings['static_path'] = os.path.join(os.path.dirname(__file__), 'static')
settings['cookie_secret'] = '0g+Z/5RWQQSS4WL8wyyHvTtfkybuNU1Vr4luVE/Szvg='
settings['xsr... | initiali/webrasp | settings.py | Python | apache-2.0 | 360 |
"""**Tests for map creation in QGIS plugin.**
"""
__author__ = 'Tim Sutton <tim@linfiniti.com>'
__revision__ = '$Format:%H$'
__date__ = '01/11/2010'
__license__ = "GPL"
__copyright__ = 'Copyright 2012, Australia Indonesia Facility for '
__copyright__ += 'Disaster Reduction'
import unittest
from unittest import expec... | gijs/inasafe | safe_qgis/test_map.py | Python | gpl-3.0 | 9,289 |
from django.contrib import admin
from systems.models import Machine, Environment
admin.site.register(Machine)
admin.site.register(Environment) | akvo/butler | butler/systems/admin.py | Python | agpl-3.0 | 143 |
from django.contrib import admin
from django.forms import widgets
from django.contrib import messages
from django.shortcuts import redirect
from .models import Backend, Embed
from .forms import EmbedForm
from .admin_forms import EmbedFormPreview
class BackendAdmin(admin.ModelAdmin):
list_display = ['name', 'rege... | armstrong/armstrong.apps.embeds | armstrong/apps/embeds/admin.py | Python | apache-2.0 | 2,509 |
#
# 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 us... | darionyaphet/spark | python/pyspark/tests/test_taskcontext.py | Python | apache-2.0 | 12,677 |
#!/usr/bin/python
from lxml import etree
import sys
import re
def promote(el):
# snips el out of parent, creates it as a sibling of parent under container, and
# creates a new copy of parent with type="split" to contain all trailing content
# of parent after el. may be called repeatedly. returns the ne... | clovis/PhiloLogic4 | extras/utilities/fix_drama.py | Python | gpl-3.0 | 3,165 |
import cPickle
import nz_houses_dao as dao
from nltk.corpus import stopwords
import re
import gzip
class Residential:
distionary
def
def __init__():
pass
def generate_word_lists(descriptions):
descriptions_features = {}
i = 0
for listingId in descriptions.keys():
a = descriptions[listingId... | statX/nz-houses | analysis/listing_text.py | Python | bsd-2-clause | 1,824 |
# Copyright The PyTorch Lightning team.
#
# 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 i... | williamFalcon/pytorch-lightning | pytorch_lightning/profiler/pytorch.py | Python | apache-2.0 | 20,415 |
from django.conf.urls import patterns, include, url
urlpatterns = [
url(r'^all/', 'article.views.articles'),
url(r'^get/(?P<article_id>\d+)/$', 'article.views.article'),
url(r'^language/(?P<language>[a-z\-]+)/$', 'article.views.language'),
]
| TheProphet007/BLOG-Django- | article/urls.py | Python | gpl-3.0 | 248 |
"""
TransferFns: accept and modify a 2d array
$Id$
"""
__version__='$Revision$'
import numpy
import param
class TransferFn(param.Parameterized):
"""
Function object to modify a matrix in place, e.g. for normalization.
Used for transforming an array of intermediate results into a
final version, by ... | ioam/svn-history | imagen/transferfn.py | Python | bsd-3-clause | 4,774 |
import unittest
from decimal import Decimal
from importasol.entorno import EntornoSOL
from fields import TestFile
from importasol.db.contasol import APU, Asiento
from StringIO import StringIO
class TestEntorno(unittest.TestCase):
def test_entorno(self):
e = EntornoSOL()
f1 = TestFile()
e.b... | telenieko/importasol | tests/entorno.py | Python | bsd-3-clause | 1,729 |
# Copyright 2014
# The Cloudscaling Group, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | stackforge/ec2-api | ec2api/api/vpn_connection.py | Python | apache-2.0 | 21,863 |
# Samba-specific bits for optparse
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
#
# 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... | yasoob/PythonRSSReader | venv/lib/python2.7/dist-packages/samba/getopt.py | Python | mit | 9,947 |
#Team changer develop by pedrxd.
__version__ = '0.1'
__author__ = 'pedrxd'
import b3
import b3.events
import b3.plugin
import time
class TeamchangerPlugin(b3.plugin.Plugin):
requiresConfigFile = False
def setTeam(self, client, team):
self.console.write('forceteam %s %s' % (client.cid, team))
d... | pedrxd/TeamChanger-b3 | extplugins/teamchanger.py | Python | gpl-3.0 | 2,557 |
import os
from datetime import datetime
from django.test import SimpleTestCase
from django.utils import html, safestring
from django.utils.encoding import force_text
from django.utils.functional import lazystr
class TestUtilsHtml(SimpleTestCase):
def check_output(self, function, value, output=None):
"""... | twz915/django | tests/utils_tests/test_html.py | Python | bsd-3-clause | 9,021 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 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.apac... | kickstandproject/wildcard | wildcard/openstack/common/local.py | Python | apache-2.0 | 1,722 |
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c) 2017 Merantix GmbH
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and... | merantix/picasso | picasso/interfaces/rest.py | Python | epl-1.0 | 6,191 |
# -*- coding: utf-8 -*-
""" Test printing of scalar types.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import TestCase, run_module_suite, assert_
class A(object):
pass
class B(A, np.float64):
pass
class C(B):
pass
class D(C, B):
pass
c... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/numpy/core/tests/test_scalarinherit.py | Python | mit | 771 |
"""
GDB extension that adds Cython support.
"""
from __future__ import print_function
try:
input = raw_input
except NameError:
pass
import sys
import textwrap
import traceback
import functools
import itertools
import collections
import gdb
try: # python 2
UNICODE = unicode
BYTES = str
except NameE... | fabianrost84/cython | Cython/Debugger/libcython.py | Python | apache-2.0 | 44,948 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.