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 |
|---|---|---|---|---|---|---|
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
new_default = orm.Extension._meta.get_field_by_name('icon')[0].default
for ... | magcius/sweettooth | sweettooth/extensions/migrations/0008_new_icon_default.py | Python | agpl-3.0 | 6,118 | 0.007192 |
"""
Visualize possible stitches with the outcome of the validator.
"""
import math
import random
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import stitcher
SPACE = 25
TYPE_FORMAT = {'a': '^', 'b': 's', 'c': 'v'}
def show(graphs, request, title... | tmetsch/graph_stitcher | stitcher/vis.py | Python | mit | 5,618 | 0 |
from gpiozero import Button
from picamera import PiCamera
from datetime import datetime
from signal import pause
button = Button(2)
camera = PiCamera()
def capture():
timestamp = datetime.now().isoformat()
camera.capture('/home/pi/{timestamp}.jpg'.format(timestamp=timestamp))
button.when_pressed = capture
p... | waveform80/gpio-zero | docs/examples/button_camera_1.py | Python | bsd-3-clause | 327 | 0.006116 |
""":mod:`earthreader.web.exceptions` --- Exceptions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from flask import jsonify
from werkzeug.exceptions import HTTPException
class IteratorNotFound(ValueError):
"""Raised when the iterator does not exist"""
class JsonException(HTTPException):
"""Base e... | earthreader/web | earthreader/web/exceptions.py | Python | agpl-3.0 | 1,387 | 0 |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=2>
# Usage of IC 7433
# <codecell>
from __future__ import print_function
from BinPy import *
# <codecell>
# Usage of IC 7433:
ic = IC_7433()
print(ic.__doc__)
# <codecell>
# The Pin configuration is:
inp = {2: 0, 3: 0, 5: 0, 6: 0, 7: 0, ... | daj0ker/BinPy | BinPy/examples/source/ic/Series_7400/IC7433.py | Python | bsd-3-clause | 1,247 | 0.001604 |
"""
Django settings for kore project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... | City-of-Helsinki/kore | kore/settings.py | Python | agpl-3.0 | 4,485 | 0.000892 |
import _plotly_utils.basevalidators
class TextfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="textfont", parent_name="funnelarea", **kwargs):
super(TextfontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/funnelarea/_textfont.py | Python | mit | 1,867 | 0.000536 |
# Copyright 2012 Big Switch Networks, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | shakamunyi/neutron-dvr | neutron/plugins/bigswitch/plugin.py | Python | apache-2.0 | 51,022 | 0.000098 |
from troposphere import Tags,FindInMap, Ref, Template, Parameter,ImportValue, Ref, Output
from troposphere.efs import FileSystem, MountTarget
from troposphere.ec2 import SecurityGroup, SecurityGroupRule, Instance, Subnet
from create import export_ref, import_ref
from create.network import AclFactory, assoc_nacl_subnet
... | gotropo/gotropo | create/efs.py | Python | gpl-3.0 | 2,807 | 0.006769 |
import os
import sys
import logging
from pyomo.environ import *
from pyomo.opt import TerminationCondition
import numpy as np
import pandas as pd
class CALVIN():
def __init__(self, linksfile, ic=None, log_name="calvin"):
"""
Initialize CALVIN model object.
:param linksfile: (string) CSV file containin... | msdogan/pyvin | calvin/calvin.py | Python | mit | 16,224 | 0.013745 |
from collections import defaultdict
class CategoricalVariableEncoder(object):
def convert_categorical_variables(self, data_matrix, category_indices, category_value_mapping=None):
if len(category_indices) == 0:
return data_matrix
if category_value_mapping == None:
category_v... | wangjohn/wallace | wallace/categorical_variable_encoder.py | Python | mit | 1,836 | 0.003268 |
from ai import action
class MoveAction(action.Action):
def __init__(self, performer, direction):
super().__init__(performer)
self.direction = direction
def prerequisite(self):
if not self.direction:
return False
return self.performer.can_move(*self.direction)
... | JoshuaSkelly/lunch-break-rl | ai/actions/moveaction.py | Python | mit | 385 | 0 |
from tornado.web import HTTPError
import datetime
import threading
from astral.api.client import TicketsAPI
from astral.api.handlers.base import BaseHandler
from astral.api.handlers.tickets import TicketsHandler
from astral.models import Ticket, Node, Stream, session
import logging
log = logging.getLogger(__name__)
... | peplin/astral | astral/api/handlers/ticket.py | Python | mit | 4,822 | 0.002489 |
import tkinter.filedialog as tkFileDialog
import numpy as np
from numpy import sin,cos
import os
def InnerOrientation(mat1,mat2):
"""
mat1 为像素坐标,4*2,mat2为理论坐标4*2,
h0,h1,h2,k0,k1,k2,这六个参数由下列矩阵定义:
[x]=[h0]+[h1 h2] [i]
[y]=[k0]+[k1 k2] [j]
返回6个定向参数的齐次矩阵,x方向单位权方差,y方向单位权方差
[h1 h2 h0]
[k1 k2 ... | YU6326/YU6326.github.io | code/photogrammetry/inner_orientation.py | Python | mit | 3,899 | 0.020569 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
default_app_config = 'accounts.apps.Accounts... | ta2-1/pootle | pootle/apps/accounts/__init__.py | Python | gpl-3.0 | 328 | 0 |
import sys
from PIL import Image
img = Image.open(sys.argv[1])
width, height = img.size
xblock = 5
yblock = 5
w_width = width / xblock
w_height = height / yblock
blockmap = [(xb*w_width, yb*w_height, (xb+1)*w_width, (yb+1)*w_height)
for xb in xrange(xblock) for yb in xrange(yblock)]
newblockmap = list(bloc... | BilalDev/HolyScrap | src/hsimage.py | Python | apache-2.0 | 1,247 | 0.000802 |
from django.db import models
from django.conf import settings
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class FoiSite(models.Model):
country_code = models.CharField(_('Coun... | LilithWittmann/froide | froide/foisite/models.py | Python | mit | 1,944 | 0.001029 |
import os
def remove_fname_extension(fname):
return os.path.splitext(fname)[0]
def change_fname_extension(fname, extension):
return remove_fname_extension(fname) + '.' + extension
def concat(path, fname):
return path + '/' + fname | matt77hias/FileUtils | src/name.py | Python | gpl-3.0 | 249 | 0.02008 |
#!/usr/bin/python
import psutil
import signal
#From https://github.com/getchar/rbb_article
target = "HelpfulAppStore"
# scan through processes
for proc in psutil.process_iter():
if proc.name() == target:
print(" match")
proc.send_signal(signal.SIGUSR1)
| jamesnw/HelpfulAppStoreBot | kill_bot.py | Python | gpl-2.0 | 277 | 0.00361 |
"""Layout provider for Ansible source."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ... import types as t
from . import (
ContentLayout,
LayoutProvider,
)
class AnsibleLayout(LayoutProvider):
"""Layout provider for Ansible source."""
@sta... | amenonsen/ansible | test/lib/ansible_test/_internal/provider/layout/ansible.py | Python | gpl-3.0 | 1,396 | 0.002149 |
# Copyright 2012, Intel, 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 agree... | bswartz/cinder | cinder/volume/rpcapi.py | Python | apache-2.0 | 15,156 | 0 |
# -*- coding: utf-8 -*-
import os
os_env = os.environ
class Config(object):
SECRET_KEY = os_env.get('DYNAMICFORMS_SECRET', 'secret-key') # TODO: Change me
APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir))
BCRYPT_LOG... | ossifrage/dynamicforms | dynamicforms/settings.py | Python | bsd-3-clause | 1,384 | 0.002168 |
#!/usr/bin/env python2.2
#-----------------------------------------------------------------------------
# Name: wxPyPlot.py
# Purpose:
#
# Author: Gordon Williams
#
# Created: 2003/11/03
# RCS-ID: $Id$
# Copyright: (c) 2002
# Licence: Use as you wish.
#----------------------------------... | nagyistoce/devide | external/wxPyPlot.py | Python | bsd-3-clause | 57,752 | 0.015844 |
#!/usr/bin/env python
# Copyright 2014 the V8 project 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 unittest
from pool import Pool
def Run(x):
if x == 10:
raise Exception("Expected exception triggered by test.")
retu... | CTSRD-SOAAP/chromium-42.0.2311.135 | v8/tools/testrunner/local/pool_unittest.py | Python | bsd-3-clause | 1,222 | 0.00982 |
import logging
import urllib
from typing import Any, Dict, List, Mapping, Tuple, Union
import orjson
import requests
from django.conf import settings
from django.forms.models import model_to_dict
from django.utils.translation import gettext as _
from analytics.models import InstallationCount, RealmCount
from version ... | andersk/zulip | zerver/lib/remote_server.py | Python | apache-2.0 | 7,292 | 0.00192 |
import subprocess
import os
def start_service():
subprocess.Popen("ipy start_srv.py", stdout=subprocess.PIPE)
return 0
def close_service():
os.system("taskkill /im ipy.exe /f")
| QuentinJi/pyuiautomation | initial_work.py | Python | mit | 193 | 0 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import re
from cfgm_common import jsonutils as json
import time
import gevent
import disc_consts
import disc_exceptions
from datetime import datetime
from gevent.coros import BoundedSemaphore
import pycassa
import pycassa.util
from pycassa.system_ma... | facetothefate/contrail-controller | src/discovery/disc_cassdb.py | Python | apache-2.0 | 14,755 | 0.009353 |
"""List of supported formats
"""
from collections import namedtuple
_FORMAT = namedtuple('FormatDefinition', 'mime_type,'
'extension, schema')
_FORMATS = namedtuple('FORMATS', 'GEOJSON, JSON, SHP, GML, GEOTIFF, WCS,'
'WCS100, WCS110, WCS20, WFS, WFS100,'
... | ricardogsilva/PyWPS | pywps/inout/formats/lists.py | Python | mit | 1,471 | 0.00068 |
from flask import Flask,request, jsonify
import json
app = Flask(__name__)
@app.route("/")
def rutaStatus():
return jsonify(status='OK')
@app.route("/status")
def rutaStatusDocker():
return jsonify(status='OK')
if __name__ == "__main__":
app.run(host='0.0.0.0', port=80)
| mariofg92/ivmario | web2.py | Python | gpl-3.0 | 286 | 0.013986 |
# Copyright 2014 Rackspace, Inc.
# All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | supermari0/ironic | ironic/dhcp/none.py | Python | apache-2.0 | 1,015 | 0 |
import sys
import time
import numpy as np
from copy import deepcopy
import tensorflow as tf
import babi_input
class Config(object):
"""Holds model hyperparams and data information."""
batch_size = 100
embed_size = 80
hidden_size = 80
max_epochs = 256
early_stopping = 20
dropout = 0.9
... | kevinadda/dmn-chatbot | dmn_plus.py | Python | mit | 15,738 | 0.004384 |
from datetime import timedelta
from math import copysign
def is_workingday(input_date):
return input_date.isoweekday() < 6
def add(datestart, days):
sign = lambda x: int(copysign(1, x))
dateend = datestart
while days:
dateend = dateend + timedelta(days=sign(days))
if is_workingday(date... | baxeico/pyworkingdays | workingdays/__init__.py | Python | mit | 947 | 0.006336 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import, unicode_literals
import sys
import os
import six
from mog_commons import unittest
class TestUnitTest(unittest.TestCase):
def test_assert_output(self):
def f():
print('abc')
print('123')
... | mogproject/mog-commons-python | tests/mog_commons/test_unittest.py | Python | apache-2.0 | 3,948 | 0.003214 |
'''
Carousel
========
.. versionadded:: 1.4.0
The :class:`Carousel` widget provides the classic mobile-friendly carousel view
where you can swipe between slides.
You can add any content to the carousel and use it horizontally or verticaly.
The carousel can display pages in loop or not.
Example::
class Example1(... | niavlys/kivy | kivy/uix/carousel.py | Python | mit | 21,776 | 0.000092 |
from django.dispatch import Signal
user_email_bounced = Signal() # args: ['bounce', 'should_deactivate']
email_bounced = Signal() # args: ['bounce', 'should_deactivate']
email_unsubscribed = Signal() # args: ['email', 'reference']
| fin/froide | froide/bounce/signals.py | Python | mit | 236 | 0 |
#!/usr/bin/env python
#
# Copyright 2006 Google 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 o... | tzuria/Shift-It-Easy | webApp/shift-it-easy-2015/web/pages/MainManager.py | Python | mit | 87,797 | 0.038361 |
# Copyright (c) 2011, Peter Thatcher
# 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 conditi... | pthatcher/psync | src/exp/watch.py | Python | bsd-3-clause | 2,850 | 0.005965 |
# Copyright (c) 2016, Xilinx, 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 con... | schelleg/PYNQ | pynq/lib/logictools/tests/test_boolean_generator.py | Python | bsd-3-clause | 14,127 | 0.000354 |
# -*- coding: utf-8 -*-
"""
@brief test log(time=92s)
"""
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import get_temp_folder, add_missing_development_version
import ensae_teaching_cs
class TestNotebookRunner1a_soft_sql(unittest.TestCase):
def setUp(self):
add_m... | sdpython/ensae_teaching_cs | _unittests/ut_dnotebooks/test_1A_notebook_soft_sql.py | Python | mit | 1,241 | 0.002417 |
import os
IGNORE = (
"/test/",
"/tests/gtests/",
"/BSP_GhostTest/",
"/release/",
"/xembed/",
"/TerraplayNetwork/",
"/ik_glut_test/",
# specific source files
"extern/Eigen2/Eigen/src/Cholesky/CholeskyInstantiations.cpp",
"extern/Eigen2/Eigen/src/Core/CoreInstantiations.cpp",
... | pawkoz/dyplom | blender/build_files/cmake/cmake_consistency_check_config.py | Python | gpl-2.0 | 4,572 | 0.006124 |
"""linter_test_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='hom... | David-Wobrock/django-fake-database-backends | tests/test_project/test_project/urls.py | Python | mit | 776 | 0 |
##
## This file is part of the libsigrok project.
##
## Copyright (C) 2014 Martin Ling <martin-sigrok@earth.li>
##
## 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 Lice... | mtitinger/libsigrok | bindings/swig/doc.py | Python | gpl-3.0 | 4,655 | 0.005371 |
# Copyright 2015 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.
"""A module for storing and getting objects from datastore.
This module provides Get, Set and Delete functions for storing pickleable
objects in datastore, ... | SummerLW/Perf-Insight-Report | dashboard/dashboard/stored_object.py | Python | bsd-3-clause | 6,638 | 0.008888 |
def extractLittlebambooHomeBlog(item):
'''
Parser for 'littlebamboo.home.blog'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('FW', 'Fortunate Wife', 'translated'),
... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractLittlebambooHomeBlog.py | Python | bsd-3-clause | 622 | 0.028939 |
#@+leo-ver=5-thin
#@+node:2014spring.20140628104046.1746: * @file openshiftlibs.py
#@@language python
#@@tabwidth -4
#@+others
#@+node:2014spring.20140628104046.1747: ** openshiftlibs declarations
#!/usr/bin/env python
import hashlib, inspect, os, random, sys
#@+node:2014spring.20140628104046.1748: ** get_openshift_s... | coursemdetw/2015wcms | wsgi/openshift/openshiftlibs.py | Python | gpl-2.0 | 3,730 | 0.008043 |
#! usr/bin/python3
# -*- coding: utf8 -*-
import datetime
import json
import os
from flask_script import Command
from scripts.users_export_to_json import json_user_file
from application import db
from application.flicket.models.flicket_user import FlicketUser
class JsonUser:
def __init__(self,... | evereux/flicket | scripts/users_import_from_json.py | Python | mit | 2,390 | 0.00251 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "RandomPasswordGenerator.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other... | AgapiGit/RandomPasswordGenerator | RandomPasswordGenerator/manage.py | Python | mit | 843 | 0.001186 |
from datetime import datetime
import logging
import sys
from django.conf import settings
log = logging.getLogger('agro.sources')
tree_modules_to_try = [ "xml.etree.cElementTree", "elementtree.ElementTree", "cElementTree", ]
element_tree = None
for tree in tree_modules_to_try:
try:
try:
eleme... | camflan/agro | agro/sources/__init__.py | Python | bsd-3-clause | 1,319 | 0.006823 |
# -*- coding: utf-8 -*-
"""
@file
@brief Customer notebook exporters.
"""
import os
from textwrap import indent
from traitlets import default
from traitlets.config import Config
from jinja2 import DictLoader
from nbconvert.exporters import RSTExporter
from nbconvert.filters.pandoc import convert_pandoc
def convert_pa... | sdpython/pyquickhelper | src/pyquickhelper/helpgen/notebook_exporter.py | Python | mit | 4,770 | 0.001048 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import math
import numpy as np
from scipy.interpolate import interp1d
def _avgdiff(x):
dx = np.diff(x)
dx2 = np.zeros_like(x)
dx2[0], dx2[-1] = dx[0], dx[-1]
dx2[1:-1] = 0.5 * (dx[1:] + dx[:-1])
return dx2
... | bjodah/finitediff | finitediff/grid/rebalance.py | Python | bsd-2-clause | 4,269 | 0.000937 |
# -*- 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... | torypages/luigi | test/contrib/pig_test.py | Python | apache-2.0 | 5,241 | 0.001336 |
from django.core.management.base import BaseCommand, CommandError
from survey.models import Record
from fuzzywuzzy import fuzz
class Command(BaseCommand):
help = 'Finds fuzzy name matches and allows to alter their relation'
def add_arguments(self, parser):
parser.add_argument('start', nargs='?', type=... | simonspa/django-datacollect | datacollect/survey/management/commands/edit_relations.py | Python | gpl-3.0 | 2,980 | 0.00906 |
# Importing Modules from PyQt5
from PyQt5.QtWidgets import QSizePolicy, QPushButton, QFrame, QWidget, QStackedWidget
from PyQt5.QtGui import QColor
# Importing Modules from the App
from Gui import Table, Plot, Funcs, Budget
from Settings import StyleSheets as St
def smallerNumber(number1, number2):
if number1 < n... | 95ellismle/FinancesApp2 | Gui/App.py | Python | gpl-3.0 | 3,438 | 0.013089 |
#!/usr/bin/env python
import os, sys
sys.path.insert( 0, os.path.dirname( __file__ ) )
from common import delete
try:
assert sys.argv[2]
except IndexError:
print 'usage: %s key url [purge (true/false)] ' % os.path.basename( sys.argv[0] )
sys.exit( 1 )
try:
data = {}
data[ 'purge' ] = sys.argv[3]
e... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/scripts/api/history_delete_history.py | Python | gpl-3.0 | 389 | 0.03856 |
#!/usr/bin/env python
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# BornProfiler --- A package to calculate electrostatic free energies with APBS
# Written by Kaihsu Tai, Lennard van der Feltz, and Oliver Beckstein
# Released under th... | Becksteinlab/BornProfiler | scripts/apbs-bornprofile-init.py | Python | gpl-3.0 | 1,462 | 0.008208 |
# -*- coding: utf-8 -*-
import re
import pandas as pd
from scrapy.spiders import Spider
from scrapy.selector import Selector
from ..parsing.zone import (
CityZoneParser,
EPCIZoneParser,
DepartmentZoneParser,
RegionZoneParser
)
from ..item import LocalFinance
from ..utils import DOM_DEP_MAPPING, unifo... | regardscitoyens/nosfinanceslocales_scraper | localfinance/spiders/localfinance_spider.py | Python | mit | 7,108 | 0.004361 |
""" :mod:`eleve.segment`
==========================
The segmenter is available by importing ``eleve.Segmenter``. It is used to
segment sentences (regroup tokens that goes together).
"""
import logging
from math import isnan
logger = logging.getLogger(__name__)
class Segmenter:
def __init__(self, storage, max_... | kodexlab/eleve | eleve/segment.py | Python | lgpl-3.0 | 6,623 | 0.004379 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the output modules CLI arguments helper."""
import argparse
import unittest
from plaso.cli import tools
from plaso.cli.helpers import output_modules
from plaso.lib import errors
from tests.cli import test_lib as cli_test_lib
class OutputModulesArgumentsHe... | kiddinn/plaso | tests/cli/helpers/output_modules.py | Python | apache-2.0 | 2,511 | 0.002788 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2008 Francisco José Rodríguez Bogado #
# (pacoqueen@users.sourceforge.net) #
# ... | pacoqueen/upy | formularios/consulta_ventas_ticket.py | Python | gpl-2.0 | 19,273 | 0.009814 |
__all__ = ['gtk_element_editor', 'main_window_handler', 'sortiment', 'window_creator', 'error_handler']
| peto2006/sortiment-frontent | sortimentGUI/__init__.py | Python | mit | 104 | 0.009615 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Red Hat, 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
#
... | tylertian/Openstack | openstack F/nova/nova/tests/cert/test_rpcapi.py | Python | apache-2.0 | 3,147 | 0 |
"""Django app config for the analytics app."""
from django.apps import AppConfig
class AnalyticsAppConfig(AppConfig):
"""Analytics app init code."""
name = 'readthedocs.analytics'
verbose_name = 'Analytics'
| rtfd/readthedocs.org | readthedocs/analytics/apps.py | Python | mit | 224 | 0 |
#!/usr/bin/env python3
import logging
from . import SubprocessHook
logger = logging.getLogger("barython")
class PulseAudioHook(SubprocessHook):
"""
Listen on pulseaudio events with pactl
"""
def __init__(self, cmd=["pactl", "subscribe", "-n", "barython"],
*args, **kwargs):
... | Anthony25/barython | barython/hooks/audio.py | Python | bsd-3-clause | 363 | 0 |
import numpy as np
import pygame
from sklearn.mixture import GMM
from math import sqrt, atan, pi
def emFit(results, numComponents):
if len(results) == 0:
return None
m =np.matrix(results)
gmm = GMM(numComponents,covariance_type='full', n_iter= 100, n_init = 4)
gmm.fit(results)
component... | sondree/Master-thesis | Python Simulator/simulator/FMM.py | Python | gpl-3.0 | 2,479 | 0.020976 |
import unittest
from chainer import cuda
from chainer import initializers
from chainer import testing
from chainer.testing import attr
import numpy
@testing.parameterize(*testing.product({
'target': [
initializers.Uniform,
initializers.LeCunUniform,
initializers.HeUniform,
initial... | kiyukuta/chainer | tests/chainer_tests/initializer_tests/test_uniform.py | Python | mit | 1,548 | 0 |
#!/usr/bin/env python
#
# (c) 2013 Joost Yervante Damad <joost@damad.be>
# License: GPL
VERSION='1.2.1'
import glob, sys, platform
from setuptools import setup
with open('README.md') as file:
long_description = file.read()
arch = platform.uname()[4]
extra_data_files = []
if sys.platform == 'darwin':
OPTION... | spanner888/madparts | setup.py | Python | gpl-3.0 | 3,599 | 0.012781 |
"""
IAudioEndpointVolumeCallback.OnNotify() example.
The OnNotify() callback method gets called on volume change.
"""
from __future__ import print_function
from ctypes import POINTER, cast
from comtypes import CLSCTX_ALL, COMObject
from pycaw.pycaw import (AudioUtilities, IAudioEndpointVolume,
... | AndreMiras/pycaw | examples/volume_callback_example.py | Python | mit | 950 | 0 |
#!/bin/python3
import sys
n = int(input().strip())
s = input().strip()
k = int(input().strip())
d = {}
for c in (65, 97):
for i in range(26):
d[chr(i+c)] = chr((i+k) % 26 + c)
print(''.join([d.get(c, c) for c in s]))
| avtomato/HackerRank | Algorithms/_03_Strings/_04_Caesar_Cipher/solution.py | Python | mit | 233 | 0 |
import sys
vi = sys.version_info
if vi < (3, 5):
raise RuntimeError('httptools require Python 3.5 or greater')
else:
import os.path
import pathlib
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as build_ext
CFLAGS = ['-O2']
ROOT = pathlib.Path(__file_... | MagicStack/httptools | setup.py | Python | mit | 7,252 | 0 |
from django import forms
from faculty.event_types.base import BaseEntryForm
from faculty.event_types.base import CareerEventHandlerBase
from faculty.event_types.choices import Choices
from faculty.event_types.base import TeachingAdjust
from faculty.event_types.fields import TeachingCreditField
from faculty.event_types... | sfu-fas/coursys | faculty/event_types/position.py | Python | gpl-3.0 | 2,366 | 0.000845 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Ansible Project
# 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',
... | thaim/ansible | lib/ansible/modules/cloud/kubevirt/kubevirt_template.py | Python | mit | 14,884 | 0.004367 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.forms import models
from djanban.apps.hourly_rates.models import HourlyRate
from django import forms
# Hourly rate creation and edition form
class HourlyRateForm(models.ModelForm):
clas... | diegojromerolopez/djanban | src/djanban/apps/hourly_rates/forms.py | Python | mit | 1,137 | 0.001759 |
import os
import sys
import pandas as pd
import numpy as np
from numpy.random import poisson, uniform
from numpy import mean
import time
import math
po = True
teamsheetpath = sys.path[0] + '/teamcsvs/'
compstat = {'TDF': 'TDA', 'TDA': 'TDF', #Dictionary to use to compare team stats with opponent stats
'F... | JoeJimFlood/NFLPrediction2014 | matchup.py | Python | mit | 10,272 | 0.007496 |
#!/usr/bin/python
from __future__ import print_function
import random
import re
import datetime
import os
import sys
import time
from optparse import make_option
import urllib2
import tarfile
from multiprocessing import cpu_count
from django.conf import settings
from django.core.management.base import BaseCommand
from... | chrisspen/asklet | asklet/management/commands/asklet_load_conceptnet.py | Python | lgpl-3.0 | 9,742 | 0.005646 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | sparkslabs/kamaelia_ | Sketches/RJL/Packages/Examples/P2PStreamPeer/p2pstreampeer.py | Python | apache-2.0 | 10,507 | 0.007233 |
#!/usr/bin/env python
# encoding: utf-8
import pytest
from conftests import *
from rurouni.exceptions import *
from rurouni.types import *
from rurouni import Database, Column, Table
def test_column_appending(ldb):
'''
Checks column appending. To simulate this behaviour just adds two different
classes po... | magnunleno/Rurouni | tests/test_table_migration.py | Python | gpl-3.0 | 2,788 | 0.002869 |
# coding=UTF-8
'''
Created on 24.09.2017
@author: sysoev
'''
from google.appengine.ext import db
from google.appengine.api import users
import datetime
import time
import logging
from myusers import MyUser
def force_unicode(string):
if type(string) == unicode:
return string
return string.decode('ut... | sysoevss/WebApps17 | data.py | Python | mit | 2,774 | 0.004326 |
import csv
import gzip
def save_vector(vector, output_fname):
"""
Save the any type of vector for future use.
This could be ratings, predictions or the content vector
Results need to be collected to the local history before being read out
Args:
vector: either user ratings, predictions or t... | tiffanyj41/hermes | src/utils/save_load.py | Python | apache-2.0 | 3,756 | 0.004526 |
"""
functions for evaluating spreadsheet functions
primary function is parse, which the rest revolves around
evaluate should be called with the full string by a parent program
A note on exec:
This uses the exec function repeatedly, and where possible, use of it
should be minimized, but the intention of this ... | TryExceptElse/pysheetdata | eval/parser.py | Python | mit | 4,789 | 0 |
from eventlet import patcher
from eventlet.green import BaseHTTPServer
from eventlet.green import threading
from eventlet.green import socket
from eventlet.green import urllib2
patcher.inject('test.test_urllib2_localnet',
globals(),
('BaseHTTPServer', BaseHTTPServer),
('threading', threading),
('socke... | JeremyGrosser/python-eventlet | tests/stdlib/test_urllib2_localnet.py | Python | mit | 410 | 0.007317 |
from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "WYE"
addresses_name = "2021-03-29T13:16:10.236797/Democracy_Club__06May2021.tsv"
stations_name = "2021-03-29T13:16:10.236797/Democracy_Club__06May2021.tsv"
... | DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_importers/management/commands/import_wyre_forest.py | Python | bsd-3-clause | 949 | 0.001054 |
# -*- coding: utf-8 -*-
#
# Author: Joël Grand-Guillaume
# Copyright 2013 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... | jgrandguillaume/vertical-ngo | logistic_budget/wizard/cost_estimate.py | Python | agpl-3.0 | 1,462 | 0 |
from SBaaS_base.postgresql_orm_base import *
class data_stage01_rnasequencing_analysis(Base):
__tablename__ = 'data_stage01_rnasequencing_analysis'
id = Column(Integer, Sequence('data_stage01_rnasequencing_analysis_id_seq'), primary_key=True)
analysis_id = Column(String(500))
experiment_id = Column(Str... | dmccloskey/SBaaS_rnasequencing | SBaaS_rnasequencing/stage01_rnasequencing_analysis_postgresql_models.py | Python | mit | 2,579 | 0.027918 |
# standard library
import logging
# Django
from django.contrib.auth.models import BaseUserManager
# logger instance
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class UserManager(BaseUserManager):
def create_user(self, email, password, username, first_name, **kwargs):
log... | CodaMais/CodaMais | CodaMais/user/managers.py | Python | gpl-3.0 | 1,179 | 0 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'configdialog.ui'
#
# by: PyQt4 UI code generator 4.5.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dia... | shakna-israel/rst2pdf | gui/Ui_configdialog.py | Python | mit | 7,900 | 0.003418 |
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import Co... | netconstructor/django-activity-stream | actstream/views.py | Python | bsd-3-clause | 3,684 | 0.011129 |
# Author: Paul Wollaston
# Contributions: Luke Mullan
#
# This client script allows connection to Deluge Daemon directly, completely
# circumventing the requirement to use the WebUI.
import json
from base64 import b64encode
import sickbeard
from sickbeard import logger
from .generic import GenericClient
from synchron... | eXistenZNL/SickRage | sickbeard/clients/deluged_client.py | Python | gpl-3.0 | 6,499 | 0.005539 |
import os
from pylons import app_globals
def delete_image(image):
paths = image.path.split(';')
for p in paths:
path = os.path.join(app_globals.image_storage, p)
os.remove(path)
| hep-gc/repoman | server/repoman/repoman/lib/storage/storage.py | Python | gpl-3.0 | 204 | 0.009804 |
"""autogenerated by genpy from mapping_dlut/Map.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import mapping_dlut.msg
import std_msgs.msg
class Map(genpy.Message):
_md5sum = "e6ab6c8862bf55f4e1b5fd48f03f1a7d"
_type = "mapping_dlut/Map"
_has_h... | WuNL/mylaptop | install/lib/python2.7/dist-packages/mapping_dlut/msg/_Map.py | Python | bsd-3-clause | 10,485 | 0.017167 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | elopio/snapcraft | snapcraft/plugins/go.py | Python | gpl-3.0 | 8,148 | 0 |
from pycp2k.inputsection import InputSection
class _each286(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Just_energy = None
self.Powell_opt = None
self.Qs_scf = None
self.Xas_scf = None
self.Md = None
self.Pint = None
self.Meta... | SINGROUP/pycp2k | pycp2k/classes/_each286.py | Python | lgpl-3.0 | 1,114 | 0.001795 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2015-2016 Rapptz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to u... | Aurous/Magic-Discord-Bot | discord/opus.py | Python | gpl-3.0 | 8,162 | 0.003798 |
import os
from bzrlib.branch import Branch
from charmhelpers.fetch import (
BaseFetchHandler,
UnhandledSource
)
from charmhelpers.core.host import mkdir
class BzrUrlFetchHandler(BaseFetchHandler):
"""Handler for bazaar branches via generic and lp URLs"""
def can_handle(self, source):
url_parts... | SaMnCo/charm-dashing | lib/charmhelpers/fetch/bzrurl.py | Python | agpl-3.0 | 1,463 | 0.001367 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import requests
import wikipedia_template_parser as wtp
from lxml import etree
import re
import json
def templates_including_coords():
LINKSCOORD = "http://it.wikipedia.org/w/index.php?title="\
"Speciale:PuntanoQui/Template:Coord&namespace=10&limit=500"... | CristianCantoro/wikipedia-tags-in-osm | extract_templates.py | Python | gpl-3.0 | 4,620 | 0.000433 |
if __name__ == '__main__':
import sys
import os
pkg_dir = (os.path.split(
os.path.split(
os.path.split(
os.path.abspath(__file__))[0])[0])[0])
parent_dir, pkg_name = os.path.split(pkg_dir)
is_pygame_pkg = (pkg_name == 'tests' and
... | bhansa/fireball | pyvenv/Lib/site-packages/pygame/tests/run_tests__tests/infinite_loop/fake_1_test.py | Python | gpl-3.0 | 977 | 0.008188 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsVectorLayer.
From build dir, run:
ctest -R PyQgsVectorLayer -V
.. note:: 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 Lic... | jgrocha/QGIS | tests/src/python/test_qgsvectorlayer.py | Python | gpl-2.0 | 159,533 | 0.001793 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('telerivet', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='incomingrequest',
n... | qedsoftware/commcare-hq | corehq/messaging/smsbackends/telerivet/migrations/0002_add_index_on_webhook_secret.py | Python | bsd-3-clause | 464 | 0 |
from NodeDefender.manage.setup import (manager, print_message, print_topic,
print_info)
from flask_script import prompt
import NodeDefender
@manager.command
def database():
print_topic('Database')
print_info("Database is used to store presistant data.")
print_info("By... | CTSNE/NodeDefender | NodeDefender/manage/setup/database.py | Python | mit | 2,533 | 0.001974 |
from qtpy.QtCore import Qt, QPoint, QObject, Signal
from qtpy.QtGui import QColor
from qtpy.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QFrame, QLabel
import html
class ErrorPopup(QWidget):
error_template = (
"<html>"
"<table style='background-color: #ffdfdf;'width='100%%'>"
"<tr><... | joakim-hove/ert | ert_gui/ertwidgets/validationsupport.py | Python | gpl-3.0 | 3,928 | 0.001018 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 European Synchrotron Radiation Facility, Grenoble, France
#
# Principal author: Wout De Nolf (wout.de_nolf@esrf.eu)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software")... | woutdenolf/wdncrunch | wdncrunch/modulea/tests/test_all.py | Python | mit | 1,623 | 0.002465 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.