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 |
|---|---|---|---|---|---|
"""
The effect of badly referencing an ellipse
------------------------------------------
This example demonstrates the effect of referencing your data to an incorrect
ellipse.
First we define two coordinate systems - one using the World Geodetic System
established in 1984 and the other using a spherical globe. Next ... | pelson/cartopy | lib/cartopy/examples/effects_of_the_ellipse.py | Python | lgpl-3.0 | 4,935 |
#!/usr/bin/env python
import sys
import numpy as np
import scipy
from scipy import misc
fileNameList = sys.argv[1]
fileList = open(fileNameList, "r")
maxH = 0
maxW = 0
minH = 90000
minW = 90000
count = 0
sumw = 0
sumh = 0
for fileName in fileList:
Z = misc.imread(fileName.rstrip('\n'))
h, w , c = Z.shape
if h... | dquinteros/sscaThesis | tools/biggestImg.py | Python | mit | 562 |
"""
This file contains all entrance exam related utils/logic.
"""
from django.conf import settings
from courseware.access import has_access
from courseware.model_data import FieldDataCache
from courseware.models import StudentModule
from opaque_keys.edx.keys import UsageKey
from student.models import EntranceExamConfi... | tiagochiavericosta/edx-platform | lms/djangoapps/courseware/entrance_exams.py | Python | agpl-3.0 | 6,545 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | base/models/proposal_learning_unit.py | Python | agpl-3.0 | 5,763 |
"""Errors thrown by stomp.py connections.
"""
class StompException(Exception):
"""
Common exception class. All specific stomp.py exceptions are subclasses
of StompException, allowing the library user to catch all current and
future library exceptions.
"""
class ConnectionClosedException(StompExc... | jasonrbriggs/stomp.py | stomp/exception.py | Python | apache-2.0 | 859 |
#!/usr/bin/env python
#
# Copyright 2014 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.
# pylint: disable=C0301
"""Package resources into an apk.
See https://android.googlesource.com/platform/tools/base/+/master/legacy/a... | chrisdickinson/nojs | build/android/gyp/package_resources.py | Python | bsd-3-clause | 15,569 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2017-01-13 03:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('aluno', '0002_auto_20170112_2324'),
]
operations = [
migrations.AlterField(... | dparaujo/projeto | app_administrativo/aluno/migrations/0003_auto_20170113_0011.py | Python | gpl-3.0 | 524 |
#!/usr/bin/python
#
# Copyright 2008 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | kdlucas/pyrering | lib/baserunner_test.py | Python | apache-2.0 | 10,873 |
import os,sys,math,pdb,filecmp,logging,argparse,subprocess
from argparse import RawTextHelpFormatter
import time
import numpy as np
import imp
retry_count=3
# Check if OpenCV library is available
# Abort further execution if image handling is required
cv2_flag = True
try:
imp.find_module("cv2")
except:
print "WARN... | vinutah/apps | tools/vulfi/master/scripts/driver.py | Python | gpl-3.0 | 20,628 |
#!/usr/bin/env python
"""
Translate lists of space separated integers (magnitude less than 62) and print
as strings of alphanumeric characters. This is useful mainly for some machine
learning algorithms that only take string input.
usage: %prog < int_seqs > strings
"""
from itertools import *
import sys
table = "... | uhjish/bx-python | scripts/int_seqs_to_char_strings.py | Python | mit | 661 |
import pytest
from mitmproxy.contentviews import xml_html
from . import full_eval
datadir = "mitmproxy/contentviews/test_xml_html_data/"
def test_simple(tdata):
v = full_eval(xml_html.ViewXmlHtml())
assert v(b"foo") == ('XML', [[('text', 'foo')]])
assert v(b"<html></html>") == ('HTML', [[('text', '<html... | mitmproxy/mitmproxy | test/mitmproxy/contentviews/test_xml_html.py | Python | mit | 1,479 |
# -*- coding: utf-8 -*-
#
# This file is part of couchapp released under the Apache 2 license.
# See the NOTICE for more information.
from __future__ import with_statement
import base64
import logging
import mimetypes
import os
import os.path
import re
import urlparse
import webbrowser
from copy import copy
from ite... | couchapp/couchapp | couchapp/localdoc.py | Python | apache-2.0 | 18,812 |
# -*- coding: utf-8 -*-
#
# colormaps documentation build configuration file, created by
# sphinx-quickstart on Thu Feb 28 09:44:34 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.
#
# A... | ajdawson/colormaps | doc/conf.py | Python | mit | 8,038 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Isaku Yamahata <yamahata at private email ne jp>
# <yamahata at valinux co jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with... | sajuptpm/neutron-ipam | neutron/plugins/ryu/ryu_neutron_plugin.py | Python | apache-2.0 | 11,854 |
from graphics import *
def main():
win = GraphWin("My Circle", 100, 100)
c = Circle(Point(50,50), 10)
c.draw(win)
win.getMouse() # Pause to view result
win.close() # Close window when done
main() | strommer/Python_rpi | exp.py | Python | gpl-2.0 | 229 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Environment_CreatorDialog
A QGIS plugin
inizializzal'ambiente dimmasgis
-------------------
begin : 2012-06-05
copyright... | arpho/mmasgis5 | Environment_Creator/environment_creatordialog.py | Python | mit | 1,482 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2014 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... | paour/weblate | weblate/trans/tests/test_util.py | Python | gpl-3.0 | 1,033 |
"""Unit tests for resource_cache."""
import shutil
import tempfile
import unittest
from pathlib import Path
from pudl.workspace import resource_cache
from pudl.workspace.resource_cache import PudlResourceKey
class TestLocalFileCache(unittest.TestCase):
"""Unit tests for the LocalFileCache class."""
def setU... | catalyst-cooperative/pudl | test/unit/workspace/resource_cache_test.py | Python | mit | 7,838 |
# proxy module
from __future__ import absolute_import
from enable.wx.cairo import *
| enthought/etsproxy | enthought/enable/wx/cairo.py | Python | bsd-3-clause | 84 |
#!/usr/bin/python
#Copyright (C) 2012 Gabriel I Dain <contact@petitionaustralia.com>
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any late... | gabrieldain/Petitioner | cgi-bin/get_link.py | Python | gpl-3.0 | 3,272 |
import httplib
import sys
import unittest
import urlparse
try:
import json
except:
import simplejson as json
from libcloud.common.cloudstack import CloudStackConnection, CloudStackResponse
from libcloud.common.types import MalformedResponseError
from test import MockHttpTestCase
async_delay = 0
class Cloud... | ninefold/libcloud | test/common/test_cloudstack.py | Python | apache-2.0 | 6,174 |
"""
URL utils
"""
import re
import sys
from urllib.parse import urlparse, urlunparse
import salt.utils.data
import salt.utils.path
import salt.utils.platform
import salt.utils.versions
def parse(url):
"""
Parse a salt:// URL; return the path and a possible saltenv query.
"""
if not url.startswith("... | saltstack/salt | salt/utils/url.py | Python | apache-2.0 | 5,081 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0020_auto_20150323_1457'),
]
operations = [
migrations.AddField(
model_name='user',
name='pr... | azavea/nyc-trees | src/nyc_trees/apps/core/migrations/0021_auto_20150408_1216.py | Python | agpl-3.0 | 660 |
#
# This file is part of the LibreOffice project.
#
# 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/.
#
# This file incorporates work covered by the following license noti... | lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/wizards/common/Properties.py | Python | lgpl-3.0 | 1,961 |
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module that contains meta-logic related to Cros Commands.
This module contains two important definitions used by all commands.
CrosCommand: The... | bpsinc-native/src_third_party_chromite | cros/__init__.py | Python | bsd-3-clause | 2,609 |
# coding=utf-8
import pytest
from pathlib import Path
@pytest.mark.integration
def test_work_directory():
path = Path('.').resolve()
print()
print('work dir:', path)
def test_data_directory(data_directory):
print()
print('data_directory:', data_directory)
def test_neo4j_test_ws_dir(neo4j_test... | ashapochka/saapy | tests/test_workspace.py | Python | apache-2.0 | 393 |
__author__ = "István Miklós Antal"
__copyright__ = "Copyright (C) 2015 István Miklós Antal"
__license__ = "GPLv2"
__version__ = "1.0"
from Infrastructure import Infrastructure | istvan-antal/blueprint | __init__.py | Python | gpl-2.0 | 180 |
from core.himesis import Himesis
import uuid
class Hlayer0rule7(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule layer0rule7.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(Hlayer0rule7, self).__init__(name='Hlayer0rule7', num_nodes=0, edg... | levilucio/SyVOLT | mbeddr2C_MM/transformation_from_mps/Hlayer0rule7.py | Python | mit | 3,442 |
import multiprocessing.pool as mp_pool
import functools
import time
import random
def f(x, a, b):
span = random.randint(1, 3)
time.sleep(span)
return sum(i * x + b for i in a)
if __name__ == '__main__':
with mp_pool.Pool(processes=10) as pool:
a = list(range(10))
b = 1... | DavideCanton/Python3 | provemt/prova_par.py | Python | gpl-3.0 | 511 |
#same data added after line 120
import spacy
from spacy.pipeline import EntityRecognizer
from spacy.gold import GoldParse
from spacy.tagger import Tagger
import random
model_name='en_core_web_sm'
#model_name = 'en'
entity_label1 = 'CHECKBOX'
entity_label2 = 'GROUPBOX'
entity_label3 = 'COLLAPSIBLEBOX'
entity_label4 = ... | dulajsan/nlp_nltk | spacyTrain/guiTrain.py | Python | gpl-3.0 | 27,314 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Recipes.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... | ADKosm/Recipes | Recipes/manage.py | Python | mit | 805 |
import errno
from os.path import join, expanduser
from paramiko.config import SSHConfig
from fabric import Config
from fabric.util import get_local_user
from mock import patch, call
from _util import support
class Config_:
def defaults_to_merger_of_global_defaults(self):
# I.e. our global_defaults + I... | fabric/fabric | tests/config.py | Python | bsd-2-clause | 7,669 |
# Input Arguments
# 1) user : 'darren'
# 2) project : 'test_Ca'
# 3) genome : 'Candida_albicans_SC5314_etc'
# 4) main_dir : '/home/bermanj/shared/links/'
# 5) logName :
#
# Process input files:
# 1) Raw SNP data : $workingDir"users/"$user"/projects/"$project"/SNP_CNV_v1.txt".
# 2) FASTA ... | darrenabbey/ymap | scripts_seqModules/scripts_ddRADseq/dataset_process_for_SNP_analysis.ddRADseq.py | Python | mit | 26,818 |
__author__ = "Scott Nottingham"
| nottings/python-megacli | __init__.py | Python | mit | 32 |
#!/usr/bin/env python
from os import environ, path, chdir
import sys
import shutil
# change to manage.py's folder
abspath = path.abspath(__file__)
dname = path.dirname(abspath)
chdir(dname)
if __name__ == "__main__":
from bptbx import b_iotools
environ.setdefault("DJANGO_SETTINGS_MODULE", "pyntrest_project... | BastiTee/pyntrest | manage.py | Python | gpl-3.0 | 1,516 |
from netbench.pattern_match import sym_char, sym_char_class
from netbench.pattern_match import pcre_parser
from netbench.pattern_match.b_automaton import b_Automaton
from netbench.pattern_match.nfa_data import nfa_data
#from netbench.pattern_match.b_dfa import b_dfa
from phf_dfa import PHF_DFA
#FileName= "../../rules/... | vhavlena/appreal | netbench/pattern_match/algorithms/phf_dfa/SaveAutomaton.py | Python | gpl-2.0 | 1,538 |
from sqlalchemy import Column, Integer, ForeignKey, Unicode, DateTime, Boolean, UnicodeText
from sqlalchemy.orm import relationship
from .base import Base
from .user import User # noqa
class Query(Base):
__tablename__ = 'query'
id = Column(Integer, primary_key=True)
user_id = Column(Integer, ForeignKey(... | wikimedia/analytics-quarry-web | quarry/web/models/query.py | Python | mit | 1,527 |
# coding: utf-8
from __future__ import unicode_literals
import asyncore
import email
import os
import shutil
import smtpd
import sys
import tempfile
import threading
from django.core import mail
from django.core.mail import (EmailMessage, mail_admins, mail_managers,
EmailMultiAlternatives, send_mail, send_mas... | makinacorpus/django | tests/mail/tests.py | Python | bsd-3-clause | 35,289 |
"""empty message
Revision ID: c9db57e4805c
Revises: b5ae9c8c6118
Create Date: 2017-06-28 18:11:42.685920
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c9db57e4805c'
down_revision = 'b5ae9c8c6118'
branch_labels = None
depends_on = None
def upgrade():
# ... | ahoarfrost/metaseek | server/migrations/versions/c9db57e4805c_.py | Python | mit | 934 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__="Scott Hendrickson"
__license__="Simplified BSD"
import unittest
from acscsv import *
class TestAcsCSV(unittest.TestCase):
"""Unit tests ofr common CSV utility functions"""
def setUp(self):
pass
def tearDown(self):
pass
def t... | DrSkippy/Gnacs | acscsv/test_acscsv.py | Python | bsd-2-clause | 968 |
# -*- coding: utf-8 -*-
from module.plugins.internal.OCR import OCR
class NetloadIn(OCR):
__name__ = "NetloadIn"
__type__ = "ocr"
__version__ = "0.16"
__status__ = "testing"
__description__ = """Netload.in ocr plugin"""
__license__ = "GPLv3"
__authors__ = [("pyLoad Team", "admin@pyload.o... | rlindner81/pyload | module/plugins/captcha/NetloadIn.py | Python | gpl-3.0 | 653 |
import os
import shutil
import stat
import subprocess
import contextlib
try:
import pwd
import grp
except ImportError:
pass # pwd,grp modules not available on Windows
from visidata import Column, Sheet, LazyComputeRow, asynccache, BaseSheet, vd
from visidata import Path, ENTER, date, asyncthread, FileExist... | saulpw/visidata | visidata/shell.py | Python | gpl-3.0 | 9,069 |
"""Module to ease interaction with MongoDB."""
import argparse
import collections
import datetime
import inspect
import itertools
import json
import logging
import os
import re
import sys
import time
import typing
from typing import Any, Callable, Dict, Iterable, Iterator, List, Mapping, NoReturn, Optional, \
Set,... | bayesimpact/bob-emploi | data_analysis/lib/mongo.py | Python | gpl-3.0 | 19,921 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Nicira Networks, 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.apac... | kaiweifan/neutron | neutron/agent/l3_agent.py | Python | apache-2.0 | 36,438 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_12_01/operations/_express_route_circuit_authorizations_operations.py | Python | mit | 22,515 |
from base64 import b64encode
from pwn import *
with open('attack.bc', 'rb') as f:
content = f.read()
con = remote('172.29.14.24', 9999)
con.recvuntil("Please input your b64-encoded bitcode:")
con.sendline(b64encode(content))
con.interactive()
| Qwaz/solved-hacking-problem | XCTF/2019 Finals/simplepass/solver.py | Python | gpl-2.0 | 249 |
import pandas as pd
import codecs
from os.path import splitext
from pandas import read_csv
from collections import defaultdict
import re
from pymystem3 import Mystem
# dependenies to the dsl nlp repository
from nlp.common import wc
from nlp.patterns import re_numbers
_mystem = Mystem()
def get_pos(text):
pos = ... | nlpub/russe-evaluation | russe/common.py | Python | mit | 8,514 |
# Copyright 2018 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... | sarvex/tensorflow | tensorflow/python/tpu/tpu_embedding.py | Python | apache-2.0 | 122,068 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-23 21:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('product', '0004_auto_20170323_1749'),
]
operations = [
migrations.AlterFiel... | rodrigocnascimento/django-teste | product/migrations/0005_auto_20170323_1816.py | Python | mit | 462 |
from setuptools import setup, find_packages
setup(
name='panya-banner',
version='0.0.5',
description='Panya banner app.',
long_description = open('README.rst', 'r').read(),
author='Praekelt Foundation',
author_email='dev@praekelt.com',
license='BSD',
url='http://github.com/praekelt/pany... | praekelt/panya-banner | setup.py | Python | bsd-3-clause | 836 |
# -*- coding: utf-8 -*-
#
# SpiceGUI
# Copyright (C) 2014-2015 Rafael Bailón-Ruiz <rafaelbailon@ieee.org>
#
# 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
# ... | rafael1193/spicegui | spicegui/add_simulation_gui.py | Python | gpl-3.0 | 7,993 |
"""
Author: Lloyd Moore <lloyd@workharderplayharder.com>
Usage:
print perm("01", 2)
> ["00", "01", "10", "11"]
print perm("abcd", 2)
> [ 'aa', 'ab', 'ac', 'ad',
'ba', 'bb', 'bc', 'bd',
'ca', 'cb', 'cc', 'cd',
'da', 'db', 'dc', 'dd' ]
"""
def perm(chars, m, wrd="", wrds=[]):
if len(wrd) == m: return... | ActiveState/code | recipes/Python/577031_Simple_Permutations/recipe-577031.py | Python | mit | 464 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
from meridian.acupoints import shangyang12
from meridian.acupoints import erjian41
from meridian.acupoints import sanjian11
from meridian.acupoints import hegu23
from meridian.acupoints import yangxi21
from meridian.acupoints import pianli14
from mer... | sinotradition/meridian | meridian/channels/largeintestine.py | Python | apache-2.0 | 1,075 |
'''
The blacklist resolution module is a module which implements a blacklist of ip addresses which will not recive answer
'''
from swandns.modules import BaseResolvingModule
from swandns.swan_errors.exceptions import SWAN_ConfigurationError,SWAN_StopProcessingRequest,SWAN_DropAnswer
import ipcalc
class BlackListRes... | tpotlog/swan-dns | swandns/modules/blacklist.py | Python | mit | 3,395 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.contrib.gis.db.models.fields
class Migration(migrations.Migration):
dependencies = [
('routes', '0008_remove_aquaticroute_states'),
]
operations = [
migrations.AlterFie... | ibamacsr/routes_registry_api | routes_registry_api/routes/migrations/0009_auto_20150318_1005.py | Python | agpl-3.0 | 789 |
from __future__ import absolute_import
from .spi_eeprom import SPIEEPROM
| cfelton/rhea | rhea/models/spi/__init__.py | Python | mit | 75 |
# -*- coding: utf-8 -*-
"""
debug.py - Functions to aid in debugging
Copyright 2010 Luke Campagnola
Distributed under MIT/X11 license. See license.txt for more infomation.
"""
import sys, traceback, time, gc, re, types, weakref, inspect, os, cProfile
import ptime
from numpy import ndarray
from Qt import QtCore, QtGu... | robertsj/poropy | pyqtgraph/debug.py | Python | mit | 29,860 |
import numpy as np
import matplotlib.pyplot as plt
import abel
# This example performs a BASEX transform of a simple 1D Gaussian function and compares
# this to the analytical inverse Abel transform
fig, ax= plt.subplots(1,1)
plt.title('Abel tranforms of a gaussian function')
# Analytical inverse Abel:
n = 101
r_m... | DanHickstein/pyBASEX | examples/example_basex_gaussian.py | Python | gpl-2.0 | 971 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class WorkflowDocumentState(Document):
pass | indautgrp/frappe | frappe/workflow/doctype/workflow_document_state/workflow_document_state.py | Python | mit | 244 |
from django.conf import settings
from django.utils.importlib import import_module
from django.utils.module_loading import module_has_submodule
for app in settings.INSTALLED_APPS:
if '.' not in app:
continue
mod = import_module(app)
try:
import_module('%s.internal_urls' % app)
except:
... | ddanier/django_internal_urls | django_internal_urls/autoload.py | Python | bsd-3-clause | 393 |
# -*- coding: utf-8 -*-
from odoo import models, fields
import logging
_logger = logging.getLogger(__name__)
class ProductTemplate(models.Model):
_inherit = 'product.template'
analytic_account_id = fields.Many2one(
'account.analytic.account',
string='Default Analytic Account',
defa... | wtaferner/odoo-addons | account_product_analytic/models/product.py | Python | agpl-3.0 | 581 |
def markov():
import markovify
from sample import sample_from_file
from scrape import remove_emoji
sample = filter_headlines(sample_from_file())['headlines']
#markov_lines = remove_emoji('\n'.join(sample))
markov_lines = '\n'.join(sample)
text_model = markovify.NewlineText(markov_lines)
... | kkjdroid/NewsChain | markov.py | Python | gpl-3.0 | 669 |
# https://github.com/Ignas/nose_xunitmp/blob/master/nose_xunitmp.py
"""This plugin provides test results in the standard XUnit XML format."""
import multiprocessing
import codecs
from nose.plugins.base import Plugin
from nose.plugins.xunit import Xunit
from nose.pyversion import force_unicode
class XunitMP(Xunit):
... | sjsafranek/GeoSkeletonServer | tests/selenium_tests/nose_xunitmp.py | Python | mit | 3,346 |
'''
Created on 2014-6-7
@author: xiajie
'''
import numpy as np
def convertfunc(x):
if x == 'Present':
return 1.
else:
return 0.
def loaddata():
inputs = np.genfromtxt('SAheart.data', delimiter=',', converters={5:convertfunc}, skip_header=1, dtype=float, usecols=(1,2,3,5,7,8,9))
output... | jayshonzs/ESL | LinearClassification/SAHeart_data.py | Python | mit | 516 |
# BEGIN_COPYRIGHT
#
# Copyright 2009-2015 CRS4.
#
# 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 agree... | ilveroluca/pydoop | test/mapreduce/test_text_stream.py | Python | apache-2.0 | 2,212 |
from typing import Optional, Sequence
from scrubadub.filth import Filth
from scrubadub.post_processors.catalogue import register_post_processor
from scrubadub.post_processors.base import PostProcessor
class PrefixSuffixReplacer(PostProcessor):
"""Add a prefix and/or suffix to the Filth's replacement string.
... | datascopeanalytics/scrubadub | scrubadub/post_processors/prefix_suffix.py | Python | mit | 2,652 |
#!/usr/bin/env python
# TinyArchive - A tiny web archive
# Copyright (C) 2012 David Triendl
#
# 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 opti... | ArchiveTeam/tinyarchive | twitter_spritzer_import.py | Python | gpl-3.0 | 7,952 |
# -*- coding: utf-8 -*-
'''
Created on Mar 13, 2012
@author: moloch
Copyright 2012 Root the Box
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/licen... | Richard-West/RootTheBox | handlers/StaticFileHandler.py | Python | apache-2.0 | 2,151 |
from blueman.bluez.Base import Base
from gi.repository import GLib
class AgentManager(Base):
_interface_name = 'org.bluez.AgentManager1'
_obj_path = '/org/bluez'
def __init__(self) -> None:
super().__init__(obj_path=self._obj_path)
def register_agent(self, agent_path: str, capability: str = ... | blueman-project/blueman | blueman/bluez/AgentManager.py | Python | gpl-3.0 | 760 |
"""
[fTerm] file.py
This module defines all of the standard file operations of fTerm.
"""
# NOTE: this is extraneous
# pylint: disable=C0103,C0303
synonyms = {
"display":"read",
"write":"edit",
"compose":"edit",
"revise":"edit",
"append":"addline",
"removeline":"removeline",
}
def read... | fTerm/fTerm | lib/file.py | Python | gpl-3.0 | 962 |
"""Document path related helpers."""
import os
from os import path
from typing import TYPE_CHECKING
from fava.helpers import FavaAPIException
if TYPE_CHECKING:
from fava.core import FavaLedger
def is_document_or_import_file(filename: str, ledger: "FavaLedger") -> bool:
"""Check whether the filename is a doc... | aumayr/beancount-web | src/fava/core/documents.py | Python | mit | 1,949 |
#!/usr/bin/env python
import sys
from coverage import coverage
from optparse import OptionParser
from django.conf import settings
from oscar import get_core_apps
if not settings.configured:
from oscar.defaults import *
extra_settings = {}
for key, value in locals().items():
if key.startswith('OSCA... | django-oscar/django-oscar-gocardless | run_tests.py | Python | bsd-3-clause | 2,599 |
# -*- coding: utf-8 -*-
"""Tests for the alarms module."""
from __future__ import unicode_literals
from soco.alarms import is_valid_recurrence
def test_recurrence():
for recur in ('DAILY', 'WEEKDAYS', 'WEEKENDS', 'ONCE'):
assert is_valid_recurrence(recur)
assert is_valid_recurrence('ON_1')
asse... | dundeemt/SoCo | tests/test_alarms.py | Python | mit | 536 |
#! /usr/bin/env python
# PURPOSE: creates a state machine that is the repeated version of the
# given one. this means, that the success state is linked to the
# start state.
import sys
from copy import deepcopy
sys.path.append("../")
from core import *
import sequentialize
def do(the_state_machine... | grit-engine/grit-engine | dependencies/quex-0.34.1/quex/core_engine/state_machine/repeat.py | Python | mit | 4,397 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import locale
from django.utils.dateparse import parse_datetime
from robot.api import logger
import sqlite3
import datetime
FORMAT = "%Y-%m-%d %H:%M:%S.%f"
def format_longdate(date):
locale.setlocale(locale.LC_TIME, 'fr_FR.UTF-8')
return '%s %s' % (date.day, dat... | garthylou/Libreosteo | tests/core/keywords/utils.py | Python | gpl-3.0 | 1,828 |
# coding: utf-8
import os
from os.path import basename
from PIL import Image as PILImage
from py2docx.document import DOCUMENT_PATH
from py2docx.util import Unit
class Image(object):
def __init__(self, image_path, document, align=None,
width='100%', height='100%'):
self.image = open(imag... | rafaels88/py2docx | py2docx/elements/image.py | Python | mit | 5,118 |
'''
The geoid library was adopted by Tobias Lohner from RTKLIB under the
following license:
The RTKLIB software package is distributed under the following BSD 2-clause
license (http://opensource.org/licenses/BSD-2-Clause) and additional two
exclusive clauses. Users are permitted to develop, produce or sell their own
... | TobiasLohner/SkyLines | skylines/lib/geoid.py | Python | agpl-3.0 | 2,998 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from .views import CurrentUserView
urlpatterns = [
url(r'^me$', CurrentUserView.as_view(), name='me')
]
| locarise/locarise-drf-oauth2-support | locarise_drf_oauth2_support/users/urls.py | Python | mit | 169 |
from django.conf.urls import url
from . import views
app_name = 'signals'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^process/$', views.process, name='process'),
url(r'^file_process_status/$', views.file_process_status,
name='file_process_status'),
url(r'^get_graph/$', views.... | yayoiukai/signalserver | signals/urls.py | Python | mit | 541 |
from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = 'Dueling Analogs'
language = 'en'
url = 'http://www.duelinganalogs.com/'
start_date = '2005-11-17'
rights = 'Steve Napierski'
class Crawler(CrawlerBase):
history_c... | klette/comics | comics/comics/duelinganalogs.py | Python | agpl-3.0 | 671 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Functions for converting between color spaces.
The "central" color space in this module is RGB, more specifically the linear
sRGB color space using D65 as a white-point [1]_. This represents a
standard monitor (w/o gamma correction). For a good FAQ on color spaces see... | vighneshbirodkar/scikit-image | skimage/color/colorconv.py | Python | bsd-3-clause | 49,532 |
# -*- coding: utf-8 -*-
""" Setup file to create executables and distribute the source code of this application. Don't forget this file! """
############################################################
# Copyright (c) 2014 José Manuel Delicado Alcolea <jmdaweb@gmail.com>
# Copyright (c) 2013, 2014 Manuel Eduardo... | codeofdusk/ProjectMagenta | src/setup.py | Python | gpl-2.0 | 4,476 |
from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(Owner)
admin.site.register(Lead)
admin.site.register(Account)
admin.site.register(AccountLocation)
admin.site.register(Note)
admin.site.register(Attachment)
admin.site.register(Contact)
admin.site.register(Opportun... | akshayub/crm-sample | objects/admin.py | Python | mit | 440 |
# Reaktoro is a unified framework for modeling chemically reactive systems.
#
# Copyright (C) 2014-2018 Allan Leal
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 o... | Reaktoro/Reaktoro | demos/python/demo-equilibrium-fixed-alkalinity.py | Python | gpl-3.0 | 1,270 |
from django.contrib import messages
from django.contrib.auth.decorators import (
login_required,
permission_required,
)
from django.contrib.auth.models import User
from django.shortcuts import (
get_object_or_404,
redirect,
render,
)
from django.views.decorators.http import require_POST
from submit... | OpenFurry/submitify | submitify/views/calls.py | Python | mit | 6,940 |
from django.contrib import admin
from quotations import models
class AuthorAdmin(admin.ModelAdmin):
search_fields = ['name']
class QuotationAdmin(admin.ModelAdmin):
search_fields = ['text', 'author__name']
admin.site.register(models.Author, AuthorAdmin)
admin.site.register(models.Quotation, QuotationAdmi... | jessamynsmith/socialjusticebingo | quotations/admin.py | Python | mit | 323 |
#!/usr/bin python
# -*- coding: utf-8 -*-
"""
Given a collection of candidate numbers (C) and a target number (T),
find all unique combinations in C where the candidate numbers sums to T.
Each number in C may only be used once in the combination.
http://oj.leetcode.com/problems/combination-sum-ii/
"""
class Solution:... | ytjia/coding-practice | algorithms/python/leetcode/CombinationSum2.py | Python | mit | 2,277 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-09-22 14:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization_projects', '0012_projecttopicpage'),
]
operations = [
migration... | Ircam-Web/mezzanine-organization | organization/projects/migrations/0013_auto_20160922_1633.py | Python | agpl-3.0 | 745 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class BunsenscrapperPipeline(object):
def process_item(self, item, spider):
return item
| Iktwo/bunsen-scrapper | bunsenscrapper/pipelines.py | Python | unlicense | 294 |
#
# Plot.py -- Plotting widget canvas wrapper.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
from matplotlib.backends.backend_agg import FigureCanvasAgg \
as Fi... | rupak0577/ginga | ginga/aggw/Plot.py | Python | bsd-3-clause | 765 |
from interactive import InteractiveModule, UserModule
from viewer import ViewerConstants
from screen import Screen
from viewport import Viewport
from colon_line import ColonLine
from state import State
from client import Client
import log
import curses
log = log.logger
class GM(InteractiveModule, UserModule):
de... | jghibiki/Cursed | terminal/gm.py | Python | mit | 5,265 |
import urlparse, requests, json
import datetime
def to_releases(list):
if list:
return [Release(r) for r in list ]
return []
def to_sections(list):
if list:
return [ Section(s) for s in list ]
return []
class Releases:
def __init__(self, url='https://api.pre.im/v1.0/',... | bcowdery/supybot-predb-plugin | lib/pre.py | Python | mit | 7,783 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the Affero GNU General Public License as published by
# the Software Foundation; either version 3, or (at your option) any later
# version.
#
# This program is distributed in the hope... | reingart/openerp_pyfiscalprinter | fiscal_invoice.py | Python | agpl-3.0 | 13,620 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Justin Santa Barbara
# 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.apach... | zestrada/nova-cs498cc | nova/virt/driver.py | Python | apache-2.0 | 38,973 |
import csv
import os
import re
import sys
import zipfile
from national_voter_file.transformers.base import (DATA_DIR,
BasePreparer,
BaseTransformer)
import usaddress
__all__ = ['default_file', 'StatePreparer', 'Stat... | national-voter-file/national-voter-file | src/python/national_voter_file/us_states/pa/transformer.py | Python | mit | 14,261 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000345',
version=20140916,
description='BIOMD0000000345 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000345',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/BIOMD0000000345 | setup.py | Python | cc0-1.0 | 377 |
# -*- coding: utf-8 -*-
__author__ = 'Mehmet Öztürk'
import wx
from wx.lib.wordwrap import wordwrap
import sqlmap
class Info(wx.AboutDialogInfo):
def __init__(self, window):
wx.AboutDialogInfo.__init__(self)
self.Name = 'wxSqlmap'
self.Version = '0.1'
self.Copyright = 'Copyright ... | serhed/wxsqlmap | wxsqlm/lib/about.py | Python | gpl-2.0 | 1,094 |
"""Taoni URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | LunacyZeus/Tao-ni | web/Taoni/Taoni/urls.py | Python | gpl-3.0 | 874 |
from zope import interface
class INode(interface.Interface):
""" Node interface """
name = interface.Attribute("Node name")
port = interface.Attribute("Node listen port")
dispatcher = interface.Attribute("Dispatcher remote ref")
monitor = interface.Attribute("heartbeat monitor")
builder = inte... | selfsk/nodeset.core | src/nodeset/core/interfaces/nodes.py | Python | mit | 2,315 |
# -*- coding: utf-8 -*-
from plugin_text.content_text import ContentText
from plugin_ckeditor import CKEditor
from gluon import Field, IS_NOT_EMPTY
from gluon.tools import PluginManager
if False:
from gluon import current
response = current.response
request = current.request
T = current.T
from db i... | ybenitezf/nstock | models/plugin_text.py | Python | mit | 1,369 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.