text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from thumbnails.conf import settings
from thumbnails.engines import DummyEngine
from thumbnails.helpers import get_engine, generate_filename, get_cache_backend
from thumbnails.images import SourceFile, Thumbnail
__version__ = '0.5.1'
def get_thumbnail(original, size, **options):
"""
... | relekang/python-thumbnails | thumbnails/__init__.py | Python | mit | 2,899 | 0.005174 |
# Copyright (C) 2011, The SAO/NASA Astrophysics Data System
#
# 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 p... | adsabs/ADS_records_merger | pipeline_log_functions.py | Python | gpl-3.0 | 1,639 | 0.003661 |
import os
from iotile.core.dev import ComponentRegistry
from iotile.ship.recipe import RecipeObject
from iotile.ship.exceptions import RecipeNotFoundError
class RecipeManager:
"""A class that maintains a list of installed recipes and recipe actions.
It allows fetching recipes by name and auotmatically buildi... | iotile/coretools | iotileship/iotile/ship/recipe_manager.py | Python | gpl-3.0 | 4,144 | 0.002896 |
from flask import Blueprint, render_template
frontend = Blueprint('frontend', __name__)
@frontend.route('/')
@frontend.route('/index')
def index():
return render_template('index.html')
| ondoheer/GOT-Platform | app/frontend/views.py | Python | gpl-2.0 | 197 | 0.005076 |
# 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... | nttcom/eclcli | eclcli/orchestration/heatclient/v1/events.py | Python | apache-2.0 | 2,990 | 0 |
import time
import zlib
from bs4 import BeautifulSoup
# from geopy.geocoders import Nominatim as Geo
from scraper import BaseScraper
from price_parser import parse_price_text
from MySQL_connector import db_connector
db = 'realestate_db'
class Parser(object):
scr_db = 'scraper_dumps'
tgt_db = 'realestate_d... | lyso/scrape_realestate | parser_mysql.py | Python | gpl-3.0 | 10,544 | 0.000759 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Li... | Mendelone/forex_trading | Algorithm.Python/PythonPackageTestAlgorithm.py | Python | apache-2.0 | 6,403 | 0.016872 |
from omnibus.factories import websocket_connection_factory
def mousemove_connection_factory(auth_class, pubsub):
class GeneratedConnection(websocket_connection_factory(auth_class, pubsub)):
def close_connection(self):
self.pubsub.publish(
'mousemoves', 'disconnect',
... | moccu/django-omnibus | examples/mousemove/example_project/connection.py | Python | bsd-3-clause | 485 | 0.002062 |
from django.test import Client
import mock as mock
from image_converter.tests.base import ImageConversionBaseTestCase
from image_converter.utils.convert_image import convert_image_to_jpeg
__author__ = 'Dominic Dumrauf'
class ViewsTestCase(ImageConversionBaseTestCase):
"""
Tests the 'views'.
"""
def ... | dumrauf/web_tools | image_converter/tests/test_views.py | Python | mit | 3,078 | 0.001949 |
try:
try:
from _pydevd_frame_eval_ext import pydevd_frame_evaluator as mod
except ImportError:
from _pydevd_frame_eval import pydevd_frame_evaluator as mod
except ImportError:
try:
import sys
try:
is_64bits = sys.maxsize > 2 ** 32
except:
# I... | leafclick/intellij-community | python/helpers/pydev/_pydevd_frame_eval/pydevd_frame_eval_cython_wrapper.py | Python | apache-2.0 | 1,343 | 0.002234 |
#
# Martin Kolman <mkolman@redhat.com>
#
# Copyright 2018 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be use... | atodorov/pykickstart | pykickstart/commands/module.py | Python | gpl-2.0 | 4,566 | 0.001314 |
# Python 3: ArchiveNM.py
# Function:
# This will collect the files in /home/postgres that
# need to be sent to a new Natural Message machine
# that is being initialized. This currently grabs
# directory server and shard server files.
# It can also be used as an archiver.
import datetime
import tarfile
import o... | naturalmessage/natmsgshardbig | sql/ArchiveNM.py | Python | gpl-3.0 | 2,018 | 0.018335 |
class IRCUser(object):
def __init__(self, user):
self.user = None
self.hostmask = None
self.last_active = None
if "!" in user:
user_array = user.split("!")
self.name = user_array[0]
if len(user_array) > 1:
user_array = user_array... | HubbeKing/Hubbot_Twisted | hubbot/user.py | Python | mit | 629 | 0 |
#!/usr/bin/python
import sys, os, time
from itertools import count
import logging
import tkp.database.database as database
import tkp.database.dataset as ds
import tkp.database.dbregion as reg
import tkp.database.utils as dbu
import monetdb.sql
from tkp.sourcefinder import image
from tkp.config import config
from tkp.... | jjdmol/LOFAR | CEP/GSM/src/ms3_script.py | Python | gpl-3.0 | 2,005 | 0.002494 |
import logging
import configparser
import os
from utils import bool_query
class BreakRule(object):
def __init__(self, settings):
self.settings = settings
self.rules_record = configparser.ConfigParser()
self.rules_record.read("{}/tms/breakrules.ini".format(os.getcwd()))
self.rules... | marmstr93ng/TimeManagementSystem | tms/breakrule.py | Python | mit | 2,292 | 0.004363 |
# -*- coding: utf-8 -*-
__all__ = [
"CreateTablesCommand", "DropTablesCommand", "UpdateCommand",
]
from flask.ext.script import Command, Option
from .models import db
from .update import update
class CreateTablesCommand(Command):
def run(self):
db.create_all()
class DropTablesCommand(Command):
... | pombredanne/osrc | osrc/manage.py | Python | mit | 536 | 0 |
import random
def printifyInstruction(instr, mcs):
"""
Construct a preaty representation of the instruction in memory.
mcs -> 'maximum characters span'
"""
return "({0:{3}d}, {1:{3}d}, {2:{3}d})".format(instr['A'], instr['B'], instr['C'], mcs)
class Orbis:
def __init__(self, gSize):
se... | 3Nigma/jale | main.py | Python | mit | 3,579 | 0.00475 |
#!/usr/bin/env python3
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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 withou... | fyookball/electrum | lib/daemon.py | Python | mit | 14,615 | 0.001779 |
# -*- coding: utf-8 -*-
from io import BytesIO
import pytest
from phi.request.form import FormRequest
class TestFormRequest(object):
@pytest.fixture
def form_req(self):
fr = FormRequest()
fr.charset = "utf-8"
return fr
@pytest.mark.parametrize("body, content", [
(
... | RafaelSzefler/phi | tests/unit/request/test_form.py | Python | mit | 834 | 0 |
# Sketch - A Python-based interactive drawing program
# Copyright (C) 1997, 1998, 1999, 2001, 2002 by Bernhard Herzog
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2... | shumik/skencil-c | Sketch/UI/linedlg.py | Python | gpl-2.0 | 11,272 | 0.016856 |
# We try to improve the previous 'math_operation.py' by reduce the code
# here we introduce a concept named list-comprehensive
# Knowledge points:
# 1. list-comprehensive, the [x for x in a-list]
# 2. dir() function to get the current environment variable names in space.
# 3. "in" check, we never user string.search() i... | laalaguer/pythonlearn | 01-basic/math_improved.py | Python | mit | 1,306 | 0.004594 |
from django.conf.urls import url
from django.conf.urls import patterns
from pyday_alarms import views
app_name = 'pyday_alarms'
urlpatterns = [
url(r'^alarms/$', views.AlarmView.as_view(), name='alarms'),
]
'''urlpatterns += patterns('pyday_social_network.views',
url(r'^list/$', 'list', na... | 6desislava6/PyDay | pyday_alarms/urls.py | Python | mit | 336 | 0 |
#-----------------------------------------------------------------------------
# Copyright (c) 2017-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... | etherkit/OpenBeacon2 | client/linux-arm/venv/lib/python3.6/site-packages/PyInstaller/hooks/hook-google.cloud.speech.py | Python | gpl-3.0 | 603 | 0.003317 |
# Copyright 2015 Confluent 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, s... | geeag/kafka | tests/kafkatest/tests/client/message_format_change_test.py | Python | apache-2.0 | 4,644 | 0.004522 |
# Copyright 2019 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... | alexgorban/models | official/vision/detection/modeling/retinanet_model.py | Python | apache-2.0 | 6,957 | 0.003881 |
import glob
import os
import json
import sys
import argparse
from collections import defaultdict
ap = argparse.ArgumentParser()
ap.add_argument("-s", "--screen-name", required=True, help="Screen name of twitter user")
args = vars(ap.parse_args())
SEED = args['screen_name']
users = defaultdict(lambda: { 'followers':... | edent/Twitter-Networks | GenerateNetwork.py | Python | mit | 1,614 | 0.005576 |
# Copyright 2012 OpenStack LLC.
# 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... | ntt-sic/python-glanceclient | glanceclient/v2/shell.py | Python | apache-2.0 | 10,082 | 0.000099 |
class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
nums = [0 for _ in xrange(n + 1)]
for i in xrange(1, n + 1):
if i == 1:
nums[1] = 1
elif i == 2:
nums[2] = 2
else:
... | Jacy-Wang/MyLeetCode | ClimbStairs70.py | Python | gpl-2.0 | 393 | 0 |
import rb
import rhythmdb
import dbus
import gconf
from xchat_music_channel.conf import gconf_keys, ConfDialog
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
class XChatMusicChannelPlugin(rb.Plugin):
def activate(self, shell):
gc = gconf.client_get_default()
... | jlecker/rhythmbox-xchat-music-channel | xchat_music_channel/__init__.py | Python | mit | 2,960 | 0.004392 |
#! /usr/bin/env python
'''lint for sets of items
There are many things that really shouldn't exist with a set of items. One
of the biggest is that the dependencies should form a directed acyclic graph,
with absolutely no cycles.
e.g. given the set of items {a.b,c}, if a depends on b, b depends on c,
and c depends ... | anchor/make-magic | tools/lint.py | Python | bsd-3-clause | 3,918 | 0.026289 |
# -*- coding: utf-8 -*-
"""
Unit tests covering the program listing and detail pages.
"""
import json
import re
from urlparse import urljoin
from uuid import uuid4
import mock
from bs4 import BeautifulSoup
from django.conf import settings
from django.urls import reverse, reverse_lazy
from django.test import override_s... | gsehub/edx-platform | lms/djangoapps/learner_dashboard/tests/test_programs.py | Python | agpl-3.0 | 9,854 | 0.00203 |
# 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/compute/azure-mgmt-vmwarecloudsimple/azure/mgmt/vmwarecloudsimple/__init__.py | Python | mit | 706 | 0.002833 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<quiz_slug>[-A-Za-z0-9_]+)/$', views.quiz, name='quiz'),
url(r'^(?P<quiz_slug>[-A-Za-z0-9_]+)/(?P<question_slug>[-A-Za-z0-9_]+)/$', views.question, name='question')
]
| super1337/Super1337-CTF | questionnaire/urls.py | Python | mit | 299 | 0.003344 |
import warnings
from collections import namedtuple, defaultdict
#Node = namedtuple('Node', ('id', 'data', 'edges', 'in_edges'))
#Edge = namedtuple('Edge', ('start', 'end', 'label', 'data', 'directed'))
class MiniGraphError(Exception): pass
class MiniGraphWarning(Warning): pass
# todo: consider functools.lru_cache f... | goodmami/minigraph | minigraph.py | Python | mit | 16,121 | 0.003102 |
#
# Solution to Project Euler problem 52
# Philippe Legault
#
# https://github.com/Bathlamos/Project-Euler-Solutions
import itertools
def compute():
c = 1
while True:
lists = [digits(c * n) for n in range(1, 7)]
if len(set(lists)) == 1: # Check that all elements are equal
return c
c += 1
def digits(n)... | Bathlamos/Project-Euler-Solutions | solutions/p052.py | Python | mit | 451 | 0.035477 |
# Test for creating custom render targets.
from SRPScripting import *
import utils
rt = ri.CreateRenderTarget()
testTexCallback = utils.GetTestTextureCallback(ri, rt, "FullscreenTexture_PS", "tex")
def RenderFrame(context):
context.Clear((1, 0.5, 0, 1), [rt])
testTexCallback(context)
ri.SetFrameCallback(RenderF... | simontaylor81/Syrup | SRPTests/TestScripts/Python/RenderTarget.py | Python | mit | 326 | 0.021472 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
Delaunay.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******************************... | alexgleith/Quantum-GIS | python/plugins/sextante/algs/ftools/Delaunay.py | Python | gpl-2.0 | 4,431 | 0.002257 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-03-19 19:08
from __future__ import unicode_literals
import channels.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migr... | mitodl/open-discussions | channels/migrations/0002_add_subscription.py | Python | bsd-3-clause | 1,675 | 0.000597 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | ilay09/keystone | keystone/tests/unit/identity/backends/test_ldap.py | Python | apache-2.0 | 1,538 | 0 |
#!/usr/bin/python
import sys
sys.path.append("/Users/niels/git/nanokong/tools/python")
import wkpf
from wkpf import WuObject
numericInputWuObject = WuObject(nodeId=1, portNumber=1, wuclassId=3)
lightSensorWuObject = WuObject(nodeId=1, portNumber=2, wuclassId=5)
thresholdWuObjectScenario1 = WuObject(nodeId=1, portNumb... | wukong-m2m/NanoKong | tools/demo20120423/showNodeStatus.py | Python | gpl-2.0 | 3,336 | 0.021882 |
# Copyright (c) 2016, Kevin Rodgers
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
import redis
from uuid import uuid4
UUID = 'uuid'
class SimpleRedisDb(object):
def __init__(self, host, key, port=6379):
"""
:param host: database host
:p... | kfrodgers/active-mail-filter | active_mail_filter/simple_db.py | Python | bsd-2-clause | 3,390 | 0.000295 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import werkzeug
from odoo import http, _
from odoo.addons.auth_signup.models.res_users import SignupError
from odoo.addons.web.controllers.main import ensure_db, Home
from odoo.exceptions import UserError
... | Aravinthu/odoo | addons/auth_signup/controllers/main.py | Python | agpl-3.0 | 6,625 | 0.003774 |
#!/usr/bin/python
#-*-coding:utf8-*-
from bs4 import BeautifulSoup as Soup
#import pandas as pd
import glob
import sys
import re
"""
Version xml de cfdi 3.3
"""
class CFDI(object):
def __init__(self, f):
"""
Constructor que requiere en el parámetro una cadena con el nombre del
cfdi.
... | sergiohzlz/lectorcfdi | extrainfo.py | Python | apache-2.0 | 8,345 | 0.016906 |
from collections.abc import MutableMapping
MYPY = False
if MYPY:
# MYPY is set to True when run under Mypy.
from typing import Any
from typing import Dict
from typing import Iterator
from typing import List
from typing import Optional
from typing import Set
from typing import Text
... | KiChjang/servo | tests/wpt/web-platform-tests/tools/manifest/typedata.py | Python | mpl-2.0 | 10,877 | 0.000827 |
from django.shortcuts import render, redirect
from django.http import HttpResponse
__author__ = 'Nick'
def index(request):
return redirect('/search') | nh0815/PySearch | pysearch/views.py | Python | mit | 154 | 0.012987 |
#!/usr/bin/env python3
#
# SuperTuxKart - a fun racing game with go-kart
# Copyright (C) 2006-2015 SuperTuxKart-Team
#
# 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... | SuicSoft/stk-code | tools/update_characteristics.py | Python | gpl-3.0 | 2,103 | 0.009035 |
import unittest
from stomp import backward3
class TestBackward3(unittest.TestCase):
def test_pack_mixed_string_and_bytes(self):
lines = ['SEND', '\n', 'header1:test', '\u6771']
self.assertEqual(backward3.encode(backward3.pack(lines)),
b'SEND\nheader1:test\xe6\x9d... | GeneralizedLearningUtilities/SuperGLU | python_module/stomp/test/p3_backward_test.py | Python | mit | 884 | 0 |
#============================================================================
# Name : circ-pic.py
# Author : Luke Mondy
# ============================================================================
#
# Copyright (C) 2012 Mondy Luke
#
# This program is free software: you can redistribute it and/or modify
#... | OlympusMonds/PyCircleriser | PyCircleriser.py | Python | gpl-3.0 | 8,228 | 0.007049 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-09 22:56
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('judge', '0038_profile_problem_count'),
]
operations = [
migrations.RemoveField(
... | monouno/site | judge/migrations/0039_remove_contest_is_external.py | Python | agpl-3.0 | 399 | 0 |
# -*- coding:utf-8 -*-
import smtplib
from email.header import Header
from email.mime.text import MIMEText
from email.utils import parseaddr, formataddr
from core.enigma import Enigma
from model.email import Email
from util.config import Config
class EmailSender:
@classmethod
def format_addr(cls, s):
... | AaronGeist/Llama | core/emailsender.py | Python | gpl-3.0 | 1,822 | 0.000551 |
from controllers.job_ctrl import JobController
from models.job_model import JobModel
from views.job_view import JobView
class MainController(object):
def __init__(self, main_model):
self.main_view = None
self.main_model = main_model
self.main_model.begin_job_fetch.connect(self.on_begin_jo... | redline-forensics/auto-dm | controllers/main_ctrl.py | Python | gpl-3.0 | 2,757 | 0.001814 |
#!/usr/bin/python
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | shepdelacreme/ansible | lib/ansible/modules/cloud/openstack/os_volume.py | Python | gpl-3.0 | 5,265 | 0.00133 |
import rppy
import numpy as np
import matplotlib.pyplot as plt
vp1 = 3000
vs1 = 1500
p1 = 2000
e1_1 = 0.0
d1_1 = 0.0
y1_1 = 0.0
e2_1 = 0.0
d2_1 = 0.0
y2_1 = 0.0
d3_1 = 0.0
chi1 = 0.0
C1 = rppy.reflectivity.Cij(vp1, vs1, p1, e1_1, d1_1, y1_1, e2_1, d2_1, y2_1, d3_1)
vp2 = 4000
vs2 = 2000
p2 = 2200
e1_2 = 0.0
d1_2 = 0.... | shear/rppy | temp_test_ortho.py | Python | bsd-2-clause | 1,170 | 0.005128 |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from textwrap import dedent
import pytest
import pytablewriter
from ...._common import print_test_result
from ....data import (
Data,
headers,
mix_header_list,
mix_value_matrix,
null_test_data_list,
value_matrix,
val... | thombashi/pytablewriter | test/writer/text/rst/test_rst_csv_writer.py | Python | mit | 6,875 | 0.001309 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
#
# This file is part of Ansible by Red Hat
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/network/ios/ios_static_route.py | Python | bsd-3-clause | 7,090 | 0.001551 |
from setuptools import setup, find_packages
from dist_job_mgr.version import VERSION
setup(
name='dist_job_mgr',
version=VERSION,
author='genForma Corp',
author_email='code@genforma.com',
url='',
packages=find_packages(),
include_package_data=True,
zip_safe=False,
entry_points = {
... | quaddra/dist_job_mgr | setup.py | Python | apache-2.0 | 639 | 0.00626 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 Clione Software
# Copyright (c) 2010-2013 Cidadania S. Coop. Galega
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... | cidadania/e-cidadania | src/helpers/cache.py | Python | apache-2.0 | 1,903 | 0 |
# coding=utf-8
__author__ = "AstroPrint Product Team <product@astroprint.com>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2017 3DaGoGo, Inc - Released under terms of the AGPLv3 License"
# singleton
_instance = None
def printerProfileManager(... | abinashk-inf/AstroBox | src/astroprint/printerprofile/__init__.py | Python | agpl-3.0 | 2,918 | 0.002742 |
from __future__ import print_function
from __future__ import division
import os
import sys
import numpy as np
import pandas as pd
from ast import literal_eval
try: # run as a package if installed
from pcntoolkit.model.bayesreg import BLR
from pcntoolkit.normative_model.norm_base import NormBase
from pcnt... | amarquand/nispat | pcntoolkit/normative_model/norm_blr.py | Python | gpl-3.0 | 8,464 | 0.006971 |
import os, logging, imp
from autotest_lib.client.bin import test
from autotest_lib.client.common_lib import error
from autotest_lib.client.virt import virt_utils, virt_env_process
class kvm(test.test):
"""
Suite of KVM virtualization functional tests.
Contains tests for testing both KVM kernel code and us... | wuzhy/autotest | client/tests/kvm/kvm.py | Python | gpl-2.0 | 5,376 | 0.000558 |
#
# 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... | highfei2011/spark | python/pyspark/sql/tests/test_serde.py | Python | apache-2.0 | 6,215 | 0.00177 |
import warnings
import numpy as np
from numpy.testing import assert_allclose
import pytest
from scipy.fft._fftlog import fht, ifht, fhtoffset
from scipy.special import poch
def test_fht_agrees_with_fftlog():
# check that fht numerically agrees with the output from Fortran FFTLog,
# the results were generated... | ilayn/scipy | scipy/fft/tests/test_fftlog.py | Python | bsd-3-clause | 5,819 | 0 |
#
# Parse tree nodes
#
from __future__ import absolute_import
import cython
cython.declare(sys=object, os=object, copy=object,
Builtin=object, error=object, warning=object, Naming=object, PyrexTypes=object,
py_object_type=object, ModuleScope=object, LocalScope=object, ClosureScope=obje... | JelleZijlstra/cython | Cython/Compiler/Nodes.py | Python | apache-2.0 | 357,409 | 0.002781 |
# pylint: disable=g-bad-file-header
# Copyright 2015 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/LICENS... | nburn42/tensorflow | tensorflow/python/tools/optimize_for_inference_test.py | Python | apache-2.0 | 13,432 | 0.005435 |
import datetime
from backend import db
from cruds.crud_user_type_destinations.models import UserTypeDestinations
from cruds.crud_users.models import Users
from cruds import format_urls_in_text
class WallMessages(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
date = db.Column(db.In... | sandroandrade/emile-server | cruds/crud_wall_messages/models.py | Python | gpl-3.0 | 1,182 | 0.001692 |
#
# Copyright 2003-2012 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 version 3, or (at your option)
# any later version... | Gabotero/GNURadioNext | gnuradio-runtime/python/gnuradio/gr/tag_utils.py | Python | gpl-3.0 | 1,719 | 0.004072 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('jobs', '0006_auto_20151115_0609'),
]
operations = [
migrations.AlterModelOptions(
name='job',
option... | simeonf/sfpython | sfpython/jobs/migrations/0007_auto_20151115_0614.py | Python | apache-2.0 | 865 | 0.002312 |
MAJOR = 1
MINOR = 0
PATCH = 0
__version__ = "{0}.{1}.{2}".format(MAJOR, MINOR, PATCH)
| Rdbaker/Rank | rank/__init__.py | Python | mit | 87 | 0 |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
# Copyright 2013 IBM Corp.
# Copyright 2013 eNovance <licensing@enovance.com>
# Copyright Ericsson AB 2013. All rights reserved
# Copyright 2014 Hewlett-Packard Company
# Copyright 2015 Huawei Technologies Co., Ltd.
#
# Licensed under the Apache License, Version 2.0... | idegtiarov/ceilometer | ceilometer/api/controllers/v2/base.py | Python | apache-2.0 | 8,636 | 0 |
class Solution(object):
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
for i in range(len(digits) - 1, -1, -1):
if digits[i] < 9:
digits[i] += 1
return digits
digits[i] = 0
new_digi... | yehzhang/RapidTest | examples/solutions/plus_one.py | Python | mit | 400 | 0 |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
#with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-... | jupyter/jupyter-drive | setup.py | Python | bsd-2-clause | 2,752 | 0.002544 |
__author__ = 'asifj'
import logging
from kafka import KafkaConsumer
import json
import traceback
from bson.json_util import dumps
from kafka import SimpleProducer, KafkaClient
from utils import Utils
logging.basicConfig(
format='%(asctime)s.%(msecs)s:%(name)s:%(thread)d:%(levelname)s:%(process)d:%(me... | asifhj/Python_SOAP_OSSJ_SAP_Fusion_Kafka_Spark_HBase | KafkaCP.py | Python | apache-2.0 | 2,510 | 0.003586 |
# 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/security/azure-mgmt-security/azure/mgmt/security/operations/_regulatory_compliance_controls_operations.py | Python | mit | 9,157 | 0.004477 |
# -*- coding: utf-8 -*-
from __future__ import division
from openfisca_core import reforms
from openfisca_france.model.base import FloatCol, Individus, Variable
# Build function
def build_reform(tax_benefit_system):
Reform = reforms.make_reform(
key = 'revenu_de_base_cotisations',
name = u"Réfo... | openfisca/openfisca-france-extension-revenu-de-base | openfisca_france_extension_revenu_de_base/cotisations.py | Python | agpl-3.0 | 7,784 | 0.004758 |
# -*- coding: utf-8 -*-
#
#
# Author: Nicolas Bessi
# Copyright 2013-2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Licen... | Endika/account-invoice-reporting | base_comment_template/__openerp__.py | Python | agpl-3.0 | 1,121 | 0 |
import contextlib
import gc
import multiprocessing
import os
from memsql_loader.util.apsw_storage import APSWStorage
from memsql_loader.util import paths
MEMSQL_LOADER_DB = 'memsql_loader.db'
def get_loader_db_path():
return os.path.join(paths.get_data_dir(), MEMSQL_LOADER_DB)
# IMPORTANT NOTE: This class canno... | memsql/memsql-loader | memsql_loader/loader_db/storage.py | Python | apache-2.0 | 2,959 | 0.000676 |
from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Exiern'
language = 'en'
url = 'http://www.exiern.com/'
start_date = '2005-09-06'
rights = 'Dan Standing'
class Crawler(CrawlerBase):
histor... | datagutten/comics | comics/comics/exiern.py | Python | agpl-3.0 | 784 | 0 |
"""
Created on 04.07.2017
:author: Humbert Moreaux
Tuleap REST API Client for Python
Copyright (c) Humbert Moreaux, All rights reserved.
This Python module 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;... | djurodrljaca/tuleap-rest-api-client | Tuleap/RestClient/PullRequests.py | Python | lgpl-3.0 | 6,833 | 0.002927 |
# Add any code that updates the current probability
# values of any of the nodes here.
# For example, here is a method that updates the probability of
# a single node, where this node is assumed to have a single parent.
def update_node_with_one_parent(n):
'''
For all possible values pv of the current node,
... | uraplutonium/adtree-py | src/BayesUpdating.py | Python | gpl-2.0 | 2,726 | 0.005869 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/Java/JAVAC.py | Python | mit | 2,542 | 0.003934 |
#!/bin/env python
#
# The MIT License (MIT)
#
# Copyright (c) 2015 Billy Olsen
#
# 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... | wolsen/secret-santa | secretsanta/mail.py | Python | mit | 4,308 | 0.001161 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questions', '0013_auto_20160210_0400'),
]
operations = [
migrations.AlterField(
model_name='category',
... | moshthepitt/answers | questions/migrations/0014_auto_20160210_0406.py | Python | mit | 573 | 0 |
import pytest
from amoco.config import conf
conf.UI.formatter = 'Null'
conf.Cas.unicode = False
conf.UI.unicode = False
from amoco.arch.tricore import cpu
def test_decoder_START():
c = b'\x91\x00\x00\xf8'
i = cpu.disassemble(c)
assert i.mnemonic=='MOVH_A'
assert i.operands[0] is cpu.A[15]
assert i.operands... | bdcht/amoco | tests/test_arch_tricore.py | Python | gpl-2.0 | 918 | 0.037037 |
#!/usr/bin/python2.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# $Id$
#
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
#
# 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... | xiangke/pycopia | QA/pycopia/reports/__init__.py | Python | lgpl-2.1 | 17,925 | 0.004965 |
# vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab autoindent
# Altai API Service
# Copyright (C) 2012-2013 Grid Dynamics Consulting Services, Inc
# All Rights Reserved
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License ... | altai/altai-api | altai_api/exceptions.py | Python | lgpl-2.1 | 4,527 | 0.000221 |
# Test inplace special methods enabled by MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS
class A:
def __imul__(self, other):
print("__imul__")
return self
def __imatmul__(self, other):
print("__imatmul__")
return self
def __ifloordiv__(self, other):
print("__ifloordiv__")... | MrSurly/micropython | tests/basics/class_inplace_op2.py | Python | mit | 1,293 | 0.000773 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: type_Result.py
from types import *
class AvailableResult:
def __init__(self):
self.__dict__['available'] = False
def __getattr__(s... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/FlAv/PyScripts/Lib/flav/flav/cmd/flavcontrol/type_Result.py | Python | unlicense | 4,626 | 0.002162 |
# -*- coding:utf-8 -*-
#html_doc = '''<div><a href="http://www.weblio.jp/content/%E5%BD%A2%E5%AE%B9%E5%8B%95%E8%A9%9E" title="形容動詞の意味" class=crosslink>形容動詞</a>「<a href="http://www.weblio.jp/content/%E3%82%A2%E3%83%BC%E3%83%86%E3%82%A3%E3%83%95%E3%82%A3%E3%82%B7%E3%83%A3%E3%83%AB" title="アーティフィシャルの意味" class=crosslink>ア... | pprivulet/DataScience | Dic/getDetail.py | Python | apache-2.0 | 3,537 | 0.015653 |
"""
Gateways connect to Announcer daemons, sending zlib compressed JSON
representations of market data. From here, the Announcer PUBs the messages
out to anyone SUBscribing. This could be Relays, or end-users.
"""
import logging
logger = logging.getLogger(__name__)
import gevent
import zmq.green as zmq
from emdr.conf ... | gtaylor/EVE-Market-Data-Relay | emdr/daemons/announcer/main.py | Python | mit | 1,274 | 0.00314 |
import pprint
import difflib
_MAX_LENGTH = 80
def pretty_diff(d1, d2):
def safe_repr(obj, short=False):
try:
result = repr(obj)
except Exception:
result = object.__repr__(obj)
if not short or len(result) < _MAX_LENGTH:
return result
return res... | Tojaj/yum-metadata-diff | yum_metadata_diff/diff_objects.py | Python | lgpl-2.1 | 10,928 | 0.001647 |
"""
WSGI config for sitefinder_project project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sitefinder_project.settings.... | robjordan/sitefinder | src/sitefinder_project/wsgi.py | Python | mit | 942 | 0.003185 |
# -*- coding: utf-8 -*-
# MLC (Machine Learning Control): A genetic algorithm library to solve chaotic problems
# Copyright (C) 2015-2017, Thomas Duriez (thomas.duriez@gmail.com)
# Copyright (C) 2015, Adrian Durán (adrianmdu@gmail.com)
# Copyright (C) 2015-2017, Ezequiel Torres Feyuk (ezequiel.torresfeyuk@gmail.com)
# ... | MachineLearningControl/OpenMLC-Python | MLC/Population/Creation/IndividualSelection.py | Python | gpl-3.0 | 2,329 | 0.001719 |
#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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... | natbraun/biggraphite | tests/test_drivers_utils.py | Python | apache-2.0 | 1,554 | 0 |
#!/usr/bin/python3
import cgi
import cgitb
import datetime
import json
import os
import re
import requests
import subprocess
import sys
import time
from bmdjson import check_address
print("Content-Type: text/plain\n")
print("testing keybase")
print()
print("PASS:")
signature = "BEGIN KEYBASE SALTPACK SIGNED MESSAG... | joezippy/paywall | test-keybase.py | Python | apache-2.0 | 1,556 | 0.001928 |
# -*- coding: utf-8 -*-
# Copyright 2015-2017 Rooms For (Hong Kong) Limted T/A OSCG
# Copyright 2017 eHanse
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
| rfhk/awo-custom | account_invoice_line_view_oaw/__init__.py | Python | lgpl-3.0 | 199 | 0 |
#!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# not... | joerg84/arangodb | 3rdParty/V8/v5.7.0.0/tools/gen-postmortem-metadata.py | Python | apache-2.0 | 25,114 | 0.01537 |
#
# 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... | Acehaidrey/incubator-airflow | airflow/providers/google/cloud/example_dags/example_automl_nl_text_sentiment.py | Python | apache-2.0 | 3,589 | 0.001115 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/ams/_params.py | Python | mit | 51,064 | 0.004015 |
import os
os.chdir('C:/Users/Ramaneek/SkyDrive/Documents/University/Third Year/CSC320/project 2/')
###########################################################################
## Handout painting code.
###########################################################################
from PIL import Image
from pylab import *... | RamaneekGill/CSC320-Winter-2014 | project 2/p2.py | Python | gpl-2.0 | 12,095 | 0.015048 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='salmon',
version='0.3.0-dev',
description="A simple metric collector with alerts.",
long_description=open('README.rst').read(),
author="Peter Baumgarter",
author_email='pete@lincolnloop.com',
url='https://github.... | lincolnloop/salmon | setup.py | Python | bsd-3-clause | 801 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.