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 data_utils import get_file
import string
import random
import cPickle
def make_reuters_dataset(path='datasets/temp/reuters21578/', min_samples_per_topic=15):
import os
import re
from preprocessing.text import Tokenizer
wire_topics = []
topic_counts = {}
wire_bodies... | wavelets/keras | keras/datasets/reuters.py | Python | mit | 3,237 | 0.003089 |
import unittest
import sys
from PySide.QtCore import QObject, SIGNAL, QUrl
from PySide.QtWebKit import *
from PySide.QtNetwork import QNetworkRequest
from helper import adjust_filename, UsesQApplication
class TestWebFrame(UsesQApplication):
def load_finished(self, ok):
self.assert_(ok)
page = s... | enthought/pyside | tests/QtWebKit/webframe_test.py | Python | lgpl-2.1 | 899 | 0.002225 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2015 Elico Corp (<http://www.elico-corp.com>)
# Authors: Siyuan Gu
#
# This program is free software: you can redistribute it and/or modify... | Elico-Corp/odoo-addons | multiprice_to_product_form/__openerp__.py | Python | agpl-3.0 | 1,385 | 0 |
from flask import Flask, request, jsonify
import random
import re
import sys
app = Flask(__name__)
SPEC = re.compile('^(\d+)d(\d+) ?(\w+)?$')
HIDDEN = ('hide', 'hidden', 'invisible', 'ephemeral', 'private')
USAGE = 'USAGE:\n' \
'`/roll [n]d[x] [options]`\n' \
'where:\n' \
' n == number of dice\n' \
... | NUKnightLab/slackdice | app.py | Python | mit | 1,779 | 0.003373 |
# -*- coding: UTF-8 -*-
import ldap
class Connection:
def __init__(self, url='ldap://annuaire.math.univ-paris-diderot.fr:389', \
base='ou=users,dc=chevaleret,dc=univ-paris-diderot,dc=fr'):
self.base = base
self.url = url
self.con = ldap.initialize(self.url)
self.con.bin... | bfontaine/p7ldap | p7ldap/connection.py | Python | mit | 619 | 0.004847 |
# coding=utf-8
from __future__ import absolute_import
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms of the AGPLv3 License"
def can_perform_update(targ... | chriskoz/OctoPrint | src/octoprint/plugins/softwareupdate/updaters/python_updater.py | Python | agpl-3.0 | 565 | 0.008881 |
import sqlite3
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
from phyllo.phyllo_logger import logger
# Note: The original ordering of chapters and verses was extremely complex.
# As a result, chapters are the bold headers and subsections are each p tag.
# Case 1: Sec... | oudalab/phyllo | phyllo/extractors/asconiusDB.py | Python | apache-2.0 | 2,970 | 0.005051 |
from pymongo import MongoClient
import os
from bson import json_util
from numpy import unique
client = MongoClient(os.environ.get("MONGOLAB_URI"))
db = client[os.environ.get("MONGOLAB_DB")]
class Organization:
def __init__(self):
self.orgs = self.get_orgs()
self.count = len(self.orgs)
def g... | mitzvotech/honorroll | lib/cleanup.py | Python | mit | 1,317 | 0.001519 |
import os, psycopg2, rsa
from urllib.parse import urlparse
class Installer:
def connect(self):
self.url = urlparse(os.environ["DATABASE_URL"])
self.db = psycopg2.connect(database=self.url.path[1:],
user=self.url.username,
... | MoarCatz/chat-server | installer.py | Python | gpl-3.0 | 2,510 | 0.001195 |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2007 Søren Roug, European Environment Agency
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at you... | thuydang/ocrfeeder | src/ocrfeeder/odf/office.py | Python | gpl-3.0 | 3,311 | 0.028399 |
from unittest.mock import patch
def mocked_execute(remote_executor, command, *args, **kwargs):
from .test_assets import TestAsset
return TestAsset.REMOTE_HOST_MOCKS[remote_executor.hostname].execute(
command
)
class PatchRemoteHostMeta(type):
"""
can be used as a metaclass for a TestCase ... | jdepoix/goto_cloud | goto_cloud/test_assets/remote_host_patch_metaclass.py | Python | mit | 1,494 | 0.004016 |
from django.db import models
from django.utils import timezone
from user.models import User
from adminsortable.models import SortableMixin
class Topic(SortableMixin):
'''
Model to define the behaviour of a topic
'''
class Meta:
'''
Meta options for topic mod... | anehx/anonboard-backend | core/models.py | Python | mit | 2,696 | 0.006677 |
import numpy as np
def sigmoid(x):
"""
Calculate sigmoid
"""
return 1 / (1 + np.exp(-x))
# Network size
N_input = 4
N_hidden = 3
N_output = 2
np.random.seed(42)
# Make some fake data
X = np.random.randn(4)
weights_input_to_hidden = np.random.normal(
0, scale=0.1, size=(N_input, N_hidden))
weigh... | swirlingsand/deep-learning-foundations | play/multi-layer.py | Python | mit | 771 | 0.001297 |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_O_FIN_FIN_PRODAREAINFO').setMaster(sys.argv[2])
sc = SparkContext(conf = conf... | cysuncn/python | spark/crm/PROC_O_FIN_FIN_PRODAREAINFO.py | Python | gpl-3.0 | 7,144 | 0.012726 |
# Bryan Barrows
# CSC 110 - Winter 17
# fahrenheit.py
# The purpose of this program is to convert a user input temperature from celsius to fahrenheit.
def main():
celsius = eval(input("What is the Celsius temperature? "))
fahrenheit = (9/5) * celsius + 32
print("The temperature is ",fahrenheit," degrees F... | bbarrows89/CSC110_Projects | fahrenheit.py | Python | mit | 341 | 0.01173 |
import logging
import urllib
import json
from edge.writer.proxywriter import ProxyWriter
class Writer(ProxyWriter):
def __init__(self, configFilePath):
super(Writer, self).__init__(configFilePath)
def _generateUrl(self, requestHandler):
url = self._configuration.get('solr', 'url')
par... | dataplumber/edge | src/main/python/plugins/slcp/indicator/Writer.py | Python | apache-2.0 | 2,746 | 0.003277 |
"""
Minimal Django settings for tests of common/lib.
Required in Django 1.9+ due to imports of models in stock Django apps.
"""
import sys
import tempfile
from django.utils.translation import ugettext_lazy as _
from path import Path
# TODO: Remove the rest of the sys.path modification here and in (cms|lms)/envs/com... | mitocw/edx-platform | openedx/tests/settings.py | Python | agpl-3.0 | 3,886 | 0.001544 |
from django.shortcuts import render
from django.http import HttpResponse
# Include the `fusioncharts.py` file which has required functions to embed the charts in html page
from ..fusioncharts import FusionCharts
# Loading Data from a Static JSON String
# It is a example to show a Column 2D chart where data is passed ... | emundus/v6 | plugins/fabrik_visualization/fusionchart/libs/fusioncharts-suite-xt/integrations/django/samples/fusioncharts/samples/dynamic_chart_resize.py | Python | gpl-2.0 | 1,972 | 0.010649 |
import pytest
from umodbus import conf
from umodbus.client import tcp
@pytest.fixture(scope='module', autouse=True)
def enable_signed_values(request):
""" Use signed values when running tests it this module. """
tmp = conf.SIGNED_VALUES
conf.SIGNED_VALUES = True
def fin():
conf.SIGNED_VALUES... | AdvancedClimateSystems/python-modbus | tests/system/responses/test_succesful_responses.py | Python | mpl-2.0 | 2,290 | 0 |
from .models import *
from django.contrib import admin
class PingLogAdmin(admin.ModelAdmin):
list_display = ('id','hash_key','url','ip_address','user_agent','time')
admin.site.register(PingLog, PingLogAdmin) | thejeshgn/quest | quest/admin.py | Python | gpl-3.0 | 213 | 0.037559 |
# 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/scheduler/azure-mgmt-scheduler/azure/mgmt/scheduler/models/_models_py3.py | Python | mit | 48,388 | 0.002232 |
from invoke import task
@task
def runserver(c):
c.run("PYTHONHTTPSVERIFY=0; ./manage.py runserver --settings=mykonosbiennale.offline_settings")
def export_artists(c):
c.run("PYTHONHTTPSVERIFY=0; ./manage.py export_artists - -settings = mykonosbiennale.offline_settings")
def export_filmfestival(c):
c.run... | mykonosbiennale/mykonosbiennale.github.io | tasks.py | Python | apache-2.0 | 552 | 0.018116 |
#!/usr/bin/env python2
## PYTHON 2!!!!!!!!!!!!!!!!!!!
# -*- coding: utf-8 -*-
#==============================================================================#
import os
import sys
import re
import StringIO
import shutil
# import tkFileDialog
import HTMLParser
import re
import base64
import Tkinter
import ttk
#---... | sora7/listparse | OLD/lp2/listparse.py | Python | gpl-2.0 | 77,022 | 0.006116 |
"""
Comsystem command module.
Comm commands are OOC commands and intended to be made available to
the Player at all times (they go into the PlayerCmdSet). So we
make sure to homogenize self.caller to always be the player object
for easy handling.
"""
from django.conf import settings
from src.comms.models import Chann... | TaliesinSkye/evennia | src/commands/default/comms.py | Python | bsd-3-clause | 38,986 | 0.003283 |
#!/usr/bin/env python2
#####
#
# PyGlow
#
#####
#
# Python module to control Pimoronis PiGlow
# [http://shop.pimoroni.com/products/piglow]
#
# * bin_clock.py - binary clock by Jiri Tyr
#
#####
from __future__ import print_function
from datetime import datetime
from PyGlow import PyGlow, ARM_LED_LIST, BOTH
from sys ... | bjornt/PyGlow | examples/bin_clock.py | Python | mit | 1,233 | 0 |
# encoding: UTF-8
from vnpy.trader import vtConstant
from korbitGateway import korbitGateway
gatewayClass = korbitGateway
gatewayName = 'KORBIT'
gatewayDisplayName = u'KORBIT'
gatewayType = vtConstant.GATEWAYTYPE_BTC
gatewayQryEnabled = True
| wisfern/vnpy | beta/gateway/korbitGateway/__init__.py | Python | mit | 245 | 0.004082 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2015 Intel Corporation.
# Copyright 2015 Isaku Yamahata <isaku.yamahata at intel com>
# <isaku.yamahata at gmail com>
# All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not u... | SripriyaSeetharam/tacker | tacker/vm/drivers/heat/heat.py | Python | apache-2.0 | 17,136 | 0.000117 |
import os
import unittest
import mock
from pulp.server.db import connection
class PulpWebservicesTests(unittest.TestCase):
"""
Base class for tests of webservice controllers. This base is used to work around the
authentication tests for each each method
"""
def setUp(self):
connection.in... | beav/pulp | devel/pulp/devel/unit/server/base.py | Python | gpl-2.0 | 2,511 | 0.003584 |
import Cookie
import os
from django.conf import settings
from common.tests import ViewTestCase
from common import api
from common import clean
from common import util
class JoinTest(ViewTestCase):
def setUp(self):
super(JoinTest, self).setUp()
self.form_data = {'nick': 'johndoe',
'fi... | tallstreet/jaikuenginepatch | join/tests.py | Python | apache-2.0 | 4,711 | 0.005731 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-containerregistry/azure/mgmt/containerregistry/v2017_06_01_preview/models/regenerate_credential_parameters.py | Python | mit | 1,115 | 0 |
from os.path import dirname
import numpy as np
from ..os import open_file, exists_isdir, makedirs
from ..log import get_logger
logger = get_logger()
def read_or_write(data_f, fallback=None):
"""Loads the data file if it exists. Otherwise, if fallback is provided,
call fallback and save its return to disk.
... | google/nerfactor | third_party/xiuminglib/xiuminglib/io/np.py | Python | apache-2.0 | 1,973 | 0.000507 |
# a singleton to avoid loading specific classes such as
# sequana.taxonomy.Taxonomy
class Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
return cls._instanc... | sequana/sequana | sequana/utils/singleton.py | Python | bsd-3-clause | 329 | 0.015198 |
#
# tracker_icons.py
#
# Copyright (C) 2010 John Garland <johnnybg+deluge@gmail.com>
#
# Deluge is free software.
#
# You may 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 l... | vguerci/Deluge.app | deluge/ui/tracker_icons.py | Python | gpl-3.0 | 19,201 | 0.002187 |
import hashlib
from kuma.core.utils import get_ip
def get_unique(content_type, object_pk, request=None, ip=None, user_agent=None, user=None):
"""Extract a set of unique identifiers from the request.
This set will be made up of one of the following combinations, depending
on what's available:
* user... | davidyezsetz/kuma | kuma/contentflagging/utils.py | Python | mpl-2.0 | 1,154 | 0.000867 |
#!/usr/bin/env python3
import asyncio
import os
from datetime import datetime
import aiohttp
from aiohttp import web
from raven import Client
from restaurants import (FormattedMenus, SafeRestaurant, OtherRestaurant,
AvalonRestaurant, TOTORestaurant, TOTOCantinaRestaurant,
... | fadawar/infinit-lunch | main.py | Python | gpl-3.0 | 2,316 | 0.001727 |
# coding: utf-8
# %save en ipython is wonderful. Cargar con ipython -i para continuar.
from framework import pclases
a = pclases.Obra.selectBy(nombre = "SU ALMACEN")[0]
len(a.clientes)
for c in a.clientes:
print c.nombre
vacidas = [o for o in pclases.Obra.select() if not o.clientes]
len(vacidas)
for o in vacid... | pacoqueen/ginn | extra/scripts/ipython_session_obra_su_almacen.py | Python | gpl-2.0 | 1,431 | 0.006289 |
import numpy as np
from procgraph import Block
from contracts import contract
class DepthBuffer(Block):
Block.alias('depth_buffer')
Block.input('rgba')
Block.output('rgba')
Block.output('line')
Block.output('depth')
def init(self):
self.depth = None
def update(s... | spillai/procgraph | src/procgraph_mplayer/depth_buffer.py | Python | lgpl-3.0 | 1,391 | 0.008627 |
import os.path
from zope import component
from zope import interface
from zope.component.factory import Factory
from sparc.configuration import container
import mellon
from mellon.factories.filesystem.file import MellonByteFileFromFilePathAndConfig
from mellon.factories.filesystem.file import \
... | CrowdStrike/mellon | mellon/factories/git/file.py | Python | mit | 4,601 | 0.00739 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.com>
# 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_... | tdtrask/ansible | lib/ansible/modules/network/aci/aci_switch_leaf_selector.py | Python | gpl-3.0 | 10,067 | 0.002384 |
"""Tests for the directory module"""
import os
from translate.storage import directory
class TestDirectory:
"""a test class to run tests on a test Pootle Server"""
def setup_method(self, method):
"""sets up a test directory"""
print("setup_method called on", self.__class__.__name__)
... | unho/translate | translate/storage/test_directory.py | Python | gpl-2.0 | 2,774 | 0 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Stats(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param sync_tx_create_ext_bit_counter: {"description": "Conn Sync Create with Ext Sent counter", "format": "counter", "type": "number", "oid": "29", "optional"... | amwelch/a10sdk-python | a10sdk/core/vrrp/vrrp_a_state_stats.py | Python | apache-2.0 | 19,224 | 0.00515 |
# shipBonusCarrierC4WarfareLinksBonus
#
# Used by:
# Ship: Chimera
type = "passive"
def handler(fit, src, context):
fit.modules.filteredItemBoost(
lambda mod: mod.item.requiresSkill("Shield Command") or mod.item.requiresSkill("Information Command"),
"warfareBuff2Value", src.getModifiedItemAttr("sh... | Ebag333/Pyfa | eos/effects/shipbonuscarrierc4warfarelinksbonus.py | Python | gpl-3.0 | 1,348 | 0.007418 |
import unittest
from indicoio import config, fer
class TestBatchSize(unittest.TestCase):
def setUp(self):
self.api_key = config.api_key
if not self.api_key:
raise unittest.SkipTest
def test_url_support(self):
test_url = "https://s3-us-west-2.amazonaws.com/indico-test-dat... | IndicoDataSolutions/IndicoIo-python | tests/etc/test_url.py | Python | mit | 467 | 0.002141 |
# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
"""Test for the smooth solvers."""
from __f... | kohr-h/odl | odl/test/solvers/smooth/smooth_test.py | Python | mpl-2.0 | 5,137 | 0 |
"""Test the Dyson fan component."""
import json
import unittest
from unittest import mock
import asynctest
from libpurecool.const import FanMode, FanSpeed, NightMode, Oscillation
from libpurecool.dyson_pure_cool import DysonPureCool
from libpurecool.dyson_pure_cool_link import DysonPureCoolLink
from libpurecool.dyson_... | Teagan42/home-assistant | tests/components/dyson/test_fan.py | Python | apache-2.0 | 30,624 | 0.000229 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
"""
TR-55 Model Implementation
A mapping between variable/parameter names found in the TR-55 document
and variables used in this program are as follows:
* `precip` is referred to as P... | WikiWatershed/tr-55 | tr55/model.py | Python | apache-2.0 | 13,671 | 0.000658 |
# Copyright 2014 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... | Mirantis/tempest | tempest/api/volume/admin/test_volume_quotas_negative.py | Python | apache-2.0 | 3,331 | 0 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
def execute(filters=None):
if not filters: filters = {}
columns = get_columns(fil... | gangadharkadam/tailorerp | erpnext/stock/report/batch_wise_balance_history/batch_wise_balance_history.py | Python | agpl-3.0 | 2,666 | 0.026632 |
f = open("font.txt","rb")
fontdata = f.read()
f.close()
out = "static char font[128][5] = {"
for i in xrange(128):
out += "{"
#Encode these into 7 bit "byte"s, with MSB=0
#We don't save anything by using 8-bit bytes; the last five bits of the last byte spill over, so we still get 5 bytes/char
... | imallett/MOSS | resources/bytemap font/echo as array.py | Python | mit | 923 | 0.021668 |
'''
Modulo Movimiento Nanometros
@author: P1R0
import ObjSerial, sys;
ObjSer = ObjSerial.ObjSerial(0,9600)
ObjSer.cts = True
ObjSer.dtr = True
ObjSer.bytesize = 8
'''
SxN = 59.71 #Constante de Calibracion del Motor
#Funcion para inicializar Monocromador
def init(ObjSer,A):
ObjSer.flushOutput()
ObjSe... | P1R/freeMonoCrom | MM.py | Python | gpl-2.0 | 5,424 | 0.014381 |
from django.conf.urls import patterns, url
from rest_framework.urlpatterns import format_suffix_patterns
from snippets.v3_0 import views
urlpatterns = patterns('',
url(r'^v3_0/snippets/$', views.SnippetList.as_view()),
url(r'^v3_0/snippets/(?P<pk>[0-9]+)/$', views.SnippetDetail.as_view()),
)
urlpatterns = for... | lgarest/django_snippets_api | snippets/v3_0/urls.py | Python | gpl-2.0 | 353 | 0.002833 |
"""
Turtle RDF graph serializer for RDFLib.
See <http://www.w3.org/TeamSubmission/turtle/> for syntax specification.
"""
from collections import defaultdict
from rdflib.term import BNode, Literal, URIRef
from rdflib.exceptions import Error
from rdflib.serializer import Serializer
from rdflib.namespace import RDF, RDF... | gloaec/trifle | src/rdflib/plugins/serializers/turtle.py | Python | gpl-3.0 | 12,175 | 0.000903 |
# -*- coding: utf-8 -*-
import unittest
from linked_list import (delete_node, list_cycle, remove_elements,
reverse_list)
from public import ListNode
class TestLinkedList(unittest.TestCase):
def test_delete_node(self):
so = delete_node.Solution()
head = ListNode(1)
... | lycheng/leetcode | tests/test_linked_list.py | Python | mit | 2,549 | 0 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable
from variable_functions import my_attribute_label
from numpy import ma
from numpy import float32
class total_improvement_value_per_residentia... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim/gridcell/total_improvement_value_per_residential_unit_within_walking_distance.py | Python | gpl-2.0 | 2,680 | 0.011194 |
import directory
import scanner
import mapper
import board
import os
class Klopfer(object):
def __init__(self, import_dir, export_dir):
self.import_dir = import_dir
self.export_dir = export_dir
print "Klopfer class"
def run(self):
# open dir and get oldest file with the given... | slx-dev/digital-kanban | src/klopfer.py | Python | mit | 1,083 | 0 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'Url', fields ['url', 'site']
db.delete_unique('seo_url', ['url', 'site_id']... | bashu/django-easy-seo | seo/south_migrations/0004_auto__del_url__del_unique_url_url_site.py | Python | gpl-3.0 | 2,904 | 0.00792 |
# 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, random, erpnext
from datetime import timedelta
from frappe.utils.make_random import how_many
from frappe.desk import query_report
from e... | ebukoz/thrive | erpnext/demo/user/manufacturing.py | Python | gpl-3.0 | 4,593 | 0.027433 |
# VMware vSphere Python SDK
# Copyright (c) 2008-2015 VMware, 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
#
# Unle... | alexkolar/pyvmomi | tests/test_iso8601.py | Python | apache-2.0 | 4,117 | 0 |
# -*- coding: utf-8 -*-
#
# Test links:
# https://www.oboom.com/B7CYZIEB/10Mio.dat
import re
from module.common.json_layer import json_loads
from module.plugins.internal.Hoster import Hoster
from module.plugins.captcha.ReCaptcha import ReCaptcha
class OboomCom(Hoster):
__name__ = "OboomCom"
__type__ =... | jansohn/pyload | module/plugins/hoster/OboomCom.py | Python | gpl-3.0 | 4,627 | 0.004322 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | sbidoul/buildbot | worker/buildbot_worker/monkeypatches/testcase_assert.py | Python | gpl-2.0 | 2,243 | 0.001337 |
#!/usr/bin/python
"""
Author: rockylinux
E-Mail: Jingzheng.W@gmail.com
"""
import commands
#display the living connections
#return a list containning living connections
class netstat:
def __init__(self):
self.__name = 'netstat'
def getData(self):
(status, output) = commands.getstatusoutput... | china-x-orion/infoeye | tools/netstat.py | Python | mit | 966 | 0.024845 |
#!/usr/bin/env python
"""
@file HybridVAControl.py
@author Craig Rafter
@date 19/08/2016
class for fixed time signal control
"""
import signalControl, readJunctionData, traci
from math import atan2, degrees
import numpy as np
from collections import defaultdict
class HybridVAControl(signalControl.signalContro... | cbrafter/TRB18_GPSVA | codes/sumoAPI/HybridVAControl_PROFILED.py | Python | mit | 14,996 | 0.005802 |
"""reminders URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-b... | Silvian/Reminders-App | reminders/urls.py | Python | gpl-3.0 | 1,236 | 0.000809 |
# xVector Engine Client
# Copyright (c) 2011 James Buchwald
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This pr... | buchwj/xvector | client/xVClient/StartupScreen.py | Python | gpl-3.0 | 14,622 | 0.004514 |
# coding: utf-8
# This file is part of Thomas Aquinas.
#
# Thomas Aquinas 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.
#
# Thomas Aq... | shackra/thomas-aquinas | summa/audio/system.py | Python | bsd-3-clause | 776 | 0 |
import os
import subprocess
from pathlib import Path
import pyinstaller_versionfile
import tomli
packaging_path = Path(__file__).resolve().parent
def get_version() -> str:
project_dir = Path(__file__).resolve().parent.parent
f = project_dir / "pyproject.toml"
return str(tomli.loads(f.read_text())["tool"... | amolenaar/gaphor | packaging/make-script.py | Python | lgpl-2.1 | 2,017 | 0.000496 |
def auto_fill_cuts(myMesh,user_cuts,weight_function):
'''
fill in user_cut list (or if empty create new one) which
prefers edges with larger weight, given by the weight_function
NOTE: currently sets naked edges as cuts
'''
sorted_edges = get_edge_weights(myMesh,user_cuts,weight_function)
fo... | jlopezbi/rhinoUnfolder | rhino_unwrapper/cutSelection/autoCuts.py | Python | gpl-3.0 | 3,550 | 0.006197 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | rcbops/horizon-buildpackage | horizon/middleware.py | Python | apache-2.0 | 2,838 | 0 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | PhilLidar-DAD/geonode | geonode/geoserver/helpers.py | Python | gpl-3.0 | 61,811 | 0.001052 |
from PyQt4 import QtGui, QtCore
from shapely.geometry import Point
from shapely import affinity
from math import sqrt
import FlatCAMApp
from GUIElements import *
from FlatCAMObj import FlatCAMGerber, FlatCAMExcellon
class FlatCAMTool(QtGui.QWidget):
toolName = "FlatCAM Generic Tool"
def __init__(self, app,... | silasb/flatcam | FlatCAMTool.py | Python | mit | 8,497 | 0.002942 |
#!/usr/bin/env python
#fractoe.py
from AISuite.game import Game as Game
import AISuite.player as player
from AISuite.alphabeta import UPPER_BOUND, LOWER_BOUND, shallowest_first
import AISuite.recorder as recorder
import AISuite.PythonLibraries.prgm_lib as prgm_lib
import fractoe_tictactoe as tictactoe
Tictactoe = ticta... | blamed-cloud/PythonGames | fractoe.py | Python | mit | 10,693 | 0.041242 |
#python
import k3d
import testing
setup = testing.setup_bitmap_modifier_test("BitmapReader", "BitmapAdd")
setup.source.file = k3d.filesystem.generic_path(testing.source_path() + "/bitmaps/" + "test_rgb_8.png")
setup.modifier.value = 0.5
testing.require_similar_bitmap(setup.document, setup.modifier.get_property("out... | barche/k3d | tests/bitmap/bitmap.modifier.BitmapAdd.py | Python | gpl-2.0 | 350 | 0.011429 |
# python
# This file is generated by a program (mib2py).
import HPR_IP_MIB
OIDMAP = {
'1.3.6.1.2.1.34.6.1.5': HPR_IP_MIB.hprIp,
'1.3.6.1.2.1.34.6.1.5.1.1.1': HPR_IP_MIB.hprIpActiveLsLsName,
'1.3.6.1.2.1.34.6.1.5.1.1.2': HPR_IP_MIB.hprIpActiveLsAppnTrafficType,
'1.3.6.1.2.1.34.6.1.5.1.1.3': HPR_IP_MIB.hprIpActiveLsUd... | xiangke/pycopia | mibs/pycopia/mibs/HPR_IP_MIB_OID.py | Python | lgpl-2.1 | 1,140 | 0.015789 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_06_01/aio/operations/_express_route_circuit_connections_operations.py | Python | mit | 19,491 | 0.005541 |
#!/usr/bin/env python2.7
# Copyright 2015 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | tbarrongh/cosc-learning-labs | src/learning_lab/05_acl_list.py | Python | apache-2.0 | 1,742 | 0.006889 |
#!/usr/bin/python
import urllib
import httplib
import time
import datetime
id = '123456789012345'
server = 'localhost:5055'
points = [
('2017-01-01 00:00:00', 59.93211887, 30.33050537, 0.0),
('2017-01-01 00:05:00', 59.93266715, 30.33190012, 50.0),
('2017-01-01 00:10:00', 59.93329069, 30.33333778, 50.0),
... | tananaev/traccar | tools/test-trips.py | Python | apache-2.0 | 1,319 | 0.003033 |
"""
WSGI config for roastdog 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/
"""
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
import os
os.envir... | chrisvans/roastdoge | config/wsgi.py | Python | mit | 422 | 0 |
#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
... | wanghuafeng/spider_tools | decorator.py | Python | mit | 1,524 | 0.004076 |
# This file is part of django-doubleoptin-contactform.
# django-doubleoptin-contactform is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | MyersGer/django-doubleoptin-contactform | doptincf/urls.py | Python | gpl-3.0 | 1,171 | 0.005978 |
# coding: utf-8
example_traceback = """*** HARAKIRI ON WORKER 16 (pid: 2259, try: 1) ***
*** uWSGI Python tracebacker output ***
thread_id = Thread-2 filename = /home/project/.pythonz/pythons/CPython-2.6.8/lib/python2.6/threading.py lineno = 504 function = __bootstrap line = self.__bootstrap_inner()
thread_id = Thread... | futurecolors/raven-harakiri | test_harakiri.py | Python | mit | 10,635 | 0.00489 |
# devices/md.py
#
# Copyright (C) 2009-2014 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 in the... | bcl/blivet | blivet/devices/md.py | Python | gpl-2.0 | 23,663 | 0.000887 |
from django.conf.urls import include, url
urlpatterns = (
url(r"^", include("pinax.forums.urls", namespace="pinax_forums")),
)
| pinax/pinax-forums | pinax/forums/tests/urls.py | Python | mit | 132 | 0 |
"""cellprofiler.gui.tests.__init__.py
CellProfiler is distributed under the GNU General Public License.
See the accompanying file LICENSE for details.
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2015 Broad Institute
All rights reserved.
Please see the AUTHORS file for credits.
W... | LeeKamentsky/CellProfiler | cellprofiler/gui/tests/__init__.py | Python | gpl-2.0 | 421 | 0 |
#!/usr/bin/env python
"""
Task message queue consumer server.
"""
import click
import logging
from zencore.conf import Settings
from zencore.redtask import server
from zencore.utils.debug import setup_simple_logger
CONFIG = Settings()
logger = logging.getLogger(__name__)
@click.group()
@click.option("-c", "--config"... | zencore-dobetter/zencore-redtask | src/scripts/zrts.py | Python | mit | 1,207 | 0.002486 |
"""
Django settings for kiki project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... | after12am/expecto | machine_learning/kiki/kiki/settings.py | Python | mit | 2,210 | 0 |
import pytz
import urllib
from datetime import datetime
from pupa.scrape import Scraper, Bill, VoteEvent
from openstates.utils import LXMLMixin
TIMEZONE = pytz.timezone("US/Central")
VOTE_TYPE_MAP = {"yes": "yes", "no": "no"}
class NEBillScraper(Scraper, LXMLMixin):
def scrape(self, session=None):
if ... | openstates/openstates | openstates/ne/bills.py | Python | gpl-3.0 | 10,305 | 0.001456 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 eNovance <licensing@enovance.com>
#
# Author: Julien Danjou <julien@danjou.info>
#
# 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 Lice... | citrix-openstack-build/ceilometer | tests/test_service.py | Python | apache-2.0 | 5,711 | 0.001576 |
#!/usr/bin/env python
"""Plot scheduled flight times for AA flights between JFK and LAX.
For a given year and month, visualize dist vs sch time, run a regression,
and look at error. Filter based on whether the destination is in the Pacific,
and study the regression and error for each group."""
import os
import sys
... | mtb0/flightmodel | src/drivers/AnalysisDriver.py | Python | mit | 1,592 | 0.011935 |
# -*- coding: utf-8 -*-
"""Main Controller"""
import pylons
from tg import expose, flash, require, url, lurl, request, redirect, tmpl_context
from tg.i18n import ugettext as _, lazy_ugettext as l_
from tg import predicates
from ebetl import model
from ebetl.controllers.secure import SecureController
from ebetl.model im... | nomed/ebetl | ebetl/controllers/marketing.py | Python | artistic-2.0 | 12,560 | 0.017596 |
"""Webhooks for external integrations."""
from __future__ import absolute_import
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.models import get_client, UserProfile
from zerver.lib.actions import check_send_message
from zerver.lib.response import json... | dawran6/zulip | zerver/webhooks/freshdesk/view.py | Python | apache-2.0 | 5,886 | 0.001019 |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
import api, foxycart
urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name='index.html')),... | hacknashvillereview/review_application | review_app/review_app/urls.py | Python | mit | 1,606 | 0.004981 |
from __future__ import absolute_import, division, print_function, unicode_literals
import ossaudiodev
def print_fmts(rw):
print(rw == 'r' and 'read' or 'write')
sound = ossaudiodev.open(rw)
fmts = sound.getfmts()
for name in dir(ossaudiodev):
if name.startswith('AFMT'):
attr = getattr(ossaudiodev,... | rec/echomesh | code/python/experiments/ossaudiodev/GetFormats.py | Python | mit | 429 | 0.025641 |
#!/usr/bin/env python
#
# Copyright 2006,2007,2010,2015 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 ... | surligas/gnuradio | gnuradio-runtime/python/gnuradio/gr/qa_random.py | Python | gpl-3.0 | 2,171 | 0.00783 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | Southpaw-TACTIC/TACTIC | src/pyasm/prod/checkin/maya_checkin_test.py | Python | epl-1.0 | 1,267 | 0.008682 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('project_admin', '0020_project_fiscal_year'),
]
operations = [
migrations.AddField(
... | luiscberrocal/homeworkpal | homeworkpal_project/project_admin/migrations/0021_projectgoal_fiscal_year.py | Python | mit | 568 | 0.001761 |
from StringIO import StringIO
#import sys
import json
from os.path import join
from .base import BaseCase
import validate
import jsonschema
class TestArticleValidate(BaseCase):
def setUp(self):
self.doc_json = join(self.fixtures_dir, 'elife-09560-v1.xml.json')
def tearDown(self):
pass
def... | gnott/bot-lax-adaptor | src/tests/test_validate.py | Python | gpl-3.0 | 1,558 | 0.001284 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# system
import os
import sys
dir = os.path.split(os.path.split(os.path.split(os.path.realpath(__file__))[0])[0])[0]
sys.path.append(os.path.join(dir, 'scripts'))
# testing
import mock
import unittest
from mock import patch
# program
import setup.load as Config
import setup.... | luiscape/hdxscraper-violation-documentation-center-syria | tests/unit/test_setup.py | Python | mit | 1,648 | 0.018204 |
"""
Copyright (c) 2019 John Robinson
Author: John Robinson
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,... | johnrbnsn/Adafruit_Python_MAX31856 | Adafruit_MAX31856/test_MAX31856.py | Python | mit | 8,880 | 0.00732 |
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
# ***** END LICENSE BLOCK *****
import os
import re
from mozhar... | simar7/build-mozharness | mozharness/mozilla/testing/unittest.py | Python | mpl-2.0 | 11,491 | 0.001653 |
## Automatically adapted for numpy.oldnumeric May 17, 2011 by -c
# Natural Language Toolkit: Classifiers
#
# Copyright (C) 2001 University of Pennsylvania
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://nltk.sf.net>
# For license information, see LICENSE.TXT
#
# $Id: __init__.py,v 1.2 2003/10/27... | ronaldahmed/robot-navigation | neural-navigation-with-lstm/MARCO/nltk_contrib/unimelb/tacohn/classifier/__init__.py | Python | mit | 21,922 | 0.003421 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.