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 -*-
# ===========================================================================
#
# Copyright (C) 2014 Samuel Masuy. All rights reserved.
# samuel.masuy@gmail.com
#
# ===========================================================================
from flask import Flask
# Declare app object
app =... | samuelmasuy/Concordia-Schedule-to-Gcal | app/__init__.py | Python | gpl-2.0 | 448 | 0.002232 |
""" $lic$
Copyright (C) 2016-2020 by Tsinghua University and The Board of Trustees of
Stanford University
This program is free software: you can redistribute it and/or modify it under
the terms of the Modified BSD-3 License as published by the Open Source
Initiative.
This program is distributed in the hope that it wi... | stanford-mast/nn_dataflow | nn_dataflow/core/loop_enum.py | Python | bsd-3-clause | 705 | 0.001418 |
from south.db import db
from django.db import models
from askmeanything.models import *
class Migration:
def forwards(self, orm):
"Write your forwards migration here"
def backwards(self, orm):
"Write your backwards migration here"
models = {
'askmeanything.... | MidwestCommunications/django-askmeanything | askmeanything/migrations/0004_rmpub.py | Python | mit | 4,171 | 0.010309 |
# -*- coding: utf-8 -*-
""" Tests of managing ESX hypervisors directly. If another direct ones will be supported, it should
not be difficult to extend the parametrizer.
"""
import pytest
import random
from cfme.infrastructure.provider import VMwareProvider
from utils.conf import cfme_data, credentials
from utils.net ... | thom-at-redhat/cfme_tests | cfme/tests/infrastructure/test_esx_direct_host.py | Python | gpl-2.0 | 3,626 | 0.001103 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008, TUBITAK/UEKAE
#
# 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.
#
# Plea... | hknyldz/pisitools | pisilinux/pisilinux/db/historydb.py | Python | gpl-3.0 | 4,426 | 0.004293 |
from chainer import cuda
from chainer.functions.math import identity
from chainer import link
class Parameter(link.Link):
"""Link that just holds a parameter and returns it.
.. deprecated:: v1.5
The parameters are stored as variables as of v1.5. Use them directly
instead.
Args:
ar... | kiyukuta/chainer | chainer/links/connection/parameter.py | Python | mit | 1,222 | 0 |
#!/usr/bin/env python
"""Basic example
Demonstrates how to create symbols and print some algebra operations.
"""
from sympy import Symbol, pprint
def main():
a = Symbol('a')
b = Symbol('b')
c = Symbol('c')
e = ( a*b*b + 2*b*a*b )**c
print('')
pprint(e)
print('')
if __name__ == "__main... | sampadsaha5/sympy | examples/beginner/basic.py | Python | bsd-3-clause | 336 | 0.008929 |
import cv2
import numpy as np
import datetime as dt
# constant
faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_alt.xml')
OPENCV_METHODS = {
"Correlation": 0,
"Chi-Squared": 1,
"Intersection": 2,
"Hellinger": 3}
hist_limit = 0.6
ttl = 1 * 60
q_limit = 3
# init variables
total_count = 0
pre... | kvasnyj/face_counter | counter.py | Python | gpl-3.0 | 2,444 | 0.003273 |
# coding: utf-8
#!/usr/bin/env python
#python のバージョン指定:python 3.5.0
#(条件)MeCabをpythonから利用することができる
import sys
import MeCab
import re
import pandas
from PIL import Image
#----外ファイルインポート----
import python_mecab
import get_nlc
import get_day_time
import record
import ans_main_t3
import add_q_main
import main_t3
from k3... | BlueHoleUEC/BlueHoleUEC | ans_main_t3.py | Python | mit | 21,255 | 0.046417 |
""" Test that import errors are detected. """
# pylint: disable=invalid-name, unused-import, no-absolute-import
import totally_missing # [import-error]
try:
import maybe_missing
except ImportError:
maybe_missing = None
try:
import maybe_missing_1
except (ImportError, SyntaxError):
maybe_missing_1 = No... | willemneal/Docky | lib/pylint/test/functional/import_error.py | Python | mit | 419 | 0.004773 |
"""
Copyright (C) 2016 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
... | MediaKraken/MediaKraken_Deployment | source/common/common_metadata_tv_intro.py | Python | gpl-3.0 | 1,725 | 0.001159 |
import unittest
import sys
sys.path.append('./')
solutions = __import__('solutions.012_integer_to_roman', fromlist='*')
class Test012(unittest.TestCase):
def test_intToRoman(self):
s = solutions.Solution()
self.assertEqual(s.intToRoman(1), "I")
self.assertEqual(s.intToRoman(2), "II")
... | abawchen/leetcode | tests/012.py | Python | mit | 1,527 | 0.003929 |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
... | kdart/pycopia | QA/pycopia/smartbits/smartlib.py | Python | apache-2.0 | 8,204 | 0.005241 |
'''
MAP Client, a program to generate detailed musculoskeletal models for OpenSim.
Copyright (C) 2012 University of Auckland
This file is part of MAP Client. (http://launchpad.net/mapclient)
MAP Client is free software: you can redistribute it and/or modify
it under the terms of the GNU General Publi... | MusculoskeletalAtlasProject/mapclient-src | mapclient/widgets/workflowgraphicsview.py | Python | gpl-3.0 | 10,128 | 0.002073 |
# coding:utf-8
from nose.tools import *
from mock import *
import email
import json
from base64 import b64decode
from flanker.mime import create
from flanker.mime.message import errors
from flanker.mime.message.part import MimePart
from email.parser import Parser
from ... import *
def from_python_message_test():... | glyph/flanker | tests/mime/message/create_test.py | Python | apache-2.0 | 10,627 | 0.000292 |
# 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.
import datetime
import logging
import os
import random
import shutil
import StringIO
import sys
import tempfile
from catapult_base import cloud_storage # p... | SummerLW/Perf-Insight-Report | telemetry/telemetry/value/trace.py | Python | bsd-3-clause | 4,564 | 0.008326 |
import unittest
import os
from nose.tools import assert_true
from nose.tools import assert_false
from pyvault import PyVault
from pyvault.backends.file import PyVaultFileBackend
from pyvault.backends.ptree import PyVaultPairtreeBackend
class VaultStore(unittest.TestCase):
"""
testing storing data into the va... | drtoful/pyvault | tests/02_store_test.py | Python | bsd-3-clause | 1,342 | 0.002981 |
import datetime
import os
from django.db.models.fields.files import FileField
from django.core.files.storage import default_storage
from django.utils.encoding import force_unicode, smart_str
class ModelUploadFileField(FileField):
"""
Makes the upload_to parameter optional by using the name of the model
"... | callowayproject/django-articleappkit | articleappkit/fields.py | Python | apache-2.0 | 1,369 | 0.002191 |
# -*- coding: utf8 -*-
u"""
Тесты на ДЗ#5.
"""
__author__ = "wowkalucky"
__email__ = "wowkalucky@gmail.com"
__date__ = "2014-11-17"
import datetime
from hw5_solution1 import Person
def tests_for_hw5_solution1():
u"""Тесты задачи 1"""
petroff = Person("Petrov", "Petro", "1952-01-02")
ivanoff = Person(... | pybursa/homeworks | o_shestakoff/hw5/hw5_tests.py | Python | gpl-2.0 | 953 | 0.001072 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | wojciechtanski/robotframework | src/robot/conf/settings.py | Python | apache-2.0 | 20,981 | 0.003146 |
# -*- coding: utf-8 -*-
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('demosite', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='homepage',
options={'verbose_name': 'homepage'},
),
]
| zerolab/wagtail | wagtail/tests/demosite/migrations/0002_capitalizeverbose.py | Python | bsd-3-clause | 318 | 0 |
#!/usr/bin/env python # pylint: disable=too-many-lines
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ _|_ _|
# | |) | (_) ... | ivanhorvath/openshift-tools | ansible/roles/lib_openshift_3.2/library/oc_secret.py | Python | apache-2.0 | 37,290 | 0.002789 |
# -*- coding: utf-8 -*-
#
# This file is part of CERN Analysis Preservation Framework.
# Copyright (C) 2017 CERN.
#
# CERN Analysis Preservation Framework 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... | tiborsimko/analysis-preservation.cern.ch | tests/integration/test_delete_deposit.py | Python | gpl-2.0 | 7,407 | 0.00243 |
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
success = 0
total =0
def do_GET(self):... | BrandonBaucher/website-optimization | dummy_backend.py | Python | mit | 1,866 | 0.009646 |
"""
This module houses ctypes interfaces for GDAL objects. The following GDAL
objects are supported:
CoordTransform: Used for coordinate transformations from one spatial
reference system to another.
Driver: Wraps an OGR data source driver.
DataSource: Wrapper for the OGR data source object, supports
OGR-su... | rebost/django | django/contrib/gis/gdal/__init__.py | Python | bsd-3-clause | 2,164 | 0.001386 |
from pycp2k.inputsection import InputSection
from ._each406 import _each406
class _restart14(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Add_last = None
self.Common_iteration_levels = None
self.Filename = None
s... | SINGROUP/pycp2k | pycp2k/classes/_restart14.py | Python | lgpl-3.0 | 665 | 0.003008 |
def resizeApp(app, dx, dy):
switchApp(app)
corner = find(Pattern("1273159241516.png").targetOffset(3,14))
dragDrop(corner, corner.getCenter().offset(dx, dy))
resizeApp("Safari", 50, 50)
# exists("1273159241516.png")
# click(Pattern("1273159241516.png").targetOffset(3,14).similar(0.7).firstN(2))
# with Region(10,100... | bx5974/sikuli | sikuli-ide/sample-scripts/resize-app.sikuli/resize-app.py | Python | mit | 380 | 0.018421 |
"""
WSGI config for geology project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | MuhammadSohaib/colorado-geology-geodjango | geology/geology/wsgi.py | Python | mit | 1,562 | 0.00064 |
#
# this file autogenerated, do not touch
#
vers = "asa821"
my_ret_addr_len = 4
my_ret_addr_byte = "\x93\xf2\x2b\x09"
my_ret_addr_snmp = "147.242.43.9"
finder_len = 9
finder_byte = "\x8b\x7c\x24\x14\x8b\x07\xff\xe0\x90"
finder_snmp = "139.124.36.20.139.7.255.224.144"
preamble_len = 41
preamble_byte = "\xb8\... | RiskSense-Ops/CVE-2016-6366 | extrabacon-2.0/versions/shellcode_asa821.py | Python | mit | 4,530 | 0.003311 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2015 Avencall
#
# 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... | docteurmicro50/xivo-provd-plugins | plugins/xivo-snom/common/common.py | Python | gpl-3.0 | 15,004 | 0.001333 |
#!/usr/bin/env python3
import functools
from nxtools import logging, log_traceback
from .utils import (
Qt,
QWidget,
QSlider,
QTimer,
QHBoxLayout,
QVBoxLayout,
QIcon,
RegionBar,
TimecodeWindow,
get_navbar,
)
try:
from .mpv import MPV
has_mpv = True
except OSError:
... | immstudios/firefly | proxyplayer/videoplayer.py | Python | gpl-3.0 | 9,818 | 0.000204 |
## image quickie!
## install PIL (Python Imaging Library) first. Supercool lib
import Image ## from Pil !
fImageOrig = "C:\\evil1.jpg"
im = Image.open(fImageOrig)
print im.size, im.mode
width, height = im.size
## get pixel list
lpix = list(im.getdata())
def getEvenOdd(lpix, width, height):
return getPixels(lp... | tdl/python-challenge | l12_imageEvilReal.py | Python | mit | 3,202 | 0.010618 |
"""
Module with Qt widgets.
"""
from .debug_info import DebugPanelWidget
from .error_tab import ErrorWidget
from .info_panel import InfoPanelPage
from .tree import TreeWidget
from .yaml_editor import YamlEditorWidget
| GeoMop/GeoMop | src/ModelEditor/ui/panels/__init__.py | Python | gpl-3.0 | 218 | 0 |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, Inc.
# 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 cod... | davetcoleman/moveit | moveit_ros/planning_interface/test/python_move_group_ns.py | Python | bsd-3-clause | 3,928 | 0.001527 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
oauthlib.oauth1.rfc5849
~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for signing and checking OAuth 1.0 RFC 5849 requests.
"""
import logging
import sys
import time
try:
import urlparse
except ImportEr... | mozilla/firefox-flicks | vendor-local/lib/python/oauthlib/oauth1/rfc5849/__init__.py | Python | bsd-3-clause | 41,842 | 0.001793 |
# -*- coding: utf-8 -*-
"""
This module implements the base class of tvdbsimple.
Handle automatically login, token creation and response basic stripping.
[See Authentication API section](https://api.thetvdb.com/swagger#!/Authentication)
"""
import json
import requests
class AuthenticationError(Exception):
"""... | axlt2002/script.light.imdb.ratings.update | resources/support/tvdbsimple/base.py | Python | gpl-3.0 | 5,912 | 0.007781 |
#The audio card number to be used; use "aplay -l" output to determine the card number
AUDIO_CARD_NUMBER = 1
# Define the IR/button input pin
INP_PIN = 2
# Speed with which the converted text is to be spoken
TTS_SPEED = 70
# Config server to spawned ot not, set to false if you do not want the config server
CONF... | navin-bhaskar/NewsReader-on-Linkit7688 | config.py | Python | bsd-2-clause | 522 | 0.017241 |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
parse_duration,
unified_strdate,
str_to_int,
float_or_none,
ISO639Utils,
)
class AdobeTVIE(InfoExtractor):
_VALID_URL = r'https?://tv\.adobe\.com/watch/[^/]+/(?P<id>[^/]+)'
_TEST = {
'... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/adobetv.py | Python | unlicense | 4,630 | 0.001728 |
import datetime
from django.conf import settings
from django.db.models import Q
from django.utils import timezone
from django.core.cache import cache
from funfactory.urlresolvers import reverse
from airmozilla.main.models import (
Event,
Channel,
EventHitStats,
most_recent_event
)
from airmozilla.mai... | lcamacho/airmozilla | airmozilla/main/context_processors.py | Python | bsd-3-clause | 12,078 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018 Piero Dalle Pezze
#
# 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 ... | pdp10/sbpipe | sbpipe/utils/dependencies.py | Python | mit | 3,141 | 0.001273 |
# -*- coding: utf-8 -*-
#
# bandicoot documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 28 20:51:43 2014.
#
# 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.
#
#... | ulfaslak/bandicoot | immutable/docs/conf.py | Python | mit | 8,601 | 0.005813 |
# Copyright 2014 Juniper Networks. 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... | cloudwatt/contrail-neutron-plugin | neutron_plugin_contrail/plugins/opencontrail/contrail_plugin.py | Python | apache-2.0 | 28,349 | 0.000106 |
#!/usr/bin/env python3
"""A script to generate FileCheck statements for 'opt' analysis tests.
This script is a utility to update LLVM opt analysis test cases with new
FileCheck patterns. It can either update all of the tests in the file or
a single test function.
Example usage:
$ update_analyze_test_checks.py --opt=... | google/llvm-propeller | llvm/utils/update_analyze_test_checks.py | Python | apache-2.0 | 6,940 | 0.010519 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | bheesham/servo | python/servo/bootstrap_commands.py | Python | mpl-2.0 | 12,893 | 0.002094 |
#!/usr/bin/env python2
'''
Author: xswxm
Blog: xswxm.com
This script will analyze the paylods/tasks assigned by the messager.py
and output the result to display.py.
It also stores most parameters, which are shared between different classes and scripts.
'''
import sys
sys.path.append("..")
from array import array
f... | xswxm/nrf24-injection | utils/config.py | Python | gpl-3.0 | 8,406 | 0.022365 |
"""Tests for the AVM Fritz!Box integration."""
from __future__ import annotations
from typing import Any
from unittest.mock import Mock
from homeassistant.components.fritzbox.const import DOMAIN
from homeassistant.core import HomeAssistant
from .const import (
CONF_FAKE_AIN,
CONF_FAKE_MANUFACTURER,
CONF_... | lukas-hetzenecker/home-assistant | tests/components/fritzbox/__init__.py | Python | apache-2.0 | 3,106 | 0 |
###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2009, Zenoss Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License versi... | zenoss/ZenPacks.community.VMwareESXMonitor | ZenPacks/community/VMwareESXMonitor/modeler/plugins/zenoss/snmp/Esx.py | Python | gpl-2.0 | 1,873 | 0.003203 |
"""Provide functionality to interact with the vlc telnet interface."""
import logging
from python_telnet_vlc import ConnectionError as ConnErr, VLCTelnet
import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
from homeassistant.components.media_player.const impor... | leppa/home-assistant | homeassistant/components/vlc_telnet/media_player.py | Python | apache-2.0 | 7,570 | 0.000132 |
import pytest
from pydantic import BaseModel, Extra, Field, ValidationError, create_model, errors, validator
def test_create_model():
model = create_model('FooModel', foo=(str, ...), bar=123)
assert issubclass(model, BaseModel)
assert issubclass(model.__config__, BaseModel.Config)
assert model.__name... | samuelcolvin/pydantic | tests/test_create_model.py | Python | mit | 6,429 | 0.001555 |
import cython
def test_sizeof():
"""
>>> test_sizeof()
True
True
True
True
True
"""
x = cython.declare(cython.bint)
print(cython.sizeof(x) == cython.sizeof(cython.bint))
print(cython.sizeof(cython.char) <= cython.sizeof(cython.short) <= cython.sizeof(cython.int) <= cython.si... | bzzzz/cython | tests/run/pure_py.py | Python | apache-2.0 | 4,851 | 0.013193 |
"""cairo_museum.py"""
from lib.stage import Stage
class CairoMuseum(Stage):
"""Cairo Museum stage"""
def desc(self):
"""Describe action"""
action = """
After getting the first replicant, you call some old friends and some of them
mentions something about a hippie woman that likes no jokes. ... | brunitto/python-runner | lib/stages/cairo_museum.py | Python | mit | 1,374 | 0 |
# -*- coding: utf-8 -*-
# A search engine based on probabilitistic models of the information retrival.
# Author - Janu Verma
# email - jv367@cornell.edu
# http://januverma.wordpress.com/
# @januverma
import sys
from pydoc import help
import os
from collections import defaultdict
from math import log, sqrt
impo... | Jverma/InfoR | InfoR/ProbabilitisticModels.py | Python | mit | 5,245 | 0.045567 |
#coding: utf-8
# +-------------------------------------------------------------------
# | 宝塔Linux面板
# +-------------------------------------------------------------------
# | Copyright (c) 2015-2016 宝塔软件(http://bt.cn) All rights reserved.
# +-------------------------------------------------------------------
# | Author... | WZQ1397/automatic-repo | python/FileSystem/BTpanel/btclass/panelMysql.py | Python | lgpl-3.0 | 3,122 | 0.02675 |
def at_len(the_list):
"""
Takes a list and returns the number
of atomic elements (basic unit of data)
of the list
:param the_list: a list of elements
:return: the number of atomic elements in the list
"""
count = 0
for each_elem in the_list:
if isinstance(each_elem, list):
... | pegurnee/2015-01-341 | projects/project1_mini_python/python_mini_project.py | Python | mit | 412 | 0.002427 |
import random
class Dice(object):
'''
Generates random numbers by rolling two 'dice'.
The reason for this class existing is so that it can be
mocked and replaced with a deterministic version for
testing.
'''
def roll(self):
'''
Returns two value: the rolls of the two dice... | richard-shepherd/monopyly | monopyly/game/dice.py | Python | mit | 436 | 0 |
#!/usr/bin/env python
from hdf5handler import HDF5Handler
handler = HDF5Handler('mydata.hdf5')
handler.open()
for i in range(100):
handler.put(i, 'numbers')
handler.close()
| iambernie/hdf5handler | examples/opening.py | Python | mit | 183 | 0.005464 |
"""simplify transaction log
Revision ID: 8c2406df6f8
Revises:58732bb5d14b
Create Date: 2014-08-08 01:57:17.144405
"""
# revision identifiers, used by Alembic.
revision = '8c2406df6f8'
down_revision = '58732bb5d14b'
from alembic import op
from sqlalchemy.sql import text
def upgrade():
conn = op.get_bind()
... | nylas/sync-engine | migrations/versions/120_simplify_transaction_log.py | Python | agpl-3.0 | 688 | 0.002907 |
import contextlib
import os
import shutil
import tempfile
import numpy
from PIL import Image
from kiva.fonttools import Font
from kiva.constants import MODERN
class DrawingTester(object):
""" Basic drawing tests for graphics contexts.
"""
def setUp(self):
self.directory = tempfile.mkdtemp()
... | tommy-u/enable | kiva/tests/drawing_tester.py | Python | bsd-3-clause | 5,452 | 0.000183 |
from mpl_toolkits.basemap import Basemap, shiftgrid, maskoceans, interp
import numpy as np
import matplotlib.pyplot as plt
# example showing how to mask out 'wet' areas on a contour or pcolor plot.
topodatin = np.loadtxt('etopo20data.gz')
lonsin = np.loadtxt('etopo20lons.gz')
latsin = np.loadtxt('etopo20lats.gz')
#... | jenshnielsen/basemap | examples/maskoceans.py | Python | gpl-2.0 | 1,922 | 0.021852 |
from gi.repository import Zeitgeist, GLib
log = Zeitgeist.Log.get_default()
mainloop = GLib.MainLoop()
def on_events_received(log, result, data):
events = log.find_events_finish(result)
for i in xrange(events.size()):
event = events.next_value()
if event:
print "Event id:", event.ge... | freedesktop-unofficial-mirror/zeitgeist__zeitgeist | examples/python/find_events.py | Python | lgpl-2.1 | 1,009 | 0.011893 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygtk
pygtk.require('2.0')
import gtk
import json
from collections import namedtuple
from array import *
import pango
import random
from gettext import gettext as _
import copy
''' Scales '''
IMAGES_SCALE = [100, 100]
LETTERS_SCALE = [100, 100]
'''Color Selec... | ggimenez/HomeworkDesigner.activity | template.activity/simpleassociation.py | Python | gpl-2.0 | 17,950 | 0.036331 |
#!/usr/bin/env python
import sys
import time
import socket
import threading
import Queue
import ConfigParser
import logging as log
from connection import *
from connectionManager import *
log.basicConfig(level=log.DEBUG, stream=sys.stderr)
#Dynamically instantiate an instance of an Application-derive... | fos/fos-legacy | scratch/very_scratch/server/example7/webSocketServer.py | Python | bsd-3-clause | 4,050 | 0.008889 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# 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',
... | dataxu/ansible | lib/ansible/modules/network/junos/junos_user.py | Python | gpl-3.0 | 11,343 | 0.001851 |
# class generated by DeVIDE::createDeVIDEModuleFromVTKObject
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class vtkRecursiveDividingCubes(SimpleVTKClassModuleBase):
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
... | nagyistoce/devide | modules/vtk_basic/vtkRecursiveDividingCubes.py | Python | bsd-3-clause | 506 | 0.001976 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | linearregression/luigi | luigi/parameter.py | Python | apache-2.0 | 20,682 | 0.003771 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2014 Kitware 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 cop... | essamjoubori/girder | girder/utility/s3_assetstore_adapter.py | Python | apache-2.0 | 29,780 | 0.000269 |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | tseaver/google-cloud-python | containeranalysis/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py | Python | apache-2.0 | 21,328 | 0.001688 |
"""
Core classes for the XBlock family.
This code is in the Runtime layer, because it is authored once by edX
and used by all runtimes.
"""
import inspect
import pkg_resources
import warnings
from collections import defaultdict
from xblock.exceptions import DisallowedFileError
from xblock.fields import String, List,... | nagyistoce/edx-XBlock | xblock/core.py | Python | apache-2.0 | 9,923 | 0.002721 |
"""
For any given number, we only need to test the primes below it.
e.g. 9 -- we need only test 1,2,3,5,7
e.g. 8 -- we need only test 1,2,3,5,7
for example, the number 12 has factors 1,2,3,6,12.
We could find the six factor but we will find the two factor first.
The definition of a composite number is that it is co... | razzius/PyClassLessons | instructors/course-2015/errors_and_introspection/project/primetester3.py | Python | mit | 969 | 0.004128 |
# encoding: utf-8
# module gio._gio
# from /usr/lib/python2.7/dist-packages/gtk-2.0/gio/_gio.so
# by generator 1.135
# no doc
# imports
import gio as __gio
import glib as __glib
import gobject as __gobject
import gobject._gobject as __gobject__gobject
class FileMonitorEvent(__gobject.GEnum):
# no doc
def __i... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/gio/_gio/FileMonitorEvent.py | Python | gpl-2.0 | 785 | 0.007643 |
# Purpose: using DIMENSION horizontal, vertical and rotated
# Copyright (c) 2018-2021, Manfred Moitzi
# License: MIT License
from typing import cast
import math
import pathlib
import random
import logging
import ezdxf
from ezdxf.tools.standards import setup_dimstyle
from ezdxf.math import Vec3, UCS
from ezdxf.entities... | mozman/ezdxf | examples/render/dimension_linear.py | Python | mit | 24,851 | 0.000563 |
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class StockPicking(models.Model):
_inherit = 'stock.picking'
deliver = fields.Char(string="Deliver at")
| sandrafig/addons | stock_picking_reports/models/stock_picking.py | Python | agpl-3.0 | 179 | 0.005587 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Module containing methods for comment preprocessing (cleaning) """
class Comment(object):
"""
Comment Entity.
Besides getters and setters it handlers simple preprocessing methods
"""
def __init__(self, comment_string):
self._comment = comme... | rluch/InfoMine | infomine/comment.py | Python | mit | 1,716 | 0 |
# Copyright (c) 2008, Humanized, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of ... | berkus/enso | enso/platform/win32/selection/HtmlClipboardFormat.py | Python | bsd-3-clause | 9,263 | 0.014574 |
#!/usr/bin/env python
"""
|jedi| is mostly being tested by what I would call "Blackbox Tests". These
tests are just testing the interface and do input/output testing. This makes a
lot of sense for |jedi|. Jedi supports so many different code structures, that
it is just stupid to write 200'000 unittests in the manner of... | rfguri/vimfiles | bundle/ycm/third_party/ycmd/third_party/JediHTTP/vendor/jedi/test/run.py | Python | mit | 14,446 | 0.000692 |
# Copyright 2015 datawire. 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 or agr... | bozzzzo/quark | quarkc/test/test_parse.py | Python | apache-2.0 | 1,856 | 0.003233 |
income = 15000
if income < 10000:
taxCoefficient = 0.0
elif income < 30000:
taxCoefficient = 0.2
elif income < 100000:
taxCoefficient = 0.35
else:
taxCoefficient = 0.45
print("Need to pay: ", income * taxCoefficient, "in taxes")
flag = False
if flag:
print("a")
print("b")
if flag:
print... | precompiler/python-101 | learning-python/ch03/ConditionalProgramming.py | Python | apache-2.0 | 413 | 0.002421 |
# Teacher Quiz - Python Code - Elizabeth Tweedale
import csv, random
def askName(): # askName function returns the name of the student
print("Welcome to the Super Python Quiz!")
yourName = input("What is your name? ")
print ("Hello",str(yourName... | elizabethtweedale/HowToCode2 | SuperSkill-08-Teacher/Teacher-Quiz.py | Python | gpl-3.0 | 3,594 | 0.010295 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Line(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatter3d.marker"
_path_str = "scatter3d.marker.line"
_valid_props = {
"autocolorscale... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scatter3d/marker/_line.py | Python | mit | 24,077 | 0.000955 |
# Written by Andrea Reale
# see LICENSE.txt for license information
from Tribler.Core.Subtitles.MetadataDomainObjects.SubtitleInfo import SubtitleInfo
from Tribler.Core.Subtitles.MetadataDomainObjects.MetadataDTO import MetadataDTO
from Tribler.Core.CacheDB.SqliteCacheDBHandler import BasicDBHandler
import threading
f... | egbertbouman/tribler-g | Tribler/Core/CacheDB/MetadataDBHandler.py | Python | lgpl-2.1 | 40,875 | 0.013187 |
# -*- coding: utf-8 -*-
import unittest
import trytond.tests.test_tryton
from test_invoice import TestInvoice
def suite():
"""
Define suite
"""
test_suite = trytond.tests.test_tryton.suite()
test_suite.addTests([
unittest.TestLoader().loadTestsFromTestCase(TestInvoice),
])
return... | joeirimpan/trytond-invoice-payment-gateway | tests/__init__.py | Python | bsd-3-clause | 414 | 0.002415 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, erpnext
from frappe import _, throw
from frappe.utils import today, flt, cint, fmt_money, formatdate, getdate
from erpnext.setup.utils im... | bazz-erp/erpnext | erpnext/controllers/accounts_controller.py | Python | gpl-3.0 | 30,488 | 0.024829 |
# # ===============================================================================
# # Copyright 2015 Jake Ross
# #
# # 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.apa... | USGSDenverPychron/pychron | pychron/updater/branch_view.py | Python | apache-2.0 | 2,723 | 0.002571 |
from rtree import index
import numpy as np
#from shapely.prepared import prep
import shapely
def polygon2points(p):
"""
convert a polygon to a sequence of points for DS documents
:param p: shapely.geometry.Polygon
returns a string representing the set of points
"""
return ",".join(l... | Transkribus/TranskribusDU | TranskribusDU/util/geoTools.py | Python | bsd-3-clause | 2,557 | 0.030504 |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import Client, TestCase
from categories.models import Category
class TestCategoryAdmin(TestCase):
def setUp(self):
self.client = Client()
def test_adding_parent_and_child(self):
User.ob... | miceno/django-categories | categories/tests/test_admin.py | Python | apache-2.0 | 1,919 | 0.001563 |
"""Base material for signature backends."""
from django.urls import reverse
class SignatureBackend(object):
"""Encapsulate signature workflow and integration with vendor backend.
Here is a typical workflow:
* :class:`~django_anysign.models.SignatureType` instance is created. It
encapsulates the ba... | novafloss/django-anysign | django_anysign/backend.py | Python | bsd-3-clause | 5,255 | 0 |
#! /usr/bin/env python
# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
#
# 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... | cisco-openstack/tempest | tools/generate-tempest-plugins-list.py | Python | apache-2.0 | 4,796 | 0 |
#!/usr/bin/env python3
import glob
import numpy as np
import pyboof as pb
# Scene recognition is defined here as the problem where you wish to find multiple views of the same scene
# In this example we will load a set of images that has sets of 3 related images. We will tell it to find the 5
# most similar images so ... | lessthanoptimal/PyBoof | examples/scene_recognition.py | Python | apache-2.0 | 2,120 | 0.00283 |
from app import db
from sqlalchemy.dialects.postgresql import JSON
class ChBible(db.Model):
__tablename__ = 'chbible'
id = db.Column(db.Integer, primary_key=True)
bbid = db.Column(db.String())
snt = db.Column(db.String())
snt_lg = db.Column(db.String())
snt_sdg = db.Column(db.String())
d... | HimmelStein/lg-flask | models.py | Python | mit | 578 | 0.00173 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Blueprint
main = Blueprint('main', __name__)
from . import views, errors
| sharkspeed/dororis | packages/python/flask/flask-dog-book/7-chapter/app/main/__init__.py | Python | bsd-2-clause | 143 | 0.006993 |
# 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 ... | BurtBiel/autorest | AutoRest/Generators/Python/Azure.Python.Tests/Expected/AcceptanceTests/AzureResource/setup.py | Python | mit | 1,161 | 0 |
# hgversion.py - Version information for Mercurial
#
# Copyright 2009 Steve Borho <steve@borho.org>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
import re
try:
# post 1.1.2
from mercurial import util
h... | seewindcn/tortoisehg | src/tortoisehg/util/hgversion.py | Python | gpl-2.0 | 1,003 | 0.000997 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE.TXT file)
from django.conf.urls import patterns, include, url
from apps.common.urls import arg_id, arg_slug, arg_username
L = arg_id("link_id")
U = arg_username("username")
urlpatt... | F483/bikesurf.org | apps/account/urls.py | Python | mit | 928 | 0.017241 |
# -*- coding: utf-8 -*-
"""
Cuttle, the simple, extendable ORM.
:license: MIT, see LICENSE for details.
"""
__version__ = '0.9.0.dev'
| smitchell556/cuttle | cuttle/__init__.py | Python | mit | 137 | 0 |
# -*- coding: utf-8 -*-
#
# Copyright © 2014-2019 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, or (at your option) any later
# version. This program is distributed... | release-monitoring/anitya | anitya/tests/lib/backends/test_npmjs.py | Python | gpl-2.0 | 9,246 | 0.000108 |
#!/usr/bin/env python2.6
'''
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
"Licens... | telefonicaid/fiware-cosmos-ambari | ambari-agent/src/main/python/ambari_agent/UpgradeExecutor.py | Python | apache-2.0 | 6,975 | 0.013333 |
from datetime import date
NTESTS = 1
PREV_DAYS = 10
PERCENT_UP = 0.01
PERCENT_DOWN = 0.01
PERIOD = 'Hourly' # [5-min, 15-min, 30-min, Hourly, 2-hour, 6-hour, 12-hour, Daily, Weekly]
MARKET = 'bitstampUSD'
# DATE START
YEAR_START = 2011
MONTH_START = 9
DAY_START = 13
DATE_START = date(YEAR_START, MONTH_START, DAY_STAR... | bukosabino/btctrading | settings.py | Python | mit | 422 | 0.004739 |
from contextlib import contextmanager
import logging
import os.path
import traceback
from kazoo.client import KazooClient
from kazoo.exceptions import (
LockTimeout,
NodeExistsError,
NoNodeError,
KazooException,
ZookeeperError,
)
from kazoo.retry import KazooRetry, RetryFailedError
from mastermind.... | yandex/mastermind | src/cocaine-app/sync/kazoo_impl/__init__.py | Python | gpl-2.0 | 8,087 | 0.002844 |
class PluginBase(object):
name = ''
doc = 'doc about this class'
methods_subclass = {}
def __init__(self, **kwargs):
self.methods = {
'help': 'doc about help method',
'get_methods': 'doc about get_methods method'
}
self.methods.update(self.methods_subclas... | Bakterija/mmplayer | mmplayer/kivy_soil/terminal_widget/plugins/_base.py | Python | mit | 4,885 | 0 |
# Copyright 2022 The Kubric 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 in wr... | google-research/kubric | examples/shapenet.py | Python | apache-2.0 | 3,800 | 0.002368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.