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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 2013Commons/HUE-SHARK | apps/shell/src/shell/views.py | Python | apache-2.0 | 5,812 |
"""
Instructor Views
"""
## NOTE: This is the code for the legacy instructor dashboard
## We are no longer supporting this file or accepting changes into it.
from contextlib import contextmanager
import csv
import json
import logging
import os
import re
import requests
import urllib
from collections import defaultdict... | htzy/bigfour | lms/djangoapps/instructor/views/legacy.py | Python | agpl-3.0 | 50,833 |
# ether.py - lookup functions for ethernet addresses
#
# Copyright (C) 2010, 2011 Arthur de Jong
#
# 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... | silkentrance/nss-pam-ldap | pynslcd/ether.py | Python | lgpl-2.1 | 2,912 |
# -*- coding: utf-8 –*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import os
sys.path.append(os.getcwd())
import subprocess
import shutil
import comm_funcs
import sub_gene_comm, godroid_helper
def __self_call_get_package( contents_list ):
return sub_gene_comm.get_go_file_header(contents_list)
def _... | cloudtrends/godroid | sub_gene_funcs_gorp.py | Python | mit | 5,357 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class StockWarnInsufficientQty(models.AbstractModel):
_name = 'stock.warn.insufficient.qty'
_description = 'Warn Insufficient Quantity'
product_id = fields.Many2one('pr... | jeremiahyan/odoo | addons/stock/wizard/stock_warn_insufficient_qty.py | Python | gpl-3.0 | 1,900 |
# coding=utf-8
"""Test cases for the OSM module.
:copyright: (c) 2013 by Tim Sutton
:license: GPLv3, see LICENSE for more details.
"""
import os
from reporter.utilities import LOGGER
from reporter.osm import (
load_osm_document,
extract_shapefile,
check_string)
from reporter.test.helpers import FIXTURE_PAT... | Gustry/osm-reporter | reporter/test/test_osm.py | Python | gpl-3.0 | 2,715 |
from SpecImports import *
CogParent = 110400
BattleCellId = 0
BattleCells = {BattleCellId: {'parentEntId': CogParent,
'pos': Point3(0, 0, 0)}}
CogData = [{'parentEntId': CogParent,
'boss': 0,
'level': 11,
'battleCell': BattleCellId,
'pos': Point3(-6, 0, 0),
'h': 180,
'behavior': 'stand',
'... | silly-wacky-3-town-toon/SOURCE-COD | toontown/coghq/BossbotCountryClubKartRoom_Battle00_Cogs.py | Python | apache-2.0 | 963 |
import re
from rpmlint.checks.AbstractCheck import AbstractCheck
class PAMModulesCheck(AbstractCheck):
pam_module_re = re.compile(r'^(?:/usr)?/lib(?:64)?/security/([^/]+\.so)$')
def __init__(self, config, output):
super().__init__(config, output)
self.pam_whitelist = config.configuration['PA... | matwey/rpmlint | rpmlint/checks/PAMModulesCheck.py | Python | gpl-2.0 | 732 |
from twisted.internet import protocol, reactor
from time import ctime
HOST = '127.0.0.1'
PORT = 21567
class CTimerClient(protocol.Protocol):
def connectionMade(self):
self.sendData()
def sendData(self):
data = raw_input('message> ')
if data:
print 'send %s ...' % d... | walterfan/snippets | python/exam/TimeClient.py | Python | apache-2.0 | 817 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Twisted Manhole: interactive interpreter and direct manipulation support for
Twisted.
"""
| Architektor/PySnip | venv/lib/python2.7/site-packages/twisted/manhole/__init__.py | Python | gpl-3.0 | 167 |
#!/usr/bin/python2
'''
This example shows how to call popen and get the return text.
'''
import subprocess # for Popen
'''
A function that runs a command in a shell,checks that it succeeded and returns the output of that command
in case of success. In case of error it will throw an exception
This is similar to pyth... | nonZero/demos-python | src/examples/short/systems_programming/subprocess_pipe_single_process.py | Python | gpl-3.0 | 737 |
import sys
from codecs import StreamReader
from io import StringIO
from typing import Optional, TextIO, Union
stdout: Optional[Union[TextIO, StreamReader]] = None
class Test:
def setUp(self) -> None:
global stdout # pylint: disable=global-statement
self.real_stdout = sys.stdout
sys.stdou... | asciinema/asciinema | tests/test_helper.py | Python | gpl-3.0 | 415 |
from Spirit.Events import Events
events = Events()
@events.on("s#upc")
def handleSendUpdatePlayerColour(self, data):
itemId = data[4]
if itemId.isdigit():
self.user.Color = int(itemId)
self.room.sendXt("upc", self.user.Id, itemId)
@events.on("s#uph")
def handleSendUpdatePlayerHead(self, data):
itemId = data[... | TunnelBlanket/Spirit | Spirit/Handlers/Play/Setting.py | Python | gpl-3.0 | 1,722 |
# Copyright (C) 2013, Daniel Narvaez
#
# 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 i... | sugarlabs/sugar-toolkit-gtk3 | src/sugar3/test/discover.py | Python | lgpl-2.1 | 1,395 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from textwrap import... | baroquebobcat/pants | tests/python/pants_test/backend/graph_info/tasks/test_dependees.py | Python | apache-2.0 | 7,942 |
# -*- coding: utf-8 -*-
from context import svm, mlp
import unittest, numpy
from os import listdir
from os.path import isfile, join
from scipy.io import loadmat
from sklearn.decomposition import PCA
from sklearn.externals import joblib
from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_scor... | fberanizo/sin5016 | tests/test_db2.py | Python | bsd-2-clause | 7,829 |
"""
AMAZON CLOUD ENTRANCE SCRIPT (AWS)
This script runs the FlaskWebProject application on AWS
"""
from os import environ
from FlaskWebProject import app as application
if __name__ == '__main__':
HOST = environ.get('SERVER_HOST', 'localhost')
try:
PORT = int(environ.get('SERVER_PORT', '5555'))
exc... | ohaz/amos-ss15-proj1 | application.py | Python | agpl-3.0 | 380 |
#!/usr/bin/env python2
# coding=utf-8
import argparse
import subprocess
parser = argparse.ArgumentParser(
description="""A tool which is used for Centos to create user account with a default password,
and additionally it'll ask the user to renew it for the first log-in.""")
parser.add_argument(
'-u', '--u... | supersu097/Mydailytools | adduser4pwd_login.py | Python | gpl-3.0 | 1,329 |
# Copyright 2015 Internap.
#
# 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, so... | mlecours/fake-switches | fake_switches/telnet_service.py | Python | apache-2.0 | 1,430 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-01 00:47
from __future__ import unicode_literals
from django.db import migrations
import versatileimagefield.fields
class Migration(migrations.Migration):
dependencies = [
('products', '0017_auto_20160601_0039'),
]
operations = [
... | libretees/libreshop | libreshop/products/migrations/0018_auto_20160601_0047.py | Python | gpl-3.0 | 533 |
# -*- coding: utf-8 -*-
"""
Insert Trims (multi-line) based on the video frame bookmarks at the
current cursor position of the Avisynth script in the current tab.
Date: 2012-09-11
Latest version: https://github.com/vdcrim/avsp-macros
Doom9 Forum thread: http://forum.doom9.org/showthread.php?t=163653
Changelog:... | vdcrim/AvsP-macros | Insert Trims from bookmarks (multi-line).py | Python | gpl-2.0 | 1,709 |
from . import stock_move
from . import product_product
| OCA/stock-logistics-warehouse | stock_move_auto_assign/models/__init__.py | Python | agpl-3.0 | 55 |
#This is the python backend that checks DNS of domains in Array
import socket
import string
import datetime
from cymruwhois import Client
from async_dns import AsyncResolver
while (True):
with open('db/active.db') as f:
content = f.readlines()
myList = [i.split('|')[0].rstrip() for i in content]
ar = AsyncResolv... | MrChrisW/kelihostracker | engine/scanner.py | Python | gpl-3.0 | 1,184 |
import json
from django.shortcuts import render, redirect, get_object_or_404
from django.utils.translation import ugettext as _
from django.views.decorators.vary import vary_on_headers
from django.urls import reverse
from django.http import HttpResponse
from wagtail.utils.pagination import paginate
from wagtail.wagta... | SalahAdDin/wagtail-embedvideos | wagtail_embed_videos/views/embed_videos.py | Python | bsd-3-clause | 7,483 |
import subprocess
class module():
provides = "disk";
version = "0.0.1";
listeners = [];
def __init__(self, register, triggers):
self.triggers = triggers
register(self, triggers.STARTUP);
register(self, triggers.USER);
register(self, triggers.SHUTDOWN);
def get_value(self):
lines = subprocess.check... | ethan476/manager-client | client/modules/disk.py | Python | mit | 820 |
"""
Renderers are used to serialize a response into specific media types.
They give us a generic way of being able to handle various media types
on the response, such as JSON encoded data or HTML output.
REST framework also provides an HTML renderer the renders the browsable API.
"""
from __future__ import unicode_li... | stianjensen/django-rest-framework | rest_framework/renderers.py | Python | bsd-2-clause | 30,085 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | google-research/language | language/mentionmemory/data/prepare_complexwq.py | Python | apache-2.0 | 8,002 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-02 18:36
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | TrumanZCM/ChurchFinance | cashier/migrations/0001_initial.py | Python | apache-2.0 | 3,271 |
from collections import OrderedDict
from itertools import chain
from inspect import isclass, getmembers
import operator
import re
from operator import itemgetter
from coalib.settings.Annotations import typechain
class LanguageUberMeta(type):
"""
This class is used to hide the `all` attribute from the Languag... | yashtrivedi96/coala | coalib/bearlib/languages/Language.py | Python | agpl-3.0 | 14,576 |
import test_base
import test_expression
import test_ir_attachment
import test_ir_model
import test_ir_values
import test_menu
import test_search
import test_views
import test_ir_sequence
checks = [
test_base,
test_expression,
test_ir_attachment,
test_ir_model,
test_ir_values,
test_menu,
tes... | VitalPet/odoo | openerp/addons/base/tests/__init__.py | Python | agpl-3.0 | 370 |
"""Fixtures for cloud tests."""
import pytest
from unittest.mock import patch
from . import mock_cloud, mock_cloud_prefs
@pytest.fixture(autouse=True)
def mock_user_data():
"""Mock os module."""
with patch('hass_nabucasa.Cloud.write_user_info') as writer:
yield writer
@pytest.fixture
def mock_clou... | MartinHjelmare/home-assistant | tests/components/cloud/conftest.py | Python | apache-2.0 | 431 |
import os
import threading
from pueuey import ConnAdapter
from common import Notifier, ConnBaseTest
__all__ = ['ConnTest']
class ConnTest(ConnBaseTest):
tries = 6
def test_40_wait_for_notify(self):
conn_adapter = ConnAdapter(self.conn)
for try_index in range(self.tries):
notifie... | cecton/pueuey | tests/test_10_conn_adapter.py | Python | mit | 1,217 |
import tensorflow as tf
import os
import os.path as osp
from keras import backend as K
from sys import argv
import sys
from losses import *
from keras.models import load_model
# Allow relative imports when being executed as script.
if __name__ == "__main__" and __package__ is None:
sys.path.insert(0, os.path.join... | GiladAmar/Crash_courses | Python/ML/convert_h5_to_pb.py | Python | mit | 2,372 |
#!/usr/bin/env python
import os
import sys
import logging
import signal
import tornado.ioloop
import tornado.web
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
logging.getLogger().setLevel(logging.DEBUG)
from examples import render_view
import examples.loopback.handlers
import examp... | minervaproject/pykurento | examples/app.py | Python | lgpl-2.1 | 1,346 |
# -*- coding: utf-8 -*-
"""
Vector.py - Extension of QVector3D which adds a few missing methods.
Copyright 2010 Luke Campagnola
Distributed under MIT/X11 license. See license.txt for more infomation.
"""
from .Qt import QtGui, QtCore
import numpy as np
class Vector(QtGui.QVector3D):
"""Extension of QVector3D wh... | ibressler/pyqtgraph | pyqtgraph/Vector.py | Python | mit | 2,073 |
from numpy import loadtxt
from pychemia.utils.periodic import atomic_symbol
from pychemia import Structure
def load(filename):
symbols = loadtxt(filename, skiprows=2, usecols=[0], dtype='|S2', ndmin=1)
symbols = [x.decode('utf-8') for x in symbols]
for i in range(len(symbols)):
if symbols[i].isdi... | MaterialsDiscovery/PyChemia | pychemia/io/xyz.py | Python | mit | 1,220 |
#! /usr/bin/env python
"""
Base file, for simple actions such as loading images
and drawing text, shapes, etc.
"""
import os, pygame, sys, textlogic
from pygame.locals import *
# easy colours
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
YELLOW = (255, 255, 0)
M... | Toofifty/Tittle | Tittle/core/base.py | Python | artistic-2.0 | 4,481 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
import django.db.models.deletion
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):
dependencies = [
migrations.swappable... | proversity-org/edx-platform | openedx/core/djangoapps/video_pipeline/migrations/0003_coursevideouploadsenabledbydefault_videouploadsenabledbydefault.py | Python | agpl-3.0 | 2,075 |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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... | atilag/qiskit-sdk-py | examples/python/initialize.py | Python | apache-2.0 | 3,493 |
#coding: utf-8
import sys
import os
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
def sendmail(subject, content, filename):
try:
sender = 'lxz_dev@163.com'
receiver = 'lxz_dev@163.com'
smtpserver = 'smtp.163.com'
... | longxz/quant | quantreport/script/mail.py | Python | apache-2.0 | 1,257 |
"""
Check Permutation: Given two strings, write a method to decide if one is a
permutation of the other.
Notes:
Check with interviewer regarding:
- case sensitivity
- ASCII or Unicode?
"""
from collections import Counter
# A: O(n)
# W: O(n)
def base_case(a, b):
return len(a) == len(b) and set(a) == set(b)
... | corymb/cracking-the-coding-interview | src/c1/q2.py | Python | mit | 536 |
"""
Compendium of generic DNS utilities.
.. note::
Some functions in the ``dnsutil`` execution module depend on ``dig``.
"""
import logging
import socket
import time
import salt.utils.files
import salt.utils.path
import salt.utils.stringutils
log = logging.getLogger(__name__)
def __virtual__():
"""
G... | saltstack/salt | salt/modules/dnsutil.py | Python | apache-2.0 | 11,788 |
# Copyright 2001 by Katharine Lindner. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Martel based parser to read MetaTool output files.
This is a huge regular regul... | dbmi-pitt/DIKB-Micropublication | scripts/mp-scripts/Bio/MetaTool/metatool_format.py | Python | apache-2.0 | 11,602 |
#!/usr/bin/env python
#
# Copyright 2008 Jose Fonseca
#
# 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
# (at your option) any later version.
#
# This ... | dpimenov/tvdb_api | tests/gprof2dot.py | Python | unlicense | 53,218 |
'''GUI for PyMOLProbity plugin.'''
from __future__ import absolute_import
import logging
import Pmw
import sys
if sys.version_info[0] < 3:
import Tkinter as tk
import tkMessageBox
else:
import tkinter as tk
import tkinter.messagebox as tkMessageBox
from pymol import cmd
from . import main
logger =... | jaredsampson/pymolprobity | pymolprobity/gui.py | Python | mit | 24,033 |
# Copyright 2016 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... | allenlavoie/tensorflow | tensorflow/contrib/distributions/python/kernel_tests/bijectors/cholesky_outer_product_test.py | Python | apache-2.0 | 5,365 |
#!/usr/bin/env python
"""Wrapper script for running jobs in TaskCluster
This is intended for running test jobs in TaskCluster. The script
takes a two positional arguments which are the name of the test job
and the script to actually run.
The name of the test job is used to determine whether the script should be run
... | pyfisch/servo | tests/wpt/web-platform-tests/tools/ci/run_tc.py | Python | mpl-2.0 | 9,392 |
import numpy as np
from random import shuffle
from .preprocessing import load_image
from .preprocessing import B_MEAN, G_MEAN, R_MEAN
from .boxes import assign_prior_boxes
from .data_augmentation import SSDAugmentation
from .multiprocessing import threadsafe_generator
class DataGenerator(object):
def __init__(s... | oarriaga/single_shot_multibox_detector | src/utils/data_generator.py | Python | mit | 2,459 |
import sys
import contextlib
import logging
import functools
import six
logger = logging.getLogger(__name__)
class SoupOps(object):
def __init__(self, selector=None, select_all=False):
self.selector = selector
self.select_all = select_all
def tag_selector(self, html):
with soup(htm... | kibitzr/kibitzr | kibitzr/transformer/html.py | Python | mit | 2,518 |
#!/usr/bin/env python
#############################################################
# ubi_reader/ubi
# (c) 2013 Jason Pruitt (jrspruitt@gmail.com)
#
# 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 Foundatio... | OpenBlackHole/openmultibootmanager | src/ubi_reader/ubi/display.py | Python | gpl-2.0 | 4,737 |
import turtle
import math
class Ball(object):
def __init__(self,turt,dX=0,dY=0,vX=0,vY=0,radius=1,sticky=1,forw=True,colour='red'):
self.dX=dX
self.dY=dY
self.vX=vX
self.vY=vY
self.radius=radius
self.colour=colour
self.forward=forw
... | mcgettin/ditOldProgramming | yr2/sem2/basicPhysics/linearMotion/oldVer.py | Python | mit | 2,584 |
"""
Utility functions for integer math.
TODO: rename, cleanup, perhaps move the gmpy wrapper code
here from settings.py
"""
import math
from bisect import bisect
from .backend import xrange
from .backend import BACKEND, gmpy, sage, sage_utils, MPZ, MPZ_ONE, MPZ_ZERO
small_trailing = [0] * 256
for j in range(1,8):
... | JensGrabner/mpmath | mpmath/libmp/libintmath.py | Python | bsd-3-clause | 16,688 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# Create on : 2019/07/13
from __future__ import unicode_literals
import os
from os.path import join
from test import base
from test.utility import ImportedTestCase, ImportedTestCaseError
class TestExe(base.TestPyConcreteBase):
def discover(self):
test_cases = ... | Falldog/pyconcrete | test/test_exe_testcases.py | Python | apache-2.0 | 2,156 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './acq4/devices/Scanner/TaskTemplate.ui'
#
# Created: Tue Dec 24 01:49:08 2013
# by: PyQt4 UI code generator 4.10
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QStr... | hiuwo/acq4 | acq4/devices/Scanner/TaskTemplate.py | Python | mit | 14,154 |
from pygame.constants import K_DOWN
from pygame_player import PyGamePlayer
class PongPlayer(PyGamePlayer):
def __init__(self, force_game_fps=10, run_real_time=False):
"""
Example class for playing Pong
"""
super(PongPlayer, self).__init__(force_game_fps=force_game_fps, run_real_tim... | DanielSlater/PyGamePlayer | examples/pong_player.py | Python | mit | 1,199 |
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2019 atrain_match developers
#
# This file is part of atrain_match.
#
# atrain_match 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... | foua-pps/atrain_match | atrain_match/utils/runutils.py | Python | gpl-3.0 | 9,928 |
"""empty message
Revision ID: 87a51f844ed4
Revises: f70ba6178b11
Create Date: 2016-07-18 22:59:08.874022
"""
# revision identifiers, used by Alembic.
revision = '87a51f844ed4'
down_revision = 'f70ba6178b11'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | rohitdatta/pepper | migrations/versions/87a51f844ed4_.py | Python | agpl-3.0 | 608 |
import sys
def main():
print "client"
def history():
print "history"
def version():
print "version"
def help():
print "help"
def cp():
print "cp"
def ls():
print "ls"
def mv():
print "mv"
def rm():
print "rm"
def link():
print "link"
def history():
print "history"
def meta_put(... | simonski/cloudstorage | cs/client.py | Python | mit | 3,753 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-tasks | samples/generated_samples/cloudtasks_v2_generated_cloud_tasks_list_queues_sync.py | Python | apache-2.0 | 1,455 |
#!/usr/bin/python
#
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | nearlyfreeapps/python-googleadwords | tests/adspygoogle/adwords/bugs/issue_22.py | Python | apache-2.0 | 1,921 |
from PySide import QtCore
class TreeItem(object):
FACET_NAME = 0
FACET_VALUE = 1
def __init__(self, data, isLeaf = True, isChecked = False, parent=None):
self.parentItem = parent
#('test case', 2)
self.itemData = data
self.checked = isChecked
self.isLeaf = isLeaf
... | zhongzhu/searchmyworkspace | src/facetmodel.py | Python | gpl-3.0 | 6,439 |
import scipy
import pyfits
import inversion
import matplotlib.pyplot as pyplot
import numpy
datadir = '/home/deen/Data/GRAVITY/InteractionMatrices/'
old = "HO_IM_1021.fits"
rapids = ["HODM_rapid_004.fits","HODM_rapid_005.fits", "HODM_rapid_006.fits", "HODM_rapid_007.fits", "HODM_rapid_008.fits", "HODM_rapid_009.fits",... | soylentdeen/BlurryApple | Control/compareCMs.py | Python | gpl-2.0 | 1,743 |
"""Server extension for JupyterLab."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from ._version import __version__
from .extension import load_jupyter_server_extension
def _jupyter_server_extension_paths():
return [{
"module": "jupyterlab"
}]... | charnpreetsingh185/jupyterlab | jupyterlab/__init__.py | Python | bsd-3-clause | 321 |
#!/usr/bin/env python
# encoding: utf-8
import tweepy # https://github.com/tweepy/tweepy
import csv
import os.path
# Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""
access_secret = ""
def get_list_members(screen_name, list_name):
# Define CSV filename and check if already exists
csv... | cberetta/tweet_downloader | listmembers_downloader.py | Python | mit | 1,469 |
from django.contrib import admin
from survey.actions import make_published
from survey.exporter.csv import Survey2Csv
from survey.exporter.tex import Survey2Tex
from survey.models import Answer, Category, Question, Response, Survey
class QuestionInline(admin.StackedInline):
model = Question
ordering = ("orde... | Pierre-Sassoulas/django-survey | survey/admin.py | Python | agpl-3.0 | 1,693 |
from multiprocessing import Process, Queue, Value
from webserver import webserver
import os, ctypes, models
def main():
is_occupied = Value(ctypes.c_bool, False)
eventq = Queue()
port = int(os.getenv('PEEPING_PI_PORT', 80))
sensor = Process(target=models.sensor.run, args=(eventq,))
accumulator = Pr... | mplorentz/peeping-pi | peeping-pi.py | Python | mit | 556 |
import numpy as np
import timeit
import warnings
class KMeansBase:
def __init__(self, data, k):
self.data = data
self.k = k
def cluster(self):
return self._lloyds_iterations()
def _initial_centroids(self):
# get the initial set of centroids
# get k random numbers b... | thilinamb/k-means-parallel | src/KMeansBase.py | Python | apache-2.0 | 3,729 |
"""Provide access to Python's configuration information. The specific
configuration variables available depend heavily on the platform and
configuration. The values may be retrieved using
get_config_var(name), and the list of variables is available via
get_config_vars().keys(). Additional convenience functions are a... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/distutils/sysconfig.py | Python | mit | 21,650 |
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
class Command(BaseCommand):
args = 'user'
help = "Show a user's roles and permissions"
def handle(self, *args, **options):
print args
if len(args) != 1:
raise CommandE... | malishevg/edugraph | lms/djangoapps/django_comment_client/management/commands/show_permissions.py | Python | agpl-3.0 | 991 |
# Copyright (c) 2015 SONATA-NFV, 2017 5GTANGO
# 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 ... | sonata-nfv/son-mano-framework | son-mano-base/setup.py | Python | apache-2.0 | 2,999 |
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | nebril/fuel-web | nailgun/nailgun/utils/migration.py | Python | apache-2.0 | 21,463 |
"""
obiKEGG2 configuration
mostly just caching settings
"""
from __future__ import absolute_import
import os
try:
import ConfigParser as configparser
except ImportError:
import configparser
from six import StringIO
from ..utils import serverfiles
kegg_dir = serverfiles.localpath("KEGG2")
default = """
[ca... | tomazc/orange-bio | orangecontrib/bio/kegg/conf.py | Python | gpl-3.0 | 939 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | alxgu/ansible | lib/ansible/modules/cloud/google/gcp_compute_instance_group_facts.py | Python | gpl-3.0 | 7,002 |
from django.contrib import admin
from dbparti import backend
from dbparti.backends.exceptions import PartitionColumnError, PartitionFilterError
class PartitionableAdmin(admin.ModelAdmin):
partition_show = 'all'
def __init__(self, *args, **kwargs):
super(PartitionableAdmin, self).__init__(*args, **kwa... | bsauer/django-db-parti | dbparti/admin.py | Python | bsd-3-clause | 1,537 |
# -*- 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 model 'NoteViewed'
db.create_table('issues_noteviewed', (
('id', self.gf('django.db.mod... | mostateresnet/django-ticket | issues/migrations/0030_auto__add_noteviewed.py | Python | mit | 9,507 |
# Create your views here.
import json
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from editions.models import Edition
from django.contrib.auth.decorators import login_required
@login_required
def index(request):
all_editions = Edi... | giorgosera/quar | apps/editions/views.py | Python | mit | 1,281 |
# -*- coding: utf-8 -*-
# Copyright 2014 Objectif Libre
#
# 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 ... | muraliselva10/cloudkitty | cloudkitty/api/v1/datamodels/billing.py | Python | apache-2.0 | 939 |
import uuid
import resources.lib.modules.control as control
def get_user():
return control.setting('oiplay_account')
def get_password():
return control.setting('oiplay_password')
def get_device_id():
device_id = control.setting('oiplay_device_id')
if not device_id:
device_id = str(uuid.uui... | olavopeixoto/plugin.video.brplay | resources/lib/modules/oiplay/private_data.py | Python | gpl-3.0 | 414 |
from django.db import models
from cms.models.pluginmodel import CMSPlugin
from django.core.validators import MaxValueValidator, MinValueValidator
from django.conf import settings
import urllib2
import json
def get_projects():
projects = []
url = settings.REALWORKS_API + 'projects/?format=json'
try:
... | corallus/django-nieuwbouw-inschrijven | inschrijven/models.py | Python | mit | 1,314 |
import time
import collections
class CacheHelper:
def __init__(self, cache_time=300):
self._refresh_time=collections.defaultdict(int)
self._cached=collections.defaultdict(int)
def _cache_helper(self, func):
if time.time() > self._refresh_time[func.__name__]:
self._cached[fu... | earney/Preserve | Common/CacheHelper.py | Python | mit | 439 |
#!/usr/bin/env python
__author__ = 'chris'
import argparse
import sys
from PIL import Image
parser = argparse.ArgumentParser(description="Crop images")
parser.add_argument('--image', help='The image to crop', type=argparse.FileType('r'), required=True)
parser.add_argument('--left', help='The number of pixels to crop ... | wooey/django-djangui | wooey/tests/scripts/crop.py | Python | bsd-3-clause | 1,071 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/compiler/plugin.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf imp... | ikool/metact06-djan | lib/google/protobuf/compiler/plugin_pb2.py | Python | bsd-3-clause | 7,516 |
# open the file of new values (just 1 column of numbers, one for each alpha carbon)
inFile = open("distance.correlations", 'r')
# create the global, stored array
stored = []
# read the new B factors from file
for line in inFile.readlines(): stored.append( float(line) )
# close the input file
inFile.close()
max_b... | ausmeyer/hiv_structural_determinants-paper-now | data/protease/protease_structure/predictors/color.py | Python | mit | 694 |
# Copyright 2015 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | edenhill/muckrake | muckrake/tests/sr_master_failover_test.py | Python | apache-2.0 | 3,626 |
# -*- coding: utf-8 -*-
""" Python KNX framework
License
=======
- B{PyKNyX} (U{https://github.com/knxd/pyknyx}) is Copyright:
- © 2016-2017 Matthias Urlichs
- PyKNyX is a fork of pKNyX
- © 2013-2015 Frédéric Mantegazza
This program is free software; you can redistribute it and/or modify
it under the terms ... | knxd/pKNyX | pyknyx/services/configManager.py | Python | gpl-3.0 | 6,990 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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.
#
# Ansible is distribut... | le9i0nx/ansible | lib/ansible/modules/network/nxos/nxos_interface.py | Python | gpl-3.0 | 26,597 |
'''
Test for full clone vm with one data volume on local
@author: yetian
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.operation... | zstackio/zstack-woodpecker | integrationtest/vm/virt_plus/clone/test_online_local_full_clone_one_data_volume.py | Python | apache-2.0 | 3,344 |
"""Sphinx configuration."""
import sys
import os
import sphinx
sphinx_ver = tuple(map(int, sphinx.__version__.split('.')))
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.ab... | joaander/hoomd-blue | sphinx-doc/conf.py | Python | bsd-3-clause | 1,827 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2014 ZHAW SoE
#
# Authors: Lucas Graf <graflu0@students.zhaw.ch>
# Toni Zehnder <zehndton@students.zhaw.ch>
#
# 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... | lexxito/monitoring | ceilometer/hardware/inspector/snmp.py | Python | apache-2.0 | 8,235 |
import pytest
from radar.utils import round_age
@pytest.mark.parametrize(['months', 'expected'], [
(3, 3), # 3 months
(60, 60), # 5 years
(61, 60), # 5 years, 1 month
])
def test(months, expected):
assert round_age(months) == expected
| renalreg/radar | tests/test_round_age.py | Python | agpl-3.0 | 257 |
"""The tests for the REST sensor platform."""
import asyncio
from http import HTTPStatus
from unittest.mock import MagicMock, patch
import httpx
import respx
from homeassistant import config as hass_config
from homeassistant.components.homeassistant import SERVICE_UPDATE_ENTITY
import homeassistant.components.sensor ... | jawilson/home-assistant | tests/components/rest/test_sensor.py | Python | apache-2.0 | 28,335 |
#!/usr/bin/env python
#
# London Law -- a networked manhunting board game
# Copyright (C) 2003-2004, 2005 Paul Pelzl
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, Version 2, as
# published by the Free Software Foundation.
#
# This... | anyc/londonlaw | londonlaw/aiclients/detective_simple_launcher.py | Python | gpl-2.0 | 1,841 |
"""
Utilities package.
They can vary from parsers to anything else.
"""
__all__ = ["parsers"]
from utils import parsers
| liraop/nvidia_fan_control | utils/__init__.py | Python | gpl-3.0 | 122 |
# Client for evospace-js
# Example in python
# Programmer : Luis Rodriguez
# Author: Luis Rodriguez
import barrister
import json
import random
def getRandomInt(vmin, vmax):
return random.randint(vmin, vmax)
def createPopulation(size):
new_individuals = []
l_min = [10, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
l_... | luisrodmen/clients-evospace-rpc | client-evospace.py | Python | mit | 2,161 |
import sys
import os
pardir = os.path.abspath(os.path.join(__file__, os.path.pardir))
sys.path.append(os.path.dirname(pardir))
# cwd = os.path.abspath(os.path.dirname(__file__))
# os.environ['IRMA_FRONTEND_CFG_PATH'] = cwd
| deloittem/irma-frontend | tests/__init__.py | Python | apache-2.0 | 224 |
"""Log for Trivia cog."""
import logging
__all__ = ["LOG"]
LOG = logging.getLogger("red.trivia")
| palmtree5/Red-DiscordBot | redbot/cogs/trivia/log.py | Python | gpl-3.0 | 100 |
from numina.core import BaseRecipe
from megaradrp.core.recipe import MegaraBaseRecipe
def test_base_recipe():
version = "1.0.1"
obj = MegaraBaseRecipe(version=version)
assert isinstance(obj, BaseRecipe)
assert obj.__version__ == version | sergiopasra/megaradrp | megaradrp/core/tests/test_recipe.py | Python | gpl-3.0 | 257 |
import numpy as np
import theano.tensor as T
import theano
import copy
from shape import *
from util import *
from transform import *
class Scene:
def __init__(self, shapes, lights, camera, shader):
self.shapes = shapes
self.lights = lights
self.camera = camera
self.shader = shade... | lebek/reversible-raytracer | orbit_experiments/scene.py | Python | mit | 4,344 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... | guillaume-philippon/aquilon | lib/aquilon/worker/commands/bind_server.py | Python | apache-2.0 | 7,022 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googleapis/google-cloudevents-python | src/google/events/firebase/analytics/v1/__init__.py | Python | apache-2.0 | 621 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.