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 |
|---|---|---|---|---|---|
import Confidential
message = Confidential('top secret text')
secret_field = Confidential.getDeclaredField('secret')
secret_field.setAccessible(True) # break the lock!
print 'message.secret =', secret_field.get(message)
| YuxuanLing/trunk | trunk/code/study/python/Fluent-Python-example-code/09-pythonic-obj/private/expose.py | Python | gpl-3.0 | 228 |
from django.http import HttpRequest, HttpResponse
from zerver.lib.actions import notify_attachment_update
from zerver.lib.attachments import access_attachment_by_id, remove_attachment, user_attachments
from zerver.lib.response import json_success
from zerver.models import UserProfile
def list_by_user(request: HttpRe... | eeshangarg/zulip | zerver/views/attachments.py | Python | apache-2.0 | 917 |
#!/usr/bin/env python
# test_copy.py - unit test for COPY support
#
# Copyright (C) 2010-2011 Daniele Varrazzo <daniele.varrazzo@gmail.com>
#
# psycopg2 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,... | kylelwm/ponus | venv/build/psycopg2/tests/test_copy.py | Python | mit | 9,939 |
# ==============================================================================
# Copyright 2019 - Philip Paquette
#
# NOTICE: 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 rest... | diplomacy/research | diplomacy_research/models/policy/token_based/v001_markovian_no_film/tests/test_model.py | Python | mit | 4,189 |
#!/usr/bin/env python
'''
File: dir-inventory.py
Author: Jonas Gorauskas [JGG]
Created: 2011-01-07 11:35:52
Modified: 2011-01-07 11:38:56
Description:
This script will recursively list the information about
files inside a root folder that is passed in as a parameter
History:
2011-01-07 11:38:56 - ... | gorauskas/Hacks | python/dir-inventory.py | Python | mit | 3,010 |
# LICENSE: AGPL 3.0
# Author: Name: Davide, Surname: Setti, email: NAME.SURNAME@gmail.com
# Copyright: Fondazione Bruno Kessler (www.fbk.eu), 2008-2010
from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.au... | vad/django-nevede | nevede/urls.py | Python | agpl-3.0 | 1,032 |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
first = head
second ... | scream7/leetcode | algorithms/python/83.py | Python | apache-2.0 | 799 |
# -*- coding: utf-8 -*-
# Third Party
import pytest
from django.core.urlresolvers import reverse
# AskCoding
from askcoding.users.tests.factories import UserFactory
pytestmark = pytest.mark.django_db
@pytest.fixture
def user():
return UserFactory.create()
def test_get_user_profile_non_logged_in(client):
... | akarambir/askcoding | askcoding/users/tests/test_views.py | Python | mit | 1,389 |
# Using the following encoding: utf-8
# Python 2
from ConfigParser import ConfigParser, NoOptionError
# End Python 2
# Python 3
# from configparser import ConfigParser, NoOptionError
# End Python 3
import requests
import os
import shutil
import fnmatch
import time
import getpass
import itertools
from ltk import excepti... | Lingotek/translation-utility | python2/ltk/actions/action.py | Python | mit | 24,789 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import taggit.managers
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('taggit', '0002_auto_20150616_2121'),
('auth', '0... | HMSBeagle1831/rapidscience | rlp/accounts/migrations/0001_initial.py | Python | mit | 4,298 |
# Copyright 2011-2015 Isotoma Limited
#
# 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 wr... | mitchellrj/touchdown | touchdown/core/datetime.py | Python | apache-2.0 | 2,101 |
from __future__ import print_function
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import io
import os
import sys
import contestcolld
here = os.path.abspath(os.path.dirname(__file__))
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')... | hgn/hippod | setup.py | Python | mit | 1,469 |
"""
For Django < 3.1, rely on django-jsonfield-backport for JSONField
functionality
https://github.com/laymonage/django-jsonfield-backport#installation
https://github.com/laymonage/django-jsonfield-backport#why-create-another-one
"""
try:
from django.db.models import JSONField # noqa
except ImportError:
from... | pinax/pinax-eventlog | pinax/eventlog/compat.py | Python | mit | 379 |
print('local settings enabled')
DEBUG = True
UID_SALT = ''
CACHES = {}
CACHES['default'] = {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
INLINE_CSS = False
SESSION_COOKIE_SECURE = False
| decadecity/ct | caffeine_tracker/settings/local_example.py | Python | unlicense | 212 |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
import... | klahnakoski/JsonSchemaToMarkdown | vendor/mo_testing/fuzzytestcase.py | Python | mpl-2.0 | 7,712 |
# Generated by Django 2.2.24 on 2021-09-28 11:52
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('astrobin', '0122_gear_migration_flag_reviewer_decision'),
]
operations = [
migrations.AlterField(
... | astrobin/astrobin | astrobin/migrations/0123_rename_accepted_to_approved_for_consistency.py | Python | agpl-3.0 | 1,305 |
#! /usr/bin/env python
#
# test_errors.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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
... | gewaltig/cython-neuron | pynest/nest/tests/test_errors.py | Python | gpl-2.0 | 3,727 |
from django.conf.urls import patterns, include, url
base_urlpatterns = patterns(
'',
url(r'^$', 'status.views.home', name='home'),
url(r'^ops/$', 'ops.views.ops', name='ops'),
url(r'^osd/(\d+)/$', 'status.views.osd_details', name='osd_details'),
url(r'^activity/$', 'status.views.activity', name='ac... | krakendash/krakendash | kraken/urls.py | Python | bsd-3-clause | 560 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from container.utils.visibility import getLogger
logger = getLogger(__name__)
from container import host_only, conductor_only
CAPABILITIES = dict(
BUILD='building container images',
BUILD_CONDUCTOR='building the Conductor image',
DEPLOY='push... | mhumeSF/ansible-container | container/engine.py | Python | lgpl-3.0 | 6,544 |
"""
Provides small event framework
"""
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
log = logging.getLogger('event')
_events = {}
class Event(object):
"""Represents one registered event."""
... | jawilson/Flexget | flexget/event.py | Python | mit | 3,149 |
#!/usr/bin/env python
"""
Set to Complete all Import project forms that are referenced from Data Entry.
Technically, only Data Entry forms that have the completion status of
Unverified or Complete are considered. Typically, though, the import process
would set the Entry form to Unverified, so it would take explicit hu... | sibis-platform/sibispy | cmds/change_complete_field_in_entry_and_import.py | Python | bsd-3-clause | 10,126 |
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Spotify AB
import fcntl
import select
import subprocess
import sys
import os
class Dummy(object):
def __getattr__(self, name):
def f(*al, **kw):
print ('\033[32m%s\033[0m' % name)
f.__name__ = name
return f
def a(self):
... | bartvanherck/python-graphwalker | graphwalker/test/interactor.py | Python | apache-2.0 | 5,356 |
import click
import os
import os.path
import ntpath
import serial
import sys
import prosflasher.ports
import prosflasher.upload
import prosconfig
from proscli.utils import default_cfg, AliasGroup
from proscli.utils import get_version
@click.group(cls=AliasGroup)
def flasher_cli():
pass
@flashe... | purduesigbots/purdueros-cli | proscli/flasher.py | Python | bsd-3-clause | 8,643 |
##=============== OPENING FITS TABLES =============
import numpy as np
import astropy
from astropy.io import fits
import matplotlib.pyplot as plt
##=============== settting environment ============
fermi = fits.open('3C454.3_604800.lc')
data = fermi[1].data
print data | chalkyam/Photometry_Pipeline | scripts/open.fits.py | Python | mit | 272 |
# 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 program is distributed in the hope that it will be useful,
# but... | karibou/sosreport | sos/plugins/gdm.py | Python | gpl-2.0 | 1,116 |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | batxes/4Cin | Six_mouse_models/Six_mouse_models_final_output_0.2_-0.1_11000/mtx1_models/Six_mouse_models17239.py | Python | gpl-3.0 | 18,216 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/restore_request.py | Python | mit | 5,149 |
#!/usr/bin/env python3
PKG = 'lg_common'
NAME = 'test_managed_application'
import gc
import os
import unittest
import weakref
from lg_msg_defs.msg import ApplicationState
from appctl_support import ProcController
from lg_common import ManagedApplication, ManagedWindow
TEST_CMD = ['/usr/bin/python']
class MockWindo... | EndPointCorp/lg_ros_nodes | lg_common/test/offline/test_managed_application.py | Python | apache-2.0 | 3,712 |
#
# 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... | apache/incubator-airflow | airflow/providers/neo4j/example_dags/example_neo4j.py | Python | apache-2.0 | 1,304 |
from setuptools import setup, find_packages
setup(
version='4.3.0',
name='vcdriver',
description='A vcenter driver based on pyvmomi, fabric and pywinrm',
url='https://github.com/Lantero/vcdriver',
author='Carlos Ruiz Lantero',
author_email='carlos.ruiz.lantero@gmail.com',
license='MIT',
... | Lantero/vcdriver | setup.py | Python | mit | 1,071 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2012,2013,2014,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance... | quattor/aquilon | tests/broker/test_del_chassis.py | Python | apache-2.0 | 3,407 |
import sqlite3
from flask import Flask, g, render_template, request
from flask import session, flash, redirect, url_for
# configurtion
DATABASE = '/tmp/flaskr.db'
DEBUG = True
USERNAME = 'admin'
PASSWORD = 'admin'
SECRET_KEY = 'Sou4Gi3zQVZ1lJ8lUlUB'
app = Flask(__name__)
app.config.from_object(__name__)
def conne... | decimalbell/devnull | python/flask/flaskr/flaskr.py | Python | mit | 1,943 |
#!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the prioritisetransaction mining RPC."""
import time
from test_framework.messages import COIN, M... | r8921039/bitcoin | test/functional/mining_prioritisetransaction.py | Python | mit | 7,584 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | hehongliang/tensorflow | tensorflow/python/keras/layers/cudnn_recurrent.py | Python | apache-2.0 | 20,929 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0045_pendingcallback_planned_for_datetime'),
]
operations = [
migrations.AlterField(
model_name='widg... | vesellov/callfeed.net | mainapp/migrations/0046_auto_20150807_1626.py | Python | mit | 828 |
#!/usr/bin/env python
# -*-coding:utf-8-*-
# File Name : f.py
# Description :
# Author :
# Creation Date : 2021-10-31
# Last Modified : 2021年10月31日 星期日 19时00分05秒
# Created By : lsl
def f(grid, k):
def h(grid):
ans = ''
for i in range(len(grid)):
for j in range(len(grid[... | uxlsl/uxlsl.github.io | demo/code/2021-10-31/f.py | Python | mit | 1,631 |
# This file is part of ReText
# Copyright: Dmitry Shachnev 2012
# License: GNU GPL v2 or higher
from ReText import *
from ReText.highlighter import ReTextHighlighter
class HtmlDialog(QDialog):
def __init__(self, parent=None):
QDialog.__init__(self, parent)
self.resize(700, 600)
verticalLayout = QVBoxLayout(sel... | codemedic/retext | ReText/htmldialog.py | Python | gpl-3.0 | 746 |
import sys
import unittest
from cStringIO import StringIO
from pylint.checkers import similar
class SimilarTC(unittest.TestCase):
"""test the similar command line utility"""
def test(self):
sys.stdout = StringIO()
try:
similar.run(['--ignore-comments', 'input/similar1', 'input/sim... | FrankBian/kuma | vendor/packages/pylint/test/test_similar.py | Python | mpl-2.0 | 1,399 |
# -*- coding: utf-8 -*-
class DecodeError(Exception):
pass
class EncodeError(Exception):
pass
class ConnectionError(Exception):
pass
class ResponseError(Exception):
def __init__(self, message, response):
super(ResponseError, self).__init__(message)
self.response = response
clas... | VaclavDedik/infinispan-py | infinispan/error.py | Python | mit | 452 |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2020 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 argparse
import errno
import filecmp
import os
import plistlib
import shutil
import stat
import subprocess
impo... | ric2b/Vivaldi-browser | chromium/chrome/installer/mac/universalizer.py | Python | bsd-3-clause | 12,026 |
"""
This extenssion provides preprocessing functionality to the compiler. The following
instructions:
define X Y - replaces the occurances of X with Ys. This can be very efficient in defining
constants
import x - imports the file located at the path x
"""
from malicehelpers import promptErrorMessage
... | IrinaDmt/MAlice | preprocessing.py | Python | mit | 2,695 |
# Copyright (c) 2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functionality ... | nilmini20s/gem5-2016-08-13 | tests/configs/realview-minor-dual.py | Python | bsd-3-clause | 2,338 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'createProfileMothur.ui'
#
# Created: Fri Dec 16 13:39:59 2011
# by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
ex... | dparks1134/STAMP | stamp/GUI/createProfileMothurUI.py | Python | gpl-3.0 | 5,930 |
from django.contrib import admin
from markedit.widgets import AdminMarkEdit
class MarkEditAdmin(admin.ModelAdmin):
class MarkEdit:
fields = ['text', ]
options = {}
class Media:
css = {'all': ('css/jquery-ui-1.10.3.min.css', 'css/jquery.markedit.css', )}
js = ('js/jquery.admin... | Diwahars/pycon | markedit/admin.py | Python | bsd-3-clause | 790 |
"""CSS selector structure items."""
import copyreg
from collections.abc import Hashable, Mapping
__all__ = (
'Selector',
'SelectorNull',
'SelectorTag',
'SelectorAttribute',
'SelectorContains',
'SelectorNth',
'SelectorLang',
'SelectorList',
'Namespaces',
'CustomSele... | SickGear/SickGear | lib/soupsieve_py3/css_types.py | Python | gpl-3.0 | 8,916 |
from vt_manager.communication.sfa.rspecs.elements.element import Element
class Spectrum(Element):
fields = []
| dana-i2cat/felix | vt_manager/src/python/vt_manager/communication/sfa/rspecs/elements/spectrum.py | Python | apache-2.0 | 116 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
#
import logging
from PyQt4 import QtGui, QtCore, Qt
from .uic_generated.FAUcardPaymentDialog import Ui_FAUcardPaymentDialog
from ..faucardPayment.faucardStates import Status, Info
from decimal import Decimal
class FAUcardPaymentDialog(QtGui.QDialog, Ui_FAUcardPayme... | fau-fablab/FabLabKasse | FabLabKasse/UI/FAUcardPaymentDialogCode.py | Python | gpl-3.0 | 11,138 |
#!/usr/bin/env python
# ===--- generate_harness.py ---------------------------------------------===//
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See ... | IngmarStein/swift | benchmark/scripts/generate_harness/generate_harness.py | Python | apache-2.0 | 3,411 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | bokeh/core/property/json.py | Python | bsd-3-clause | 2,991 |
"""
This config file contains the information specific to the individual usage of ask-a-tech.
Please rename this file to
"config.py" and add or replace the information with your own.
"""
__author__ = 'ericpoe'
## Google Apps Connection Information
# The user email/password defined should have edit-rights to the appro... | ericpoe/ask-a-tech | config-default.py | Python | mit | 1,682 |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design 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:
#
# * Redistrib... | chippey/gaffer | python/GafferSceneUI/ExecutableRenderUI.py | Python | bsd-3-clause | 2,410 |
#!/usr/bin/env python
#coding: utf-8
#### FUNCTIONS ####
def header(string):
"""
Display header
"""
timeInfo = time.strftime("%Y-%m-%d %H:%M")
print '\n', timeInfo, "****", string, "****"
def subHeader(string):
"""
Display subheader
"""
timeInfo = time.strftime("%Y-%m-%... | brguez/TEIBA | src/python/genotypedMEI.stats.py | Python | gpl-3.0 | 20,614 |
from urllib.request import urlopen
from bs4 import BeautifulSoup
import numpy as np
import pandas as pd
def is_number(s):
"""
check if a string represents an integer or float number
parameter
--------
s: a string
return
------
return True iff S represents a number (int or... | YuguangTong/AY250-hw | hw_5/util.py | Python | mit | 6,967 |
from django.db import models
import datetime
from django.utils import timezone
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_publish... | okaram/django | tutorial/polls/models.py | Python | unlicense | 641 |
from basescript import BaseScript
import os
import gc
import sys
import json
import time
import code
import inspect
import logging
import resource
import string
import random
import threading
import msgpack
import cStringIO
import traceback
import urlparse
from multiprocessing.pool import ThreadPool
import statsd
imp... | deep-compute/funcserver | funcserver/funcserver.py | Python | mit | 25,163 |
import math
class BoundingBox(object):
def __init__(self, *args, **kwargs):
self.lat_min = None
self.lon_min = None
self.lat_max = None
self.lon_max = None
def get_bounding_box(latitude_in_degrees, longitude_in_degrees, half_side_in_km):
assert half_side_in_km > 0
assert l... | insacloud/insacloud-back | insacloud/services/geolocalisation.py | Python | mit | 1,059 |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# This file is part of the mantid workbench.... | mganeva/mantid | qt/python/mantidqt/widgets/samplelogs/test/test_samplelogs_view.py | Python | gpl-3.0 | 939 |
# -*- coding: utf-8 -*-
"""Python's builtin :class:`list` is a very fast and efficient
sequence type, but it could be better for certain access patterns,
such as non-sequential insertion into a large lists. ``listutils``
provides a pure-Python solution to this problem.
For utilities for working with iterables and list... | mgaitan/boltons | boltons/listutils.py | Python | bsd-3-clause | 12,823 |
#!/usr/bin/env python
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
#
# 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; version 2 of the License.
#
# This program is d... | scavarda/mysql-dbcompare | mysql-utilities-1.6.0/scripts/mysqlrplsync.py | Python | apache-2.0 | 11,414 |
from pylab import *
import scipy
import mpmath as mp
import traceback
import numpy
#import fpectl
#fpectl.turnon_sigfpe()
import scipy.linalg as la
import scipy.sparse.linalg as sla
import SlepcDet
import gkcStyle
import iCode
class Species:
def __init__(self, m=0., q=1., T=1., n=0., eta=0., name="Unamed"):
... | philscher/gkc | Benchmarks/IntegralCode/solveiCode.py | Python | gpl-3.0 | 9,492 |
# https://www.codewars.com/kata/515e271a311df0350d00000f
def square_sum(numbers):
return sum(x**2 for x in numbers)
| fahadkaleem/CodeWars | 8 kyu/python/Square(n) Sum.py | Python | mit | 121 |
#!/usr/bin/env python
# coding=UTF-8
import os
from multiprocessing import Process, Queue, current_process, Lock
from time import sleep
def ntptest(host):
sleep (10)
return 0
def worker(queue,lock):
lock.acquire()
print 'starting child process with id: ', os.getpid()
print 'parent process:', os.getppid()
lock.... | phocean/netios | test/jc.py | Python | gpl-2.0 | 789 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - WSGI application
@copyright: 2003-2008 MoinMoin:ThomasWaldmann,
2008-2008 MoinMoin:FlorianKrupicka
@license: GNU GPL, see COPYING for details.
"""
import os
from MoinMoin import log
logging = log.getLogger(__name__)
from MoinMoin.we... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/wsgiapp.py | Python | mit | 10,909 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.platform.googletest import GetTempDir
from tensorflow.python.platform.googletest import main
from tensorflow.python.framework.test_util import TensorFlowTestCase as TestCase
from tensorfl... | arunhotra/tensorflow | tensorflow/python/platform/test.py | Python | apache-2.0 | 423 |
import json, random, time
import stockfighter_minimal as sf
account = "NOISEBOTS"
venue, symbol = "TESTEX", "FOOBAR"
sf.set_web_url("http://127.0.0.1:8000/ob/api/")
sf.change_api_key("noisekey")
def main():
global account
global venue
global symbol
orderType = "limit"
all_orders = []
while ... | fohristiwhirl/disorderBook | bots/bot_noise.py | Python | mit | 1,391 |
# -*- coding: utf-8 -*-
import codecs
import jieba
from jieba.analyse import extract_tags
import pandas as pd
import numpy as np
from wordcloud import WordCloud, STOPWORDS, ImageColorGenerator
import matplotlib
import matplotlib.pyplot as plt
from scipy.misc import imread
matplotlib.rcParams['figure.figsize'] = (10.0, ... | jarvisqi/nlp_learn | segment/jieba_segment.py | Python | mit | 2,548 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: errors.py
import mcl.status
ERR_SUCCESS = mcl.status.MCL_SUCCESS
ERR_INVALID_PARAM = mcl.status.framework.ERR_START
ERR_FAILED = mcl.status.framework... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/network/cmd/netconnections/errors.py | Python | unlicense | 1,200 |
#!/usr/bin/env python3
from yr.libyr import Yr
weather = Yr(location_name='Norge/Telemark/Skien/Skien')
wind_speed = dict()
wind_speed['data'] = [{'from': forecast['@from'], 'to': forecast['@to'], 'speed': float(forecast['windSpeed']['@mps'])} for forecast in weather.forecast()]
wind_speed['credit'] = weather.credit... | HugoShamrock/python-yr | yr/examples/wuurrd.py | Python | gpl-3.0 | 340 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Guewen Baconnier (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers w... | gurneyalex/stock-logistics-warehouse | __unported__/base_product_merge/base_product_merge/__openerp__.py | Python | agpl-3.0 | 2,398 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | kevin-coder/tensorflow-fork | tensorflow/python/tpu/error_handling.py | Python | apache-2.0 | 4,683 |
print int("0", base=2)
print long("1", base=2)
| ArcherSys/ArcherSys | skulpt/test/run/t532.py | Python | mit | 47 |
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | cloudbase/neutron | neutron/extensions/trunk_details.py | Python | apache-2.0 | 1,741 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import namedtuple
import json
import time
from itertools import groupby
from odoo import api, fields, models, _
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
from odoo.tools.float_utils import f... | richard-willowit/odoo | addons/stock/models/stock_picking.py | Python | gpl-3.0 | 36,588 |
#!/usr/bin/env python
"""
$push is similar to $addToSet. The difference is that rather than accumulating only unique values
it aggregates all values into an array.
Using an aggregation query, count the number of tweets for each user. In the same $group stage,
use $push to accumulate all the tweet texts for each use... | napjon/moocs_solution | DataWranglingMongoDB/Lesson5/using_push.py | Python | mit | 2,299 |
from xdict.prepare_quotes_token_machine import prepare_quotes_token_machine
def tokenize_quotes(machine):
curr_state = "INIT"
rslt = ''
for i in range(0,machine.orig_str.__len__()):
input_symbol = machine.orig_str[i]
action,next_state,trigger_checker = machine.search(curr_state,input_symb... | ihgazni2/dlixhict-didactic | xdict/tokenize_quotes.py | Python | mit | 1,990 |
#!/usr/bin/env python
"""
configure DCommands
"""
import sys
import types
import DIRAC
from DIRAC.Core.Base import Script
from COMDIRAC.Interfaces import DConfig, createMinimalConfig, critical, guessProfilesFromCS
from COMDIRAC.Interfaces import getDNFromProxy
class Params:
def __init__ ( self ):
self.minima... | pigay/COMDIRAC | Interfaces/scripts/dconfig.py | Python | gpl-3.0 | 3,151 |
'''This module contains some glue code encapsulating a "main" process.
The code here is aimed at wrapping the most common tasks involved in creating
and, especially, training a neural network model.
'''
import climate
import datetime
import downhill
import os
import warnings
from . import graph
from . import trainer... | masterkeywikz/seq2graph | src/theanets-0.6.1/theanets/main.py | Python | mit | 9,363 |
from django.db import models
from epg_core import models as core_models
class File(models.Model):
name = models.CharField(max_length=100)
filename = models.CharField(max_length=255)
def __unicode__(self):
return "%s (%s)" % (self.name, self.filename)
class XMLTVChannel(models.Model):
core_cha... | ansmirnov/epg-manager | epg_manager/import_xmltv/models.py | Python | gpl-2.0 | 545 |
# coding: utf-8
"""
Fail: read it https://developers.google.com/appengine/docs/python/gettingstartedpython27/devenvironment
ide - https://developers.google.com/eclipse/docs/running_and_debugging_2_0
https://developers.google.com/appengine/articles/eclipse !!
Сервисы на gae
https://developers.google.com/api-cl... | zaqwes8811/coordinator-tasks | projects/thin-client-impl/gae-python/gae_test/__init__.py | Python | apache-2.0 | 760 |
from flask.ext.script import Manager, Server
from app import app
manager = Manager(app)
manager.add_command("runserver",
Server(host='127.0.0.1',port=5000, use_debugger=True))
if __name__ == '__main__':
manager.run() | Informationretrieval2016/Furnito_web | manage.py | Python | apache-2.0 | 231 |
from flask_restful import reqparse
from flask_restful import Resource
from rpi_pwm_server.pwm import PWMCtl
import logging
LOG = logging.getLogger(__name__)
class PWMResourse(Resource):
def get(self, *args, **kwargs):
return self._get_current_state()
def post(self, *args, **kwargs):
parse... | alanquillin/rpi_pwm_server | rpi_pwm_server/wsgi/pwm.py | Python | gpl-3.0 | 806 |
#!/usr/bin/env python2.7
import subprocess
import sys
import pexpect
import unittest
import shutil
import os
import hashlib
def openssl(args):
with open(os.devnull, "w") as devnull:
proc = subprocess.Popen(['openssl'] + args, stdin=subprocess.PIPE, stderr=devnull)
for i in range(6):
proc.stdin.write("\n")
p... | meh/bitlbee | protocols/skype/test.py | Python | gpl-2.0 | 3,669 |
import logging
from django.conf.urls import patterns, url
from django.contrib.gis import admin
from django.contrib.messages.api import get_messages
from django.contrib.sites.models import Site
from django.template.response import TemplateResponse
from location.models import (
LocationConsumerSettings,
Locatio... | coddingtonbear/django-location | location/admin.py | Python | mit | 2,517 |
from base import *
DOMAIN = "test295"
DOESNT_EXIST = "This_does_not_exist"
CONTENT_404 = "Not found. But it does exist now!"
CONF = """
vserver!295!nick = %s
vserver!295!document_root = %s
vserver!295!rule!1!match = default
vserver!295!rule!1!handler = cgi
vserver!295!error_handler = error_redir
vserver!295!... | lmcro/webserver | qa/295-custom-error-cgi.py | Python | gpl-2.0 | 988 |
# -*- coding: utf-8 -*-
'''
Container Example
==============
This example shows how to add a container to our screen.
A container is simply an empty place on the screen which
could be filled with any other content from a .kv file.
'''
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout impor... | bliz937/kivy | examples/container/main.py | Python | mit | 1,990 |
from setuptools import setup
setup(name='tumblrtokens',
version='0.3',
description='Abstracts out creating Oauth authentication tokens for Tumblr.',
url='https://github.com/mkell43/tumblrtokens',
author='Michael Keller',
author_email='mike.k@blu-web.com',
license='MIT',
packag... | mkell43/tumblrtokens | setup.py | Python | mit | 397 |
from nose2.compat import unittest
from nose2.plugins import layers
from nose2 import events, loader, session
from nose2.tests._common import TestCase
class TestLayers(TestCase):
tags = ['unit']
def setUp(self):
self.session = session.Session()
self.loader = loader.PluggableTestLoader(session=... | dhenrygithub/QGIS | python/ext-libs/nose2/tests/unit/test_layers_plugin.py | Python | gpl-2.0 | 7,967 |
#!/usr/bin/python
from ConfigParser import SafeConfigParser
import os
import subprocess
import sys
import shlex
import shutil
import os.path
import glob
from MapBuilder import MapBuilder
from ArgParser import parse_args
class Config:
def __init__(self, config_name):
self.config_name = config_name
s... | sameeptandon/sail-car-log | process/LaneCorrectorPipeline.py | Python | bsd-2-clause | 8,473 |
"""
Django settings for shopsite project.
Generated by 'django-admin startproject' using Django 1.9.
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/
"""
import os
# ... | xueqiang41/shopsite | shopsite/shopsite/settings.py | Python | gpl-2.0 | 4,757 |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.utils import six
from djblets.util.decorators import augment_method_from
from djblets.webapi.decorators import (webapi_login_required,
... | brennie/reviewboard | reviewboard/webapi/resources/default_reviewer.py | Python | mit | 13,846 |
#! /usr/bin/env python
# -*- coding: utf8 -*-
###################################################################################################
# RuleUser
# widget.py
#
# Copyright (C) 2012,2013 Andrey Burbovskiy <xak-altsp@yandex.ru>
#
# Developed specially for ALT Linux School.
# http://www.altlinux.org/LTSP
#
# ... | xak-mcu/ruleuser | widget.py | Python | gpl-2.0 | 22,058 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/cowboy/PycharmProjects/CVP/Recuperacion.ui'
#
# Created: Wed May 27 02:08:30 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 =... | esvire/CVP | Recuperacion_ui.py | Python | gpl-2.0 | 3,165 |
"""
Views for creating, editing and viewing site-specific user profiles.
"""
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.http import Http404
from dja... | raven47git/readthedocs.org | readthedocs/profiles/views.py | Python | mit | 8,999 |
from erukar.system.engine import MagicEffect
class Divinomorph(MagicEffect):
def enact(self, instigator, target, cmd, mutator):
mutator.set('damage_type', 'divine')
mutator.set('sanctity', 1)
return mutator
| etkirsch/legends-of-erukar | erukar/content/magic/modifiers/Divinomorph.py | Python | agpl-3.0 | 237 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | thenetcircle/dino | test/validation/test_validation_base.py | Python | apache-2.0 | 3,720 |
from .user_orders_request import UserOrdersRequest
from .user_orders_schema import UserOrdersSchema
| willrp/willbuyer | backend/util/request/order/user_orders/__init__.py | Python | mit | 100 |
import time
import requiem
sensor = requiem.Sensor("test")
alert = requiem.IDMEFAlert()
alert["alert.classification(0).name"] = "test python"
alert["alert.assessment.impact.severity"] = "low"
alert["alert.assessment.impact.completion"] = "failed"
alert["alert.assessment.impact.type"] = "recon"
alert["alert.detect_ti... | requiem-forasiem/librequiem | docs/api/examples/python/send_alert.py | Python | gpl-2.0 | 604 |
# -*- coding: iso-8859-1 -*-
#
# The Python Imaging Library.
# $Id$
#
# WAL file handling
#
# History:
# 2003-04-23 fl created
#
# Copyright (c) 2003 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#
# NOTE: This format cannot be automatically recognized, so the reader
# is not... | Amechi101/concepteur-market-app | venv/lib/python2.7/site-packages/PIL/WalImageFile.py | Python | mit | 5,524 |
#!/usr/bin/env dls-python
## \namespace read_archiver
# read_archiver.py is a python script to read bits
# from pmac status mbbo records in the archiver
# The intended use case is to query for changes in status bits
#
# Example query:
# \verbatim
# dls-python read_archiver.py BL02I-MO-STEP-05:AXIS1:status3 0x4 2015... | dls-controls/pmacUtil | pmacUtilApp/src/read_archiver.py | Python | apache-2.0 | 6,153 |
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# 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... | openstack/python-neutronclient | neutronclient/tests/unit/test_cli20_metering.py | Python | apache-2.0 | 3,969 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.