code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | nuxeh/keystone | keystone/common/config.py | Python | apache-2.0 | 64,232 |
#!/usr/bin/env python
import errno
import os
import platform
import sys
import traceback
from fcntl import flock, LOCK_EX, LOCK_NB
from optparse import OptionParser
from os import O_RDWR, O_CREAT, O_WRONLY, O_APPEND
from os.path import basename, dirname, exists, realpath
from os.path import join as pathjoin
from sign... | rakam-io/rakam | rakam/bin/launcher.py | Python | agpl-3.0 | 13,761 |
# partial Game class
import os
from .celldefs import Farm
class Player:
def __init__(self, client, game, money):
self.client = client
self.money = money
self._game = game
self.iPlayer = client.iPlayer
self.name = client.playerDesc["name"]
def getPlayerStats(self):
... | amatveyakin/underworld | gameengine/player.py | Python | gpl-2.0 | 499 |
__author__ = 'M@Campbell'
from ooiservices.app import create_celery_app
from flask.globals import current_app
from flask_caching import Cache
from ooiservices.app.uframe.config import get_cache_timeout
"""
Create the celery app, and configure it to talk to the redis broker.
Then initialize it.
"""
celery = create_... | asascience-open/ooi-ui-services | ooiservices/app/tasks.py | Python | apache-2.0 | 10,055 |
from django.contrib.syndication.views import Feed
from django.core.urlresolvers import reverse_lazy
from django.template.defaultfilters import linebreaksbr
from commons.templatetags.markup_bbcode import stripbbcode
from .models import Thread, Message
import datetime
class LatestsFeed(Feed):
title = 'Discussion... | roidelapluie/Lexpage | app/board/feeds.py | Python | gpl-3.0 | 1,756 |
#!/usr/bin/python
# 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... | hyokun31/wisekb-management-platform | wisekb-uima-ducc/cassandra-server/pylib/setup.py | Python | apache-2.0 | 947 |
import hashlib
import mimetypes
import os
import posixpath
import re
from time import time
from urlparse import urlsplit, urlunsplit
from werkzeug.exceptions import NotFound
from werkzeug.http import is_resource_modified, http_date
from spa.static.handlers import StaticHandler
from spa.utils import clean_path
class... | dmonroy/spa | spa/static/smart.py | Python | bsd-3-clause | 8,271 |
import pexpect
PROMPT = ['#', '>>>', '> ', '\$ ']
def send_command(child, cmd):
child.sendline(cmd)
child.expect(PROMPT)
print child.before
def connect(user, host, password):
ssh_newkey = 'Are you sure you want to continue connecting?'
connStr = 'ssh ' + user + '@' + host
child = pexpect.s... | Kediel/Violent-Python | Chapter 2/sshCommand.py | Python | mit | 938 |
"""Support for Ombi."""
from datetime import timedelta
import logging
from pyombi import OmbiError
from homeassistant.components.sensor import SensorEntity
from .const import DOMAIN, SENSOR_TYPES
_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(seconds=60)
def setup_platform(hass, config, add_enti... | kennedyshead/home-assistant | homeassistant/components/ombi/sensor.py | Python | apache-2.0 | 2,250 |
#!/usr/bin/env python
# Copyright (c) 2012 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 simple wrapper for protoc.
Script for //third_party/protobuf/proto_library.gni .
Features:
- Inserts #include for extra heade... | endlessm/chromium-browser | tools/protoc_wrapper/protoc_wrapper.py | Python | bsd-3-clause | 5,576 |
# output from elife00013.xml
expected = [
{
"xlink_href": "elife00013f001",
"type": "graphic",
"parent_type": "fig",
"parent_ordinal": 1,
"parent_sibling_ordinal": 1,
"parent_component_doi": "10.7554/eLife.00013.003",
"position": 1,
"ordinal": 1,
}... | elifesciences/elife-tools | tests/fixtures/test_graphics/content_02_expected.py | Python | mit | 10,317 |
#
# Copyright (C) 2016 necropotame (necropotame@gmail.com)
#
# This file is part of TeeUniverse.
#
# TeeUniverse is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3,
# as published by the Free Software Foundation.
#
# TeeUniverse is distribut... | teeuniverse/teeuniverse | scripts/assets/assets.py | Python | agpl-3.0 | 99,291 |
''' unit test for BUG #1091 '''
import unittest
from PySide import QtGui
class QPainterTestCase(unittest.TestCase):
def testIt(self):
self.assertTrue("PixmapFragment" in dir(QtGui.QPainter))
self.assertTrue("drawPixmapFragments" in dir(QtGui.QPainter))
if __name__ == "__main__":
unittest.main... | M4rtinK/pyside-android | tests/QtGui/bug_1091.py | Python | lgpl-2.1 | 323 |
line = input().split(",")
for part in line:
print(part) | ProgDan/maratona | URI/URI 2765.py | Python | gpl-3.0 | 61 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## This file is part of ScholaRec.
## A recommendation engine for Scholarly works.
## Copyright (C) 2014 Archit Sharma <archit.py@gmail.com>
##
## ScholaRec is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as... | arcolife/scholarec | corpus/add_stopwords.py | Python | gpl-3.0 | 3,242 |
"""
Tests for the search box in the admin side menu, and the custom search hooks.
"""
from django.contrib.auth.models import Permission
from django.template import Context, Template
from django.test import RequestFactory, TestCase
from django.urls import reverse
from wagtail.admin.auth import user_has_any_page_permiss... | zerolab/wagtail | wagtail/admin/tests/test_admin_search.py | Python | bsd-3-clause | 4,875 |
# coding: utf-8
import os
import re
from xml.dom import Node
from django.db import models
from django.db.models.signals import post_save
from django.utils.encoding import smart_text
from django.utils.six import text_type
from guardian.shortcuts import assign_perm, get_perms_for_model
from pyxform import SurveyElementB... | kobotoolbox/kobocat | onadata/apps/viewer/models/data_dictionary.py | Python | bsd-2-clause | 15,697 |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James McCoy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyr... | tecan/xchat-rt | plugins/scripts/encryption/supybot-code-6361b1e856ebbc8e14d399019e2c53a35f4e0063/plugins/Misc/plugin.py | Python | gpl-2.0 | 18,622 |
#!/usr/bin/env python
import sys
import tempfile
import time
import os
import subprocess
import argparse
import logging
from contextlib import contextmanager
import uuid
log = logging.getLogger("serviced-tests")
SERVICED_ROOT = os.path.dirname(os.path.abspath(__file__))
DEVNULL = open(os.devnull, 'w')
def fail(m... | spindance/serviced-precomp | serviced-tests.py | Python | apache-2.0 | 8,035 |
from account.conf import settings
from account.models import Account
from django.contrib.auth.models import User
from rest_framework import serializers
class PasswordSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Account
fields = (
'spouse_name',
'street... | michealcarrerweb/LHVent_app | account/serializers.py | Python | mit | 1,806 |
"""Collection for ExperimentSet and ExperimentSetReplicate."""
from pyramid.threadlocal import get_current_request
from pyramid.view import view_config
from snovault import (
calculated_property,
collection,
load_schema,
AfterModified,
BeforeModified
)
from snovault.calculated import calculate_prop... | 4dn-dcic/fourfront | src/encoded/types/experiment_set.py | Python | mit | 28,629 |
import functools
import itertools
import operator
from typing import Any, Optional, Tuple, Union
import numpy as np
from pandas._config import get_option
from pandas._libs import iNaT, lib, tslibs
from pandas.compat._optional import import_optional_dependency
from pandas.core.dtypes.cast import _int64_max, maybe_up... | cbertinato/pandas | pandas/core/nanops.py | Python | bsd-3-clause | 41,194 |
from __future__ import division
import copy
import os
import numpy as np
import FreeCAD as App
import Part
from freecad.frametools import ICON_PATH
__all__ = [
"Beam",
"CBeam",
"ViewProviderBeam",
"ViewProviderCBeam"]
class Beam():
def __init__(self, obj, profile, path, path_name):
'''... | looooo/freecad_frame | freecad/frametools/beamobj.py | Python | lgpl-2.1 | 12,472 |
import pulsar as psr
class TestPyModule1(psr.TestModule):
def __init__(self, myid):
super(TestPyModule1, self).__init__(myid)
def run_test_(self):
self.out.output("Inside TestPyModule1: id = {}\n".format(self.id()))
class TestPyModule2(psr.TestModule):
def __init__(self, myid):
super(TestPyModule2... | pulsar-chem/Pulsar-Core | test/testmodules/TestPyModules.py | Python | bsd-3-clause | 1,009 |
# -*- coding: utf8 -*-
import sys, os
sys.path.append(os.path.abspath('.'))
import re
from operator import attrgetter
import difflib
# Pylons model init sequence
import pylons.test
import logging
from quanthistling.config.environment import load_environment
from quanthistling.model.meta import Sessi... | FrankNagel/qlc | src/webapp/quanthistling/scripts/annotations/annotations_for_loos2008.py | Python | gpl-3.0 | 6,211 |
"""
This script would copy the required framework files from the input source to the input destination given by the user.
1. Copy files from POM to the newly created destination directory.
2. Verify if the destination directory is created and create the sub-folder to copy files from POM\Conf.
3. Verify if the destinati... | qxf2/qxf2-page-object-model | utils/copy_framework_template.py | Python | mit | 3,297 |
#-
# Copyright (c) 2011 Robert N. M. Watson
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# License... | 8l/beri | cheritest/trunk/tests/branch/test_raw_bnel_lt_back.py | Python | apache-2.0 | 1,726 |
# -*- coding: utf8 -*-
import argparse
import logging
import pytest
import SMSShell
import SMSShell.commands
def test_abstract_init():
"""Test abstract init methods
"""
abs = SMSShell.commands.AbstractCommand(logging.getLogger(),
object(),
... | Turgon37/SMSShell | tests/test_smsshell_commands.py | Python | gpl-3.0 | 2,388 |
"""
RESTful resource variant selection using the HTTP Accept header.
"""
__version__ = '0.5.5'
__author__ = 'Martin Blech <martinblech@gmail.com>'
__license__ = 'MIT'
import mimeparse
from functools import wraps
import re
class MimeRenderException(Exception): pass
XML = 'xml'
JSON = 'json'
JSONLD = 'jsonl... | skycucumber/restful | python/venv/lib/python2.7/site-packages/mimerender.py | Python | gpl-2.0 | 25,576 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | ujjvala-addsol/addsol_hr | openerp/addons/mail/mail_thread.py | Python | agpl-3.0 | 105,293 |
from .base import *
from .constraints import *
from .solvers import *
| mbodenhamer/syn | syn/util/constraint/b/__init__.py | Python | mit | 70 |
# -*- coding: utf-8 -*-
'''Consolidates settings from defaults.py and local.py.
::
>>> from website import settings
>>> settings.MAIL_SERVER
'smtp.sendgrid.net'
'''
import os
from .defaults import * # noqa
try:
from .local import * # noqa
except ImportError as error:
raise ImportError("No local.... | jnayak1/osf.io | website/settings/__init__.py | Python | apache-2.0 | 944 |
#!/usr/bin/env python
import ovg
class Module(object):
"""Base class for smarthouse modules"""
x = y = w = h = 0
def __init__(self):
super(Module, self).__init__()
def open(self,x,y,w,h):
ovg.open(x,y,w,h)
self.x, self.y, self.w, self.h = ovg.wininfo()
ovg.clear()
def close(self):
ovg.close() | pzl/smarthouse | smarthouse/moduleBase.py | Python | gpl-2.0 | 316 |
'''
Spell checking the search_queries. It takes a rather long time to run;
suitable for over-the-night runs.
INPUT FILES:
train.csv (raw data file)
test.csv (raw data file)
OUTPUTS:
spell_corr.py
__Author__:
Ali Narimani
__Veresion__:
1.2
'''
import requests
import re
import time
from random import randint
impor... | hamid-omid/search_relevance | spell_corrector.py | Python | mit | 1,712 |
#!/usr/bin/env python
from __future__ import print_function
from setuptools import setup
try:
from pypandoc import convert
read_md = lambda f: convert(f, 'rst')
except ImportError:
print('pandoc is not installed.')
read_md = lambda f: open(f, 'r').read()
setup(name='pcalg',
version='0.1.3',
... | chen0031/pcalg | setup.py | Python | bsd-2-clause | 1,068 |
# -*- mode: python; coding: utf-8 -*-
#
# Copyright 2013 Andrej A Antonov <polymorphm@gmail.com>.
#
# This program 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
# (... | polymorphm/verif-scheduler-rf-gui | lib_verif_scheduler_rf_gui_2013_01_02/tk_mt.py | Python | gpl-3.0 | 2,694 |
from model.contact import Contact
testdata = [Contact(firstname="",
middlename="",
lastname="",
nickname="",
title="",
company="",
address="",
home_phone="",
... | alenickwork/python_training | data/contacts.py | Python | apache-2.0 | 1,532 |
from django.http import HttpResponse
from django.conf import settings
from website.utils.cronHelper import CronHelper
from website.utils.httpUtil import HttpRequestProcessor
from website.utils.cleanCommentViewsHelper import CleanCommentViews
from website.utils.notificationSentHelper import NotificationHelper
from websi... | solarpermit/solarpermit | website/cron/cron.py | Python | bsd-3-clause | 3,000 |
def itemNames():
return ['chassis_blueprints','circuit_board','collapsed_artifact','power_output_device','software_module']
def itemChances():
return [20,20,20,20,20] | ProjectSWGCore/NGECore2 | scripts/loot/lootPools/endor/re_junk_death_watch_bloodguard.py | Python | lgpl-3.0 | 173 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE
import glob as _glob
import os as _os
_here = _os.path.dirname(__file__)
_paths = _glob.glob(_os.path.join(_here, '*.py'))
_filenames = [_os.path.basename(_x) for _x in _pat... | didrocks/quickly | data/templates/ubuntu-application/store/__init__.py | Python | gpl-3.0 | 452 |
#!/usr/bin/env python
# coding=utf-8
"""426. Box-ball system
https://projecteuler.net/problem=426
Consider an infinite row of boxes. Some of the boxes contain a ball. For
example, an initial configuration of 2 consecutive occupied boxes followed by
2 empty boxes, 2 occupied boxes, 1 empty box, and 2 occupied boxes ca... | openqt/algorithms | projecteuler/pe426-box-ball-system.py | Python | gpl-3.0 | 1,614 |
from lemonyellow.models import Slot
# this is what wild pokemon get loaded into when in a wild battle
class WildBattle(Slot):
pass
wild_battle = WildBattle()
| itsthejoker/Pokemon-Homage | lemonyellow/models/wild_battle.py | Python | mit | 165 |
#~ import infernal_wireless_gui_project
import MySQLdb
import db_connect_creds
import os
import os.path
import sys
import wx
from datetime import datetime
os.system('/etc/init.d/apache2 start')
os.system('/etc/init.d/mysql start')
if not os.path.exists('dbconnect.conf'):
print "DB Config 'dbconnect.conf' file doe... | zstyblik/infernal-twin | InfernalWireless.py | Python | gpl-3.0 | 7,587 |
'''
This portion of the program sends an SMS
message to the given number. This is one
way the program will communicate with the
user. Another potential way is through
a push notification to a phone if this
was a phone app. I noticed that Chrome
supports browser based push notifications
that are really nice and non obtr... | SalehHindi/DC-Killer | SMS_backend.py | Python | gpl-2.0 | 1,532 |
from collections import Counter
from math import log10
import re, string
from nltk.corpus import stopwords
from nltk import word_tokenize
from files import stemmer
'''
Document class
author :Alexis Fossart
date : 06/10/2017
Class used to represent a document in memory
'''
class Document:
def __init__(self,
... | Xia0ben/IQPlayground | files/document.py | Python | mit | 4,653 |
"""
For escaping elements in values to be passed to
javascript
"""
from django.utils.safestring import mark_safe
from django.template import Library
import json
register = Library()
@register.filter(is_safe=True)
def js_escape(obj):
return json.dumps(obj)
| GreatLakesEnergy/sesh-dash-beta | seshdash/templatetags/js_escape.py | Python | mit | 266 |
"""
======================
Histogram Equalization
======================
This examples enhances an image with low contrast, using a method called
*histogram equalization*, which "spreads out the most frequent intensity
values" in an image [1]_. The equalized image has a roughly linear cumulative
distribution f... | yangautumn/turing_pattern | consensusalg/plot_equalize.py | Python | gpl-3.0 | 3,072 |
#!/usr/bin/env python
import optparse
import os
import sys
import tempfile
import datetime
from xml.etree import ElementTree as etree
from convert import read_messages, read_calls
import yaffs
def read_chunk(fd, size):
s = fd.read(size)
if len(s) > 0 and len(s) != size:
raise IOError("Broken image fi... | abbot/android-restore-tools | extract.py | Python | mit | 9,201 |
import _plotly_utils.basevalidators
class TextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="text", parent_name="layout.scene.zaxis.title", **kwargs
):
super(TextValidator, self).__init__(
plotly_name=plotly_name,
parent_name=p... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/scene/zaxis/title/_text.py | Python | mit | 418 |
class HyveIOException(Exception):
pass
class HyveException(Exception):
pass
| thehyve/transmart-arborist | arborist/functions/exceptions.py | Python | lgpl-3.0 | 86 |
def trunc_whitespace(app, doctree, docname):
from docutils.nodes import Text, paragraph
if not app.config.japanesesupport_trunc_whitespace:
return
for node in doctree.traverse(Text):
if isinstance(node.parent, paragraph):
newtext = node.astext()
for c in "\n\r\t":
... | cstudioteam/handywedge | handywedge-documents/developper-guide/japanesesupport.py | Python | mit | 600 |
# -*- coding: utf-8 -*-
import os
from django.core.urlresolvers import reverse
from django.utils import simplejson
from django.test import TransactionTestCase
from django.conf import settings
from django.contrib.auth.models import User, Permission
from transifex.txcommon.tests.base import Users, NoticeTypes
from transi... | hfeeki/transifex | transifex/resources/tests/api/__init__.py | Python | gpl-2.0 | 33,610 |
from distutils.core import setup
setup(
name='Open Queueing Network Simulation',
version='0.0.1dev',
author='Geraint Palmer, Vincent Knight',
author_email=('palmer.geraint@googlemail.com'),
scripts=['simulation.py, analyse.py, experiment.py, run_simulation.py'],
description='A discrete event si... | geraintpalmer/SimulatingAQingNetwork | setup.py | Python | mit | 531 |
"""
Copyright 2014 Fabian Schuh
Author: Fabian Schuh <mail@xeroc.org>
Licence: GNU Library or Lesser General Public License (LGPL)
This file is part of bitsharesrpc.
bitsharesrpc is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as publish... | MatzFan/python-bitsharesrpc | bitsharesrpc/client.py | Python | lgpl-3.0 | 4,305 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import api, fields, models
import openerp.addons.decimal_precision as dp
class ProductTemplate(models.Model):
_inherit = "product.template"
uos_id = fields.Many2one('product.uom', 'Unit of Sale',
... | vileopratama/vitech | src/addons/product_uos/models/product_uos.py | Python | mit | 1,570 |
"""
Control global computation context
"""
from __future__ import absolute_import, division, print_function
from collections import defaultdict
_globals = defaultdict(lambda: None)
_globals['callbacks'] = set()
class set_options(object):
""" Set global state within controled context
This lets you specify v... | mikegraham/dask | dask/context.py | Python | bsd-3-clause | 1,214 |
from setuptools import setup
setup(name='senseapi',
version='0.5.15',
packages=[''],
install_requires=['oauth>=1.0.1'],
author="Sense Observation Systems",
author_email="info@sense-os.nl",
description='Library for using CommonSense API in Python applications',
license="Apache ... | senseobservationsystems/commonsense-python-lib | setup.py | Python | apache-2.0 | 529 |
"""
Contains methods for working with the Lakeshore 475 Gaussmeter
"""
from quantities import Quantity
from typing import Optional
from instruments.lakeshore import Lakeshore475 as _Lakeshore475
from time import sleep
class Lakeshore475(object):
"""
Adapter layer for IK's Lakeshore 475 implementation
"""
... | MichalKononenko/MrFreeze | mr_freeze/devices/lakeshore_475.py | Python | agpl-3.0 | 2,013 |
import os
import re
from sheetsite.names import normalize_name
from sheetsite.filtered_spreadsheet import FilteredSpreadsheet
from sheetsite.merged_spreadsheet import MergedSpreadsheet
class Site(object):
def __init__(self, spreadsheet, geocache_filename=None, censor=True):
self.workbook = spreadsheet
... | paulfitz/sheetsite | sheetsite/site.py | Python | mit | 9,146 |
#what is this program,
#what version
#Etc.
# Written by Jared
# Date
from ctypes import *
import sys
import random
from time import sleep
import os
import time
from datetime import datetime
import time, datetime, os
import shutil
# Get today's date as a datetime type
today = datetime.date.today()
# Get string re... | borevitzlab/plantspin | bscn.py | Python | gpl-3.0 | 1,066 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Snapshot.environment'
db.add_column(u'backup_snapshot', 'environment',
... | globocom/database-as-a-service | dbaas/backup/migrations/0002_auto__add_field_snapshot_environment.py | Python | bsd-3-clause | 9,691 |
# 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/v2020_08_01/operations/_express_route_ports_locations_operations.py | Python | mit | 7,987 |
"""
Schema for event objects.
"""
from .common import sources, extras, fuzzy_date_blank, fuzzy_datetime, fuzzy_datetime_blank
media_schema = {
"items": {
"properties": {
"name": {"type": "string", "minLength": 1},
"type": {"type": "string", "minLength": 1},
"date": ... | opencivicdata/pupa | pupa/scrape/schemas/event.py | Python | bsd-3-clause | 5,707 |
# Copyright (c) 2012 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 copy
import hashlib
import json
import string
import sys
import urllib2
MANIFEST_VERSION = 2
# Some commonly-used key names.
ARCHIVES_KEY = 'arc... | GoogleChromeLabs/chromeos_smart_card_connector | third_party/nacl_sdk/nacl_sdk/sdk_tools/manifest_util.py | Python | apache-2.0 | 19,959 |
# -*- Mode: python; coding: utf-8; tab-width: 8; indent-tabs-mode: t; -*-
#
# Copyright (C) 2006 Adam Zimmerman <adam_zimmerman@sfu.ca>
# Copyright (C) 2006 James Livingston <doclivingston@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Publi... | ivankelly/Rhythmbox-Spotify-Plugin | plugins/magnatune/magnatune/__init__.py | Python | gpl-2.0 | 11,050 |
#!/usr/bin/python
import multiprocessing
import nbt
import glob, os.path, sys
import time
def f(x, count):
return
def test():
map_files = glob.glob(os.path.join(sys.argv[1], '*', '*', '*.dat'))
print 'File count: %i' % len(map_files)
pool = multiprocessing.Pool()
return pool.map(f, range(256), int(len(map_file... | aheadley/pynemap | testing/multiproc.py | Python | mit | 500 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2020 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
class DependencyError(Exception):
"""The user requested something that won't be possi... | psychopy/versions | psychopy/exceptions.py | Python | gpl-3.0 | 797 |
# -*- coding: utf-8 -*-
# $Id$
"""
Test Manager - Report models.
"""
__copyright__ = \
"""
Copyright (C) 2012-2014 Oracle Corporation
This file is part of VirtualBox Open Source Edition (OSE), as
available from http://www.virtualbox.org. This file is free software;
you can redistribute it and/or modify it under the ... | svn2github/vbox | src/VBox/ValidationKit/testmanager/core/report.py | Python | gpl-2.0 | 28,353 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | lxsmnv/spark | python/pyspark/sql/dataframe.py | Python | apache-2.0 | 89,420 |
"""Pylons environment configuration"""
import os
from mako.lookup import TemplateLookup
from pylons.configuration import PylonsConfig
from pylons.error import handle_mako_error
import storage_node_pylons.lib.app_globals as app_globals
import storage_node_pylons.lib.helpers
from storage_node_pylons.config.routing impo... | artemp/MapQuest-Render-Stack | storage/node/storage_node_pylons/storage_node_pylons/config/environment.py | Python | lgpl-2.1 | 1,775 |
import nltk
class Splitter(object):
def __init__(self):
self.nltk_splitter = nltk.data.load('tokenizers/punkt/english.pickle')
self.nltk_tokenizer = nltk.tokenize.TreebankWordTokenizer()
def split(self, text):
"""
input format: a paragraph of text
output format: a list... | alwaysanirudh/nlp-polarity-dectetor | splitter.py | Python | gpl-2.0 | 616 |
import os
import shutil
from gpaw.mpi import rank
machine = os.environ.get('MACHINE', 'TEST')
ncores = os.environ.get('NCORES', 8)
if rank == 0:
os.chdir(machine)
os.system('python ../memory_bandwidth.py --runs=5 --startcores='+str(ncores))
#os.system('python ../memory_bandwidth.py --runs=5') # full memory... | qsnake/gpaw | doc/devel/memory_bandwidth/analyse.py | Python | gpl-3.0 | 392 |
from apps.partners.serializers import PartnerOrganizationSerializer
from apps.projects.models import Project, PartnerOrganization
from django.contrib.sites.models import Site
from django.views.generic.list import ListView
from rest_framework import generics
# API view
class PartnerDetail(generics.RetrieveAPIView):
... | onepercentclub/onepercentclub-site | apps/partners/views.py | Python | bsd-3-clause | 1,321 |
##############################################################################
# Package: ormpy
# File: ObjectType.py
# Author: Matthew Nizol
##############################################################################
""" ObjectType.py provides classes for the various object types in ORM:
entity type, value... | mnizol/ormpy | lib/ObjectType.py | Python | gpl-2.0 | 4,884 |
# -*- coding: utf-8 -*-
#
# Copyright 2015, Foxugly. All rights reserved.
#
# 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 License, or (at
# your option) any late... | Foxugly/medagenda | patient/views.py | Python | gpl-3.0 | 1,514 |
# 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 unittest
import sys
import os
from tvcm import dev_server
from tvcm import project as project_module
from tvcm import test_runner
def _TryToImportTel... | bpsinc-native/src_third_party_trace-viewer | third_party/tvcm/tvcm/browser_controller.py | Python | bsd-3-clause | 6,290 |
from .PaperBroker import PaperBroker | philipodonnell/paperbroker | paperbroker/__init__.py | Python | mit | 36 |
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.pens.basePen import BasePen
from reportlab.graphics.shapes import Path
class ReportLabPen(BasePen):
"""A pen for drawing onto a reportlab.graphics.shapes.Path object."""
def __init__(self, glyphSet, p... | googlei18n/fontuley | src/third_party/fontTools/Lib/fontTools/pens/reportLabPen.py | Python | apache-2.0 | 1,849 |
"""
Define common steps for instructor dashboard acceptance tests.
"""
# pylint: disable=C0111
# pylint: disable=W0621
from __future__ import absolute_import
from lettuce import world, step
from mock import patch
from nose.tools import assert_in # pylint: disable=E0611
from courseware.tests.factories import StaffF... | dsajkl/reqiop | lms/djangoapps/instructor/features/common.py | Python | agpl-3.0 | 4,537 |
#!/usr/bin/env python3
numero = int(input("Digite um número inteiro: "))
resto = numero % 5
if(resto == 0):
print("Buzz")
else:
print(numero)
| ranog/coursera_python | buzz.py | Python | gpl-3.0 | 155 |
"""
gunicorn configuration
"""
import multiprocessing
import os
if os.environ.get('MODE') == 'dev':
reload = True
workers = multiprocessing.cpu_count() * 2 + 1
| unbalancedparentheses/indielangs | api/gunicorn.py | Python | mit | 167 |
from __future__ import absolute_import, print_function
import sys
import warnings
import copy
import operator as op
import types
import math
import re
import numpy as np
from functools import partial
from future.utils import iteritems, raise_from, raise_
from collections import defaultdict
def grad(fun, argnum=0):
... | kcarnold/autograd | autograd/core.py | Python | mit | 15,080 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from SimPEG import Mesh, Maps, SolverLU, Utils
from SimPEG.Utils import ExtractCoreMesh
import numpy as np
from SimPEG.EM.Static import DC, IP
import matplotlib
import matplotlib.pyplot as plt
import ma... | geoscixyz/em_examples | em_examples/DCIP_overburden_PseudoSection.py | Python | mit | 31,511 |
# python imports
from datetime import datetime
import os
# django imports
from django.conf import settings
from django.contrib.comments.moderation import CommentModerator, moderator
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as ... | petry/django-pressroom-googlecode | src/pressroom/models.py | Python | bsd-3-clause | 4,225 |
from django.urls import path, include
from rest_framework import routers
from api.views import BlogViewSet, WorkViewSet
# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'blogs', BlogViewSet)
router.register(r'work', WorkViewSet)
urlpatterns =... | ahmedaljazzar/ahmedjazzar.com | api/urls.py | Python | agpl-3.0 | 443 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('libreosteoweb', '0006_examination_status_reason'),
]
operations = [
migrations.CreateModel(
name='Invoice',
... | garthylou/Libreosteo | libreosteoweb/migrations/0007_auto_20150123_0851.py | Python | gpl-3.0 | 2,744 |
#!/bin/python2
import os, gzip, StringIO, time, csv, datetime
from flask import Flask, request, redirect, url_for, render_template
from werkzeug.utils import secure_filename
from wtforms import Form, DecimalField, validators
class UpdateForm(Form):
weight = DecimalField('Weight', [validators.DataRequired()])
f... | bossen/smartscale | main.py | Python | gpl-3.0 | 1,578 |
"""
Django settings for sbudget project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
im... | dsysme/osbudget | sbudget/settings.py | Python | mit | 1,975 |
import gtk
import blueman.bluez as Bluez
from blueman.Functions import *
from blueman.gui.manager.ManagerDeviceMenu import ManagerDeviceMenu
from blueman.gui.manager.ManagerProgressbar import ManagerProgressbar
from blueman.Functions import adapter_path_to_name
from blueman.gui.CommonUi import *
class ManagerMenu:
... | hamonikr-root/blueman | blueman/gui/manager/ManagerMenu.py | Python | gpl-3.0 | 7,391 |
from plugins.lists.simplelist import SimpleList
class TestbedList (SimpleList):
def __init__ (self, **settings):
SimpleList.__init__(self, key='platform', classname='testbedlist', **settings)
# writing a js plugin for that would be overkill, just use SimpleList
def plugin_classname (self):
... | onelab-eu/myslice | plugins/lists/testbedlist.py | Python | gpl-3.0 | 493 |
# -*- coding: utf-8 -*-
"""The RAW image path specification resolver helper implementation."""
# This is necessary to prevent a circular import.
import dfvfs.file_io.raw_file_io
from dfvfs.lib import definitions
from dfvfs.resolver import resolver
from dfvfs.resolver import resolver_helper
class RawResolverHelper(r... | dc3-plaso/dfvfs | dfvfs/resolver/raw_resolver_helper.py | Python | apache-2.0 | 849 |
from svn import SvnWindowCommand
class SvnStashCommand(SvnWindowCommand):
may_change_files = True
def run(self):
self.run_command(['svn', 'stash'])
class SvnStashPopCommand(SvnWindowCommand):
def run(self):
self.run_command(['svn', 'stash', 'pop'])
class SvnStashApplyCommand(SvnWindow... | phuslu/sublime-svn | stash.py | Python | gpl-2.0 | 1,289 |
"""Wrapper for iptables/ipset.
"""
# Disable "too many lines in module" warning.
#
# pylint: disable=C0302
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import random
import re
import shlex
import tim... | bretttegart/treadmill | lib/python/treadmill/iptables.py | Python | apache-2.0 | 32,642 |
"""
Django settings for vpnWebProject project.
Generated by 'django-admin startproject' using Django 1.9.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
#codin... | qiqipipioioi/django-radius-my | vpnWebProject/settings.py | Python | mit | 3,936 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
from flask i... | thnkloud9/verifiedpixel | server/vpp/archive/archive_link.py | Python | agpl-3.0 | 2,622 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2012, Jayson Vantuyl <jayson@aggressive.ly>
# 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_... | aperigault/ansible | lib/ansible/modules/packaging/os/apt_key.py | Python | gpl-3.0 | 12,718 |
"""
Tests the bot's reactions to events that
come from Twitter's userstream via Tweepy.
As with all tests, use python -m unittest tests
so that the tweetfeeder module is found.
"""
import unittest
from os import mkdir, remove, path
from time import time, sleep
from tweetfeeder import TweetFeederBot
from tweetfeeder.str... | HG-Dev/tweetfeeder | tests/streaming_check.py | Python | gpl-3.0 | 7,436 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
user_config.py: a module to specify installation-specific settings for
the open-worm-analysis-toolbox repository
This file is in the .gitignore file for the open-worm-analysis-toolbox repo, so
you can put configuration settings here that apply to just... | ver228/tierpsy-tracker | tierpsy/features/open_worm_analysis_toolbox/user_config.py | Python | mit | 582 |
"""
Script that trains DAG models on tox21 dataset.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import numpy as np
np.random.seed(123)
import tensorflow as tf
tf.set_random_seed(123)
import deepchem as dc
# Load tox21 dataset
tox21_tasks, tox21_dat... | Agent007/deepchem | examples/tox21/tox21_tensorgraph_DAG.py | Python | mit | 1,635 |
"""Base UptimeRobot entity."""
from __future__ import annotations
from pyuptimerobot import UptimeRobotMonitor
from homeassistant.helpers.entity import DeviceInfo, EntityDescription
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
)
from .const import ATTR_TARG... | aronsky/home-assistant | homeassistant/components/uptimerobot/entity.py | Python | apache-2.0 | 1,942 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.