code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | Kraymer/beets | beets/ui/commands.py | Python | mit | 59,450 |
#==========================================================================
# Copyright 2012 Lucidel, Inc., 2013 Cloudoscope Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the License.
# You may obtain a copy of the License in the LICENSE f... | gadio/moma-django | moma_example/testing/views.py | Python | apache-2.0 | 772 |
from mongoengine import *
from django.utils.hashcompat import md5_constructor, sha_constructor
from django.utils.encoding import smart_str
from django.contrib.auth.models import AnonymousUser
from django.utils.translation import ugettext_lazy as _
import datetime
REDIRECT_FIELD_NAME = 'next'
def get_hexdigest(algor... | KarimAllah/mongoengine | mongoengine/django/auth.py | Python | mit | 5,621 |
#coding: utf-8
from __future__ import unicode_literals
import codecs
from pymorphy.backends.base import DictDataSource
from pymorphy.constants import PRODUCTIVE_CLASSES
class MrdDataSource(DictDataSource):
"""
Источник данных для морфологического анализатора pymorphy,
берущий информацию из оригинальных mr... | kmike/pymorphy | pymorphy/backends/mrd_source.py | Python | mit | 9,408 |
from django.core.urlresolvers import reverse
from django.test import TestCase
from mock import patch, Mock
from silk.config import SilkyConfig
from silk.middleware import SilkyMiddleware, _should_intercept
from silk.models import Request
from .util import mock_data_collector
class TestApplyDynamicMappings(TestCase)... | ruhan/django-silk-mongoengine | project/tests/test_silky_middleware.py | Python | mit | 3,980 |
# Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | xiaoyaozi5566/GEM5_DRAMSim2 | src/cpu/simple/AtomicSimpleCPU.py | Python | bsd-3-clause | 2,568 |
__author__ = 'WylYeak'
| wylyeak/verify_zip_file | gui/__init__.py | Python | gpl-2.0 | 23 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('store', '0011_remove_cloud_users_email'),
]
operations = [
migrations.RemoveField(
model_name='cloud_users',
... | cparawhore/ProyectoSubastas | store/migrations/0012_auto_20140920_1900.py | Python | mit | 554 |
# -*- coding: utf-8 -*-
# Copyright 2017, Digital Reasoning
#
# 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 ... | clarkperkins/stackdio | stackdio/api/stacks/api.py | Python | apache-2.0 | 17,778 |
#!/usr/bin/python
#
# Copyright 2011 Thomas Bollmeier
#
# This file is part of GObjectCreator2.
#
# GObjectCreator2 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 you... | ThomasBollmeier/GObjectCreator2 | src/bin/gobject_creator2.py | Python | gpl-3.0 | 10,957 |
import json
import os
import random
import string
import time
from datetime import datetime
from tempfile import TemporaryDirectory
from django.test import testcases
from rest_framework import status
from desecapi.replication import Repository
from desecapi.tests.base import DesecTestCase
class ReplicationTest(Dese... | desec-io/desec-stack | api/desecapi/tests/test_replication.py | Python | mit | 5,066 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import Folder
def dup_filter(children):
# childrenと同じ物だけを集めるフィルタ
def _filter(item):
return set(item['children']) == set(children)
return _filter
def find_duplicates(needle, list):
# listからneedle(フォルダ)の子供と同じ子供をもつフォルダを集める
# 子供と一致するかを判断するフィルタを作る
child_filter ... | peccu/find-duplicates-from-bookmarks.plist | findDuplicator.py | Python | mit | 902 |
# -*- coding: 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):
# Adding model 'GraphType'
db.create_table('skwissh_graphtype', (
('id', self.gf('django.db.mode... | weijia/django-skwissh | skwissh/migrations/0001_initial.py | Python | gpl-3.0 | 17,013 |
import re
from .base import FIELD_TYPE
from django.db.backends import BaseDatabaseIntrospection, FieldInfo
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
class DatabaseIntrospection(BaseDatabaseIntrospection):
data_types_reverse = {
FIEL... | mammique/django | django/db/backends/mysql/introspection.py | Python | bsd-3-clause | 4,591 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'Portal Sale',
'version': '0.1',
'category': 'Tools',
'complexity': 'easy',
'description': """
This module adds a Sales menu to your portal as soon as sale and portal are installed.
=======... | minhphung171093/GreenERP_V9 | openerp/addons/portal_sale/__openerp__.py | Python | gpl-3.0 | 1,178 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but... | pierg75/pier-sosreport | sos/plugins/opencl.py | Python | gpl-2.0 | 1,083 |
from Q5 import price2
"""
" question 6
"""
print("price2 = " + str(price2(3.0, +0.02, +0.05, -0.05, 100.0, lambda x : max(x - 95.0, 0))))
| rpereira-dev/ENSIIE | UE/S2/Projet/Mathematiques/code/Q6.py | Python | gpl-3.0 | 140 |
d = {
'book': ['bouk', 'boook', 'boock'],
'apple': ['aple', 'appl'],
}
t = 'I and my brother, have a boook about appl.'
t = t.replace(',', ' ')
t = t.replace('.', ' ')
t = t.replace('?', ' ')
t = t.replace('!', ' ')
words = t.split(' ')
t2 = ''
for w in words:
# w in d
# w in d.keys... | amiraliakbari/sharif-mabani-python | by-session/ta-932/j6/spell_checker.py | Python | mit | 620 |
# Tuples - ordered set of data
t1 = 'a', 'b', 'c'
t2 = ('a', 'b', 'c')
print(t1, t2)
print(t1 == t2) # True - equals
| matiishyn/py-learning | 3-sequence-types/5-tuples.py | Python | mit | 123 |
# -*- coding:utf-8 -*-
# !/usr/bin/python2
#将得出的矩阵转化为topic
import pandas as pd
from MedicineSCI.InterfaceSQL import MSSQL
def theta2subset(theta_path, topic_num):
df = pd.read_csv(filepath_or_buffer=theta_path, sep='\t', header=None, names=range(1, topic_num+1), index_col=False)
article_topic = df.idxmax(axis=... | EachenKuang/PythonRepository | MedicineSCI/Tools/matric2topic.py | Python | apache-2.0 | 1,870 |
#!/usr/bin/env python
##
## ari
##
## the realraum audience response indicator
##
##
## Copyright (C) 2015 Christian Pointner <equinox@spreadspace.org>
##
## This file is part of ari.
##
## ari is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as publi... | realraum/ari | test/overlay-test.py | Python | gpl-3.0 | 6,283 |
"""An image processing pipeline stage which divides the image into segments."""
import cv
import itertools
__author__ = "Nick Pascucci (npascut1@gmail.com)"
class ShotgunSegmentationPipe:
"""An implementation of a simple flood fill image segmentor.
This pipe can be used to simplify an image before other pro... | nickpascucci/RobotCamera | src/driver/modules/pipelines/segmentationpipe.py | Python | gpl-3.0 | 1,719 |
# This file is part of Tryton & Nereid. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from flask.globals import (_request_ctx_stack, current_app, # noqa
request, session, g, LocalProxy, _find_app)
from flask.ext.login import current_user ... | fulfilio/nereid | nereid/globals.py | Python | bsd-3-clause | 1,520 |
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
# Copyright 2016 FUJITSU LIMITED
# 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
#... | sapcc/monasca-notification | monasca_notification/common/utils.py | Python | apache-2.0 | 3,246 |
import psycopg2 as dbapi2
import datetime
from classes.model_config import dsn
class project_operations:
def __init__(self):
self.last_key = None
def add_project(self, Project):
with dbapi2.connect(dsn) as connection:
cursor = connection.cursor()
cursor.execute(
... | itucsdb1611/itucsdb1611 | classes/operations/project_operations.py | Python | gpl-3.0 | 4,444 |
from textblob import TextBlob
# From http://www.ling.upenn.edu/courses/Fall_2007/ling001/penn_treebank_pos.html
def name_from_tag(tag):
tags = {
'CC': 'Coordinating conjunction',
'CD': 'Cardinal number',
'DT': 'Determiner',
'EX': 'Existential there',
'FW': 'Foreign word',
... | jaden/2014-hour-of-code | python/sentence_diagramming.py | Python | mit | 1,684 |
#
# build the opening book
#
import os
import sysconfig
import sys
build_lib = "lib.%s-%s" % (sysconfig.get_platform(), sysconfig.get_python_version())
pypath = os.path.join("build", build_lib, "gshogi")
sys.path.append(pypath)
import engine
text_opening_book = "data/gnushogi.tbk"
bin_opening_book = "gshogi/data/op... | johncheetham/gshogi | create_book.py | Python | gpl-3.0 | 1,078 |
# Copyright 2014 Rustici Software
#
# 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... | brianjmiller/TinCanPython | tincan/base.py | Python | apache-2.0 | 2,635 |
import glob
import re
import shutil
import os
os.putenv('PATH', '/Applications/Mauve.app/Contents/MacOS:' + os.getenv('PATH'))
SAMPLES = "sample1 sample2 sample3 sample4".split()
ROOT_FOLDER = "/path/to/root/dir"
REF_NAME = "reference_strain"
REF = os.path.join(ROOT_FOLDER, "fasta_genomes", REF_NAME + ".fasta")... | jrherr/bioinformatics_scripts | manning_lab_scripts/reorder_contigs_with_MAUVE.py | Python | mit | 1,163 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('tasks', '0010_exporttaskexception'),
]
operations = [
migrations.AlterField(
model_name='exporttaskexception',
... | hotosm/osm-export-tool2 | tasks/migrations/0011_auto_20150602_1914.py | Python | bsd-3-clause | 435 |
# Copyright 2017 Priscilla Boyd. 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 applicable law ... | priscillaboyd/SPaT_Prediction | src/preprocessing/Cleaner.py | Python | apache-2.0 | 3,940 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'michal@vane.pl'
import os
import logging
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.wsgi
import sockjs.tornado
from django.core.handlers import wsgi
import pusher
import constraint
import logging as _
SETTINGS_PATH="d... | vane/django_tornado | django_tornado.py | Python | bsd-3-clause | 1,266 |
from pprint import pformat
import os
import sys
from difflib import SequenceMatcher
from .. import logs, types, const
from ..conf import settings
from ..corrector import get_corrected_commands
from ..exceptions import EmptyCommand
from ..ui import select_command
from ..utils import get_alias, get_all_executables
def ... | SimenB/thefuck | thefuck/entrypoints/fix_command.py | Python | mit | 1,556 |
"""Test the example module auth module."""
from homeassistant import auth, data_entry_flow
from homeassistant.auth.mfa_modules import auth_mfa_module_from_config
from homeassistant.auth.models import Credentials
from tests.common import MockUser
async def test_validate(hass):
"""Test validating pin."""
auth_... | jawilson/home-assistant | tests/auth/mfa_modules/test_insecure_example.py | Python | apache-2.0 | 5,045 |
# Copyright (c) 2004 by Stingray Software
# For license information, read file LICENSE in project top directory
#
# $Id: PDU.py 63 2004-12-30 22:02:55Z stingray $
#
# SMPP Protocol parser and encoder library
# Misc utilities
import struct
def ffNumber(x):
"""Convert freeform number to tuple"""
if not isinstance(x... | theraphim/ota-configurator | src/smpputil.py | Python | gpl-2.0 | 683 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This is derived from a cadquery script for generating QFP/GullWings models in X3D format.
#
# from https://bitbucket.org/hyOzd/freecad-macros
# author hyOzd
#
## file of parametric definitions
def reload_lib(lib):
if (sys.version_info > (3, 0)):
import importl... | easyw/kicad-3d-models-in-freecad | cadquery/FCAD_script_generator/Button_Switch_Tactile_SMD_THT/cq_parameters.py | Python | gpl-2.0 | 14,405 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 CERN.
##
## Invenio 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 ve... | pombredanne/invenio | modules/bibformat/lib/elements/bfe_comments.py | Python | gpl-2.0 | 2,111 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2015-03-03 01:36:47
# @Author : Robin
from HttpHolder import HttpHolder
import json
class XBase(object):
def __init__(self, username="nobody", password="nobody", app="app", apiurl="http://127.0.0.1:9999/api/"):
super(XBase, self).__init__()
self.usernam... | sintrb/XBase | sdk/XBase.py | Python | gpl-2.0 | 1,427 |
# 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 ... | sharadagarwal/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/resource_collection.py | Python | mit | 1,520 |
import re
from ztag.annotation import Annotation
from ztag.annotation import OperatingSystem
from ztag.annotation import Type
from ztag.annotation import Manufacturer
from ztag import protocols
import ztag.test
class FtpFullrate(Annotation):
protocol = protocols.FTP
subprotocol = protocols.FTP.BANNER
port... | zmap/ztag | ztag/annotations/FtpFullrate.py | Python | apache-2.0 | 2,892 |
#
# rtlsdr_scan
#
# http://eartoearoak.com/software/rtlsdr-scanner
#
# Copyright 2012 - 2014 Al Brown
#
# A frequency scanning GUI for the OsmoSDR rtl-sdr library at
# http://sdr.osmocom.org/trac/wiki/rtl-sdr
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | thatchristoph/RTLSDR-Scanner | src/plot_spect.py | Python | gpl-3.0 | 14,513 |
#process all record
import pickle
import signal_processing as sig_proc
dir_name = '../data/r415/'
img_ext = '.png'
save_img = False
show = False
save_obj = False
#signal filtering parameter
low_cut = 3e2
high_cut = 3e3
#spike finding parameters
b_spike = 6
a_spike = 20
spike_thresh = -4
threshold_template = 4 #dis... | scauglog/brain_record_toolbox | script_r415_process_record.py | Python | mit | 2,841 |
#!/usr/bin/env python
# sorry, this is very ugly, but I'm in python 2.5
import sys
sys.path.insert(0,"../..")
from dot11 import ProtocolPacket
from ImpactPacket import ProtocolLayer, PacketBuffer
from binascii import hexlify
import unittest
class TestPacket(ProtocolPacket):
def __init__(self, aBuffer = None)... | tholum/PiBunny | system.d/library/tools_installer/tools_to_install/impacket/impacket/testcases/dot11/test_Dot11HierarchicalUpdate.py | Python | mit | 5,961 |
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))
... | binhqnguyen/lena | src/visualizer/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 396,141 |
import pytz
import lxml
import dateutil.parser
import datetime
from openstates.utils import LXMLMixin
from pupa.scrape import Scraper, Event
class MAEventScraper(Scraper, LXMLMixin):
_TZ = pytz.timezone("US/Eastern")
date_format = "%m/%d/%Y"
def scrape(self, chamber=None, start=None, end=None):
... | openstates/openstates | openstates/ma/events.py | Python | gpl-3.0 | 4,059 |
from mindfeed.mindfeed import main
if __name__ == "__main__":
main()
| zeckalpha/mindfeed | mindfeed/__init__.py | Python | mit | 75 |
#!/usr/bin/env python
from struct import *;
from collections import namedtuple;
import getopt;
import sys;
class MdbShmReader:
def __init__(self,filename):
self.filename = filename;
self.readFile();
def readFile(self):
try:
self.fd = open(self.filename,"r");
except:
print "open file failed"
exit(-... | zbcwilliam/tair-rdb-modified | scripts/mdbshm_reader.py | Python | gpl-2.0 | 6,414 |
# Copyright (c) 2015.
# Philipp Wagner <bytefish[at]gmx[dot]de> and
# Florian Lier <flier[at]techfak.uni-bielefeld.de> and
# Norman Koester <nkoester[at]techfak.uni-bielefeld.de>
#
#
# Released to public domain under terms of the BSD Simplified license.
#
# Redistribution and use in source and binary forms, with or wit... | warp1337/opencv_facerecognizer | src/ocvfacerec/facerec/visual.py | Python | bsd-3-clause | 4,343 |
import numpy as np
import lmfit
class SinglePoleStep:
def __init__(self, amp, tau):
self.amp_s = amp
self.tau_s = tau
self.amp_k = self.amp_s/(self.amp_s-1.)
self.tau_k = (1.-self.amp_s)*self.tau_s
self.step_func = lambda t: 1.-self.amp_s*np.exp(-t/self.tau_s)
self... | DiCarloLab-Delft/PycQED_py3 | pycqed/measurement/distortions_models.py | Python | mit | 507 |
"""
find 2 nodes in a binary search tree which make a + b = k.
"""
class Solution :
def twosum(self, root, k):
# naive solution
# inorder traversal -> array -> 2sum problem. O(n) time O(n) space.
# optimization:
# Cannot improve time, only space to O(logn) by using stack.
sta... | linyaoli/acm | tree/hard/2sum_in_binary_search_tree.py | Python | gpl-2.0 | 1,516 |
# --------------------------------------------------------------------------- #
# BALLOONTIP wxPython IMPLEMENTATION
# Python Code By:
#
# Andrea Gavana, @ 29 May 2005
# Latest Revision: 23 Nov 2009, 09.00 GMT
#
#
# TODO List/Caveats
#
# 1. With wx.ListBox (And Probably Other Controls), The BalloonTip Sometimes
# Fl... | 163gal/Time-Line | libs64/wx/lib/agw/balloontip.py | Python | gpl-3.0 | 32,252 |
from StateMachine.State import State
from StateMachine.StateMachine import StateMachine
from StateMachine.InputAction import InputAction
from GameData.GameData import GameData
class StateT(State):
state_stack = list()
game_data = GameData()
def __init__(self):
self.transitions = None
def next(... | jmacleod/dotr | GameStates.py | Python | gpl-2.0 | 3,904 |
# Copyright (c) 2015 Mirantis, 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... | openstack/python-muranoclient | muranoclient/v1/categories.py | Python | apache-2.0 | 1,930 |
# -*- coding: utf-8
# RUR-PLE: Roberge's Used Robot - a Python Learning Environment
# images.py - Contains all images for RUR-PLE
# Version 0.8.7
# Author: Andre Roberge Copyright 2005
# andre.roberge@gmail.com
import os
import wx
import conf
# robots
GREY_ROBOT_S = 'robot_s.png'
GREY_ROBOT_N = 'robot... | badbear1727/rur-ple | rur_py/images.py | Python | gpl-2.0 | 2,608 |
from flask import render_template, redirect, url_for, request
from flask.views import MethodView
from nastradini import mongo, utils
from positionform import PositionForm
class Position(MethodView):
methods = ['GET', 'POST']
def get(self):
form = PositionForm()
return render_template('positio... | assemblio/project-nastradin | nastradini/views/forms/position.py | Python | gpl-2.0 | 700 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Scour
#
# Copyright 2010 Jeff Schiller
# Copyright 2010 Louis Simard
#
# This file is part of Scour, http://www.codedread.com/scour/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | piksels-and-lines-orchestra/inkscape | share/extensions/scour.py | Python | gpl-2.0 | 110,535 |
""" Testing Image spaces
"""
from __future__ import absolute_import
import numpy as np
import nibabel as nib
from nibabel.affines import from_matvec
from ..image import Image, rollimg
from ..image_spaces import (is_xyz_affable, as_xyz_image, xyz_affine,
make_xyz_image)
from ...reference.c... | alexis-roche/nipy | nipy/core/image/tests/test_image_spaces.py | Python | bsd-3-clause | 6,953 |
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
import sys,... | nuclear-wizard/moose | python/TestHarness/schedulers/QueueManager.py | Python | lgpl-2.1 | 16,027 |
# Copyright 2020 The TensorFlow 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 License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | tensorflow/graphics | tensorflow_graphics/image/pyramid.py | Python | apache-2.0 | 9,873 |
"""Compressed Sparse Row matrix format"""
from __future__ import division, print_function, absolute_import
__docformat__ = "restructuredtext en"
__all__ = ['csr_matrix', 'isspmatrix_csr']
import numpy as np
from scipy._lib.six import xrange
from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \
... | jlcarmic/producthunt_simulator | venv/lib/python2.7/site-packages/scipy/sparse/csr.py | Python | mit | 14,939 |
import decimal
import logging
from .adx import ADXTrader
LOGGER = logging.getLogger(__name__)
class PercentageTrader(ADXTrader):
def __init__(self, percentage, *args, **kwargs):
super().__init__(*args, **kwargs)
self.percentage = percentage
def __str__(self):
return '{}{}<{}>'.forma... | CaptainBriot/prosperpy | prosperpy/traders/perc.py | Python | mit | 1,630 |
# -*- coding: utf-8 -*-
"""
Author: Bernhard Scheirle
"""
from __future__ import unicode_literals
import os
from pelican.contents import Content
from pelican.utils import slugify
from . import avatars
class Comment(Content):
mandatory_properties = ('author', 'date')
default_template = 'None'
def __init... | tohuw/tohuwnet-pelican | plugins/pelican_comment_system/comment.py | Python | apache-2.0 | 1,929 |
from flask_security import current_user
from flask_principal import Need, Permission, identity_loaded
accept_suit_need = Need('accept_suit', True)
accept_suit_permission = Permission(accept_suit_need)
make_admin_need = Need('make_admin', True)
make_admin_permission = Permission(make_admin_need)
def grant_permissio... | crossgovernmentservices/sue-my-brother | app/main/permissions.py | Python | mit | 717 |
# coding: utf8
class BinaryTree():
def __init__(self, value):
self.parent = self.left = self.right = None
self.value = value
def insertLeft(self, T):
T.parent = self
self.left = T
def insertRight(self, T):
T.parent = self
self.right = T
def deleteLeft... | eduSan/pyAsd | albero/BinaryTree.py | Python | gpl-3.0 | 663 |
#!/usr/bin/env python
import argparse
import logging
import re
import serial
import time
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser(description="Test and calibrate the Re:load Pro")
parser.add_argument('--baud', metavar='BAUD', type=int, help="Baud rate", default=115200)
parser.add_ar... | Ralim/reload-pro | tools/calibrate.py | Python | apache-2.0 | 2,793 |
##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2014
# Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8
# Primeira reimpressão - Outubro/2011
# Segunda reimpressão - ... | laenderoliveira/exerclivropy | exercicios_resolvidos/capitulo 05/exercicio-05-22.py | Python | mit | 1,331 |
# Copyright 2012 10gen, 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 in writing, soft... | anuragkapur/mongo-connector | tests/test_oplog_manager_sharded.py | Python | apache-2.0 | 14,641 |
# Copyright 2014 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | cisco-openstack/tempest | tempest/lib/api_schema/response/compute/v2_1/servers.py | Python | apache-2.0 | 16,686 |
#
# 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... | ueshin/apache-spark | python/pyspark/pandas/data_type_ops/binary_ops.py | Python | apache-2.0 | 4,022 |
#
# Copyright Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0
#
# or in the "license" file accompanyi... | wcs1only/s2n | tests/integration/s2n_handshake_test_s_server.py | Python | apache-2.0 | 14,531 |
from vsg import token
from vsg.rules import move_token_left_to_next_non_whitespace_token as Rule
oToken = token.generic_clause.semicolon
class rule_021(Rule):
'''
This rule checks the semicolon is not on it's own line.
**Violation**
.. code-block:: vhdl
U_FIFO : FIFO
generic (
... | jeremiah-c-leary/vhdl-style-guide | vsg/rules/generic/rule_021.py | Python | gpl-3.0 | 616 |
from socket import *
import threading
def echo_server(address):
sock = socket(AF_INET, SOCK_STREAM)
sock.bind(address)
sock.listen(1)
while True:
client, addr = sock.accept()
print('Connection from', addr)
t = threading.Thread(target=echo_handler,
ar... | jcontesti/python-programming-language-livelessons-projects | 15/echoserv.py | Python | gpl-3.0 | 615 |
# Copyright (c) 2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
Meteogram
=========
Plots time series data as a meteogram.
"""
import datetime as dt
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from metpy.ca... | metpy/MetPy | v0.7/_downloads/meteogram_metpy.py | Python | bsd-3-clause | 9,460 |
#===- cindex.py - Python Indexing Library Bindings -----------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===--------------------------------------------------------------... | arakashic/chromatica.nvim | rplugin/python3/clang/cindex.py | Python | mit | 127,932 |
# -*- coding: utf-8 -*-
import win32com.client
from pywintypes import com_error
from input import GRD_FILE_NAME
acad = win32com.client.Dispatch("AutoCAD.Application")
doc = acad.ActiveDocument # Document object
def get_num(s):
return float("".join(char for char in s if char.isdigit() or char in ["-", "+", "."])... | Jimaklas/grd2section | grd2section.py | Python | gpl-3.0 | 1,572 |
#!/usr/bin/python
#encoding: utf8
import mr_gov_il
import time
import pprint
import json
import os
import copy
import shutil
import requesocks as requests
#import requests
from scrapy.selector import Selector
import urllib3
import sys
from datetime import datetime, timedelta
class tender_extended_data_web_page(mr_gov_... | OpenBudget/open-budget-data | tenders/tenders_scraper.py | Python | mit | 6,597 |
#
# Copyright (c) 2015 Intel Corporation
#
# Author: Julio Montes <julio.montes@intel.com>
# Author: Victor Morales <victor.morales@intel.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
... | clearlinux/clearstack | clearstack/tests/test_sequence.py | Python | apache-2.0 | 1,191 |
#!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies build of an executable in three different configurations.
"""
import TestGyp
test = TestGyp.TestGyp(formats=['msvs'])
test.r... | gvaf/breakpad | src/tools/gyp/test/configurations/x64/gyptest-x86.py | Python | bsd-3-clause | 783 |
#!/usr/bin/env python
# coding: utf-8
"""MikroTik RouterOS backup and change manager"""
import sys
import re
import socket
import os
HAS_SSHCLIENT = True
SHELLMODE = False
SHELLDEFS = {
'username': 'admin',
'password': '',
'timeout': 30,
'port': 22,
'export_dir': None,
'export_file' : None,
... | nekitamo/ansible-mikrotik | library/mikrotik_export.py | Python | gpl-3.0 | 15,608 |
#
# Python documentation build configuration file
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (module imports are okay, they're removed automatically).
import sys, os, time
sy... | robobrobro/ballin-octo-shame | lib/Python-3.4.3/Doc/conf.py | Python | mit | 5,736 |
from django.db import models
from django.core.urlresolvers import reverse
from django.conf import settings
import misaka
from groups.models import Group
# Create your models here.
# POSTS MODELS.PY
from django.contrib.auth import get_user_model
User = get_user_model()
class Post(models.Model):
user = models.Fo... | srijannnd/Login-and-Register-App-in-Django | simplesocial/posts/models.py | Python | mit | 984 |
# Copyright (c) 2015 Huawei Technologies Co.,LTD.
#
# 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... | dims/neutron | neutron/extensions/address_scope.py | Python | apache-2.0 | 5,290 |
class check_privilege_revoke_all_fga_log():
"""
check_privilege_revoke_all_fga_log
Ensure 'ALL' Is Revoked from Unauthorized 'GRANTEE' on FGA_LOG$
The FGA_LOG$ table contains audit records for tables with a defined Fine
Grained Auditing policy.
"""
# References:
# http://www.davidlitchf... | foospidy/DbDat | plugins/oracle/check_privilege_revoke_all_fga_log.py | Python | gpl-2.0 | 1,208 |
import pygame
import random
import os
import sys
from os import path
from pygame.locals import *
image_dir = path.join(path.dirname(__file__), 'images')
sound_dir = path.join(path.dirname(__file__), 'sounds')
pygame.init()
pygame.mixer.init()
# Initializing shooting sounds
bulletSound1 = pygame.mixer.Sound(path.join... | Pedram26/Humans-vs-Aliens | HumansAliens.app/Contents/Resources/HumansAliens.py | Python | apache-2.0 | 26,473 |
""""""
# Set Global Attributes:
__name__ = 'jhTAlib'
__version__ = '20211230.0'
__description__ = 'Technical Analysis Library Time-Series'
__url__ = 'https://github.com/joosthoeks/jhTAlib'
__author__ = 'Joost Hoeks'
__author_email__ = 'joosthoeks@gmail.com'
# Import Built-Ins:
# Import Third-Party:
# Import Homeb... | joosthoeks/jhTAlib | jhtalib/__init__.py | Python | gpl-3.0 | 920 |
#! /usr/bin/env jython
# start.py
# This is a quick-and-dirty script to simplify running Grinder
# agent and console from the command-line.
usage = """Usage:
jython start.py [agent|console]
This script reads configuration from conf.py in the current directory.
Please edit conf.py to fit your environment before ru... | a-e/grinder-webtest | start.py | Python | mit | 1,535 |
tests=[
("testExecs/testConformerParser.exe","",{}),
]
longTests = []
if __name__=='__main__':
import sys
from rdkit import TestRunner
failed,tests = TestRunner.RunScript('test_list.py',0,1)
sys.exit(len(failed))
| adalke/rdkit | Contrib/ConformerParser/test_list.py | Python | bsd-3-clause | 228 |
from __future__ import unicode_literals
#
# Copyright 2005,2006,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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 versi... | iohannez/gnuradio | gr-digital/examples/ofdm/receive_path.py | Python | gpl-3.0 | 3,483 |
"""
Copyright 2015 Brocade Communications Systems, 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 t... | BRCDcomm/pynos | pynos/versions/ver_7/ver_7_0_0/interface.py | Python | apache-2.0 | 61,234 |
"""
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
"""
from utils import PrimeGen
def sum_primes_below(limit):
gen = PrimeGen(limit)
return sum(gen)
if __name__ == "__main__":
print(sum_primes_below(2000000))
| nymoral/euler | p10.py | Python | mit | 281 |
def main():
num=input("Enter a # and I'll tell you all perfect numbers up to that #: ")
for i in range(1,num+1):
sum=0
for j in range(1,(i/2)+1): # why +1?
if i%j==0: # check if remainder is 0
sum=sum+j
# print "factor: ",i
if sum==i... | ianfelzer1/ifelzer-advprog | Last Year/python files /new1.py | Python | gpl-3.0 | 400 |
# -*- coding: utf-8 -*-
import time
from .finder import TIME_LIMIT, MAX_RUNS, BY_START, BY_END
from .a_star import AStarFinder
from pathfinding.core.diagonal_movement import DiagonalMovement
class BiAStarFinder(AStarFinder):
"""
Similar to the default A* algorithm from a_star.
"""
def __init__(self, h... | brean/python-pathfinding | pathfinding/finder/bi_a_star.py | Python | mit | 2,744 |
#!/usr/bin/env python
# coding=utf-8
from flask import render_template
from . import main
# @main.app_errorhandler(404)
# def page_not_found(e):
# return render_template('404.html'), 404
#
# @main.app_errorhandler(500)
# def internal_server_error(e):
# return render_template('500.html'), 500 | youqingkui/yinxiang_blog_py | app/main/errors.py | Python | mit | 302 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from datospersonalesapp.models import Paciente
from empleadosapp.models import Doctor
from smart_selects.db_fields import ChainedForeignKey
# Create your models here.
## opciones para indicar el tipo de consulta
#
TCON... | anderson7ru/bienestarues | generalapp/models.py | Python | mit | 8,775 |
# Copyright 2012 by Wibowo Arindrarto. All rights reserved.
# All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Custom indexing for Bio.SearchIO objects."""
import sys
# Add p... | Ambuj-UF/ConCat-1.0 | src/Utils/Bio/SearchIO/_index.py | Python | gpl-2.0 | 1,097 |
import sys
import os
import codecs
from setuptools import setup, find_packages
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
VERSION = "0.1.1"
with codecs.open('README.rst', encoding='utf-8') as f:
README = f.read()
with codecs.open('CHANGELOG.rst', encoding='utf-8... | holstvoogd/puppetboard | setup.py | Python | apache-2.0 | 1,582 |
import os
from django.conf import settings
from django.core.files import File
from django.core.files.images import ImageFile
from django.test import override_settings
from unittest import mock
from nose.tools import eq_
import kitsune.upload.tasks
from kitsune.questions.tests import QuestionFactory
from kitsune.sumo... | mozilla/kitsune | kitsune/upload/tests/test_tasks.py | Python | bsd-3-clause | 7,113 |
import numpy as np
import matplotlib.pyplot as plt
def draw_matches(img1, kp1, img2, kp2, matches, color=None):
"""Draws lines between matching keypoints of two images.
Keypoints not in a matching pair are not drawn.
Places the images side by side in a new image and draws circles
around each keypoi... | haiweiosu/Optical-Character-Recognition-using-Template-Matching-Object-Detection-in-Images | drawMatches.py | Python | apache-2.0 | 2,594 |
a = []
a.append('1') | amiraliakbari/sharif-mabani-python | by-session/ta-921/j9/ex1.py | Python | mit | 21 |
"""
Module that provides access to the underlying beamline control layer,
HardwareRepository. The HardwareRepository consists of several HardwareObjects
that can be directly accessed through this module. See the list of
HardwareObjects that are "exported" below.
"""
from __future__ import absolute_import
from __future_... | marcus-oscarsson/mxcube3 | mxcube3/blcontrol.py | Python | gpl-2.0 | 3,470 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.