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 |
|---|---|---|---|---|---|
from . import families
from .glm import glm, linear_component, plot_posterior_predictive
| wanderer2/pymc3 | pymc3/glm/__init__.py | Python | apache-2.0 | 89 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def remove_references_to_old_tables(apps, schema_editor):
model = apps.get_model('contenttypes', 'ContentType')
model.objects.filter(app_label='block').delete()
model.objects.filter(app_label='booking... | pkimber/kbsoftware_couk | project/migrations/0001_initial.py | Python | apache-2.0 | 3,178 |
"""
Module contains helper functions for loading stylesheets.
.. codeauthor:: Tomas Krizek <tomas.krizek1@tul.cz>
"""
import os
import platform
def load_stylesheet(path, resource_dir):
"""Loads the stylesheet file to a string.
This loading function fixes the paths in css files. All files in the css are con... | GeoMop/GeoMop | src/gm_base/geomop_util/stylesheet_loader.py | Python | gpl-3.0 | 1,031 |
# Gregory Gay (greg@greggay.com)
# Input generation for unions
# Almost the same as structs, but unions are intended to only have one value available at once.
# 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 obta... | Greg4cr/LabelSearch | src/LabelSearch/generation/UnionGenerator.py | Python | mpl-2.0 | 2,793 |
#!usr/bin/env python
#-*- coding: utf-8 -*-
from datetime import datetime
def search(n, arr):
start_time = datetime.now()
size = len(arr)
initial, mid = 0, (size / 2)
comparator = arr[mid]
while n != comparator:
if len(arr) == 1 and arr[0] != n:
return
arr = arr[0:mid... | IEEE-NITK/HacktoberFest | Searching_Algorithms/Binary_Search/binarySearchRecursiveAndNonRecursive.py | Python | mit | 981 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file './Preferences/ShortcutDialog.ui'
#
# Created: Tue Nov 18 17:53:56 2014
# by: PyQt5 UI code generator 5.3.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_ShortcutDialog(obj... | davy39/eric | Preferences/Ui_ShortcutDialog.py | Python | gpl-3.0 | 4,515 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
More elaborate tests for evaluation routines.
"""
from collections import Counter
import logging
import numpy as np
from . import counter_utils
from .evaluation import simple_precision, simple_recall,\
joint_precision, pooled_recall, pool_recall, joint_recall... | arunchaganty/kbp-online | src/kbpo/test_evaluation.py | Python | mit | 11,005 |
import json
import socket
import threading
import selenium.webdriver
import selenium.common.exceptions
from selenium.webdriver.common.keys import Keys
class Driver(selenium.webdriver.Firefox):
def __init__(self, *args, **kwargs):
super(Driver, self).__init__(*args, **kwargs)
self.handlers = {}
... | followcat/predator | downloader/webdriver.py | Python | lgpl-3.0 | 4,481 |
"""Use stochastic Lanczos quadrature to approximate spectral function sums of
any operator which has an efficient representation of action on a vector.
"""
import functools
from math import sqrt, log2, exp, inf, nan
import random
import warnings
import numpy as np
import scipy.linalg as scla
from scipy.ndimage.filters... | jcmgray/quijy | quimb/linalg/approx_spectral.py | Python | mit | 30,236 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('squalo_core', '0002_auto_20141224_1839'),
]
operations = [
migrations.AddField(
model_name='dataspace',
... | sirmmo/squalo | squalo_core/migrations/0003_dataspace_geo.py | Python | mit | 442 |
"""
sentry.interfaces.exception
~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
__all__ = ('Exception', )
import re
import six
from django.conf import settings
from sentr... | gencer/sentry | src/sentry/interfaces/exception.py | Python | bsd-3-clause | 10,045 |
# -*- encoding: utf-8 -*-
"""Unit tests for the Docker feature.
:Requirement: Docker
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: API
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from fauxfactory import gen_string, gen_url
from nailgun import entities
from random import choi... | elyezer/robottelo | tests/foreman/api/test_docker.py | Python | gpl-3.0 | 55,364 |
# vim:ts=4 sw=4 expandtab softtabstop=4
import unittest
from jsonmerge.jsonvalue import JSONValue
class TestJSONValue(unittest.TestCase):
def test_get_attr(self):
v = JSONValue({'a': 'b'})
va = v['a']
self.assertEqual('b', va.val)
self.assertEqual('#/a', va.ref)
def test_get_... | avian2/jsonmerge | tests/test_jsonvalue.py | Python | mit | 2,336 |
#!/usr/bin/python
# utility tool for automatically generating registerItem RDF (in TTL format) for terms
# within /49-2/AerodromeRecentWeather register based on list provided by ICAO AMOFSG/10
# @//src/weather-codes/recent-weather-codes-REww.txt
#
# example string:
# 'REBLSN,"Blowing snow"'
# example RDF:
# ... | wmo-registers/ukgov-ld-deploy | utils/recent_weather_registerItem_generator_49-2.py | Python | apache-2.0 | 4,252 |
#!/usr/bin/python2.4
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# $Id$
#
# Copyright (C) 1999-2006 Keith Dart <keith@kdart.com>
#
# 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... | xiangke/pycopia | SMI/pycopia/SMI/__init__.py | Python | lgpl-2.1 | 1,288 |
#! /usr/bin/env python
# Copyright (C) 2012 Club Capra - capra.etsmtl.ca
#
# This file is part of CapraVision.
#
# CapraVision is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either versio... | clubcapra/Ibex | src/seagoatvision_ros/scripts/CapraVision/client/gtk/filters/implementation/WinColorLevel.py | Python | gpl-3.0 | 2,354 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | Smile-SA/odoo_accounting | smile_purchase_commitment/tests/test_purchase_commitment.py | Python | agpl-3.0 | 2,439 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [... | beratdogan/arguman.org | web/profiles/migrations/0001_initial.py | Python | mit | 2,815 |
from django.db import models
from django.contrib.auth.models import User
class Post(models.Model):
creation_date = models.DateTimeField(auto_now=True)
title = models.CharField(max_length=100)
text = models.TextField(max_length=500)
user = models.ForeignKey(User)
# useful for the administration pa... | WebTech2-Group123/django-assignment | blog/posts/models.py | Python | mit | 373 |
#!/usr/bin/env python
# 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 argparse
import logging
import os
import sys
sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)),
... | SaschaMester/delicium | mandoline/tools/android/install_mandoline.py | Python | bsd-3-clause | 1,561 |
"""Test case implementation"""
import collections
import sys
import functools
import difflib
import pprint
import re
import warnings
from . import result
from .util import (
strclass, safe_repr, unorderable_list_difference,
_count_diff_all_purpose, _count_diff_hashable
)
__unittest = True
... | ktan2020/legacy-automation | win/Lib/unittest/case.py | Python | mit | 43,508 |
import struct
import json
import socket
from sjson_utils import CMD, json_object_hook, json_default
class SJSON:
def __init__(self, io=None, encoder=None, decoder=None):
self.encoder = encoder or json.JSONEncoder(default=json_default)
self.decoder = decoder or json.JSONDecoder(
object... | weapp/sjson | sjson.py | Python | mit | 2,963 |
import os
from ast import literal_eval
from datetime import datetime
from django.conf import settings
from django.contrib import auth, messages
from django.contrib.auth.models import User
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import Site
from django.core.except... | safwanrahman/kitsune | kitsune/users/views.py | Python | bsd-3-clause | 28,388 |
# Lint as: python3
# Copyright 2019 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
#
# Unl... | zephyrproject-rtos/zephyr | samples/modules/tflite-micro/magic_wand/train/train_test.py | Python | apache-2.0 | 3,041 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
from pip.basecommand import Command
from pip.index import PackageFinder
from pip.log import logger
from pip.exceptions import CommandError, PreviousBuildDirError
from pip.req import InstallRequirement, RequirementSet, parse_requirement... | tesb/flask-crystal | venv/Lib/site-packages/pip/commands/wheel.py | Python | apache-2.0 | 7,402 |
# 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-relay/azure/mgmt/relay/models/authorization_rule.py | Python | mit | 1,513 |
"""PS Move Restful Server
Usage:
server.py [--battery-saver]
Options:
--battery_saver If set, only allows a few seconds without a GET request before shutting off a controllers LEDs and rumble
"""
from docopt import docopt
import datetime
import time
from threading import Thread
from flask import Flask
from flas... | evanbrumley/psmove-restful | server.py | Python | mit | 3,841 |
from buildercore.bvars import encode_bvars, read_from_current_host
from buildercore.command import remote_sudo, upload
from io import StringIO
from decorators import requires_aws_stack
from buildercore.config import BOOTSTRAP_USER
from buildercore.core import stack_all_ec2_nodes, current_node_id
from buildercore.contex... | elifesciences/builder | src/buildvars.py | Python | mit | 6,259 |
#
# (c) 2016 Red Hat Inc.
#
# 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 d... | tux-00/ansible | lib/ansible/plugins/action/junos.py | Python | gpl-3.0 | 4,693 |
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | shad7/seedbox | seedbox/db/sqlalchemy/migration.py | Python | mit | 4,395 |
# Created by Leo from: C:\Development\Python23\Lib\site-packages\vb2py\vb2py.leo
"""The main form for the application"""
from PythonCardPrototype import model
# Allow importing of our custom controls
import PythonCardPrototype.res
PythonCardPrototype.res.APP_COMPONENTS_PACKAGE = "vb2py.targets.pythoncard.vbc... | gisadmin/vb2py | vb2py/vb/test4/test/frmMain.py | Python | gpl-3.0 | 9,437 |
# -*- coding: utf-8; -*-
#
# oedes - organic electronic device simulator
# Copyright (C) 2017-2018 Marek Zdzislaw Szymanski (marek@marekszymanski.com)
#
# This program 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 ... | mzszym/oedes | oedes/models/equations/dos.py | Python | agpl-3.0 | 4,355 |
# -*- coding: utf-8 -*-
#
# 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
... | sid88in/incubator-airflow | tests/contrib/operators/test_mongo_to_s3_operator.py | Python | apache-2.0 | 3,847 |
#!/usr/bin/env python
"""
Joins a number of XD volumes into a (X+1)D volume.
Copyright (C) 2013 Oskar Maier
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at y... | loli/medpy | bin/medpy_join_xd_to_xplus1d.py | Python | gpl-3.0 | 5,243 |
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope th... | avsm/xen-unstable | tools/python/xen/xend/server/XMLRPCServer.py | Python | gpl-2.0 | 10,109 |
import sys
import linecache
import time
import socket
import traceback
import thread
import threading
import Queue
from idlelib import CallTips
from idlelib import AutoComplete
from idlelib import RemoteDebugger
from idlelib import RemoteObjectBrowser
from idlelib import StackViewer
from idlelib import... | Jeff-Tian/mybnb | Python27/Lib/idlelib/run.py | Python | apache-2.0 | 12,890 |
# Find points on the medial surface from the Voronoi vertices.
# Author: Hao Chen <hao.chen.math@gmail.com>
import numpy as np
from scipy.spatial import Voronoi
# read in file
vertexData = np.loadtxt("G-coord.dat")
vertexPosition = vertexData[:, 1:4]
vertexNormal = vertexData[:, 4:]
vertices = vertexPosition[:]
fo... | Dr-How/CubicLLC | Voronoi.py | Python | gpl-3.0 | 4,263 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "joinrpg.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| joinrpg/joinrpg | manage.py | Python | apache-2.0 | 250 |
# coding=utf-8
__version__ = "0.1.0"
| xiaoslzhang/pyyingyu | yingyu/version.py | Python | apache-2.0 | 38 |
# test loading from ptr16 type
# only works on little endian machines
@micropython.viper
def get(src: ptr16) -> int:
return src[0]
@micropython.viper
def get1(src: ptr16) -> int:
return src[1]
@micropython.viper
def memadd(src: ptr16, n: int) -> int:
sum = 0
for i in range(n):
sum += src[i... | kerneltask/micropython | tests/micropython/viper_ptr16_load.py | Python | mit | 607 |
import autocomplete_light.shortcuts as autocomplete_light
from django import http
from .models import OnTheFly
class OnTheFlyAutocomplete(autocomplete_light.AutocompleteModelBase):
choices = OnTheFly.objects.all()
def autocomplete_html(self):
html = super(OnTheFlyAutocomplete, self).autocomplete_htm... | dsanders11/django-autocomplete-light | autocomplete_light/example_apps/create_choice_on_the_fly/autocomplete_light_registry.py | Python | mit | 740 |
# -*- coding: utf-8 -*-
#
# parserator documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 20 12:22:44 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... | et-al-Health/parserator | docs/conf.py | Python | mit | 8,221 |
'''
universal XBMC module
Copyright (C) 2013 the-one @ XUNITYTALK.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 Foundation, either version 3 of the License, or
(at your option) any ... | AMOboxTV/AMOBox.LegoBuild | script.module.universal/default.py | Python | gpl-2.0 | 2,125 |
#! $HOME/SOFTWARE/anaconda2/envs/vison/bin/ python
# -*- coding: utf-8 -*-
"""
Wrap-up of SAO DS9 to quickly load a number of images, for inspection.
Core engine: pyds9 (http://hea-www.harvard.edu/RD/pyds9/)
:History:
Created on Thu Mar 17 13:18:10 2016
:author:
Ruyman Azzollini
"""
from pdb import set_trace as s... | ruymanengithub/vison | vison/scripts/quickds9.py | Python | gpl-3.0 | 2,887 |
# -*- coding: utf-8 -*-
# ..#######.########.#######.##....#..######..######.########....###...########.#######.########..######.
# .##.....#.##.....#.##......###...#.##....#.##....#.##.....#...##.##..##.....#.##......##.....#.##....##
# .##.....#.##.....#.##......####..#.##......##......##.....#..##...##.##.....#.... | repotvsupertuga/tvsupertuga.repository | script.module.openscrapers/lib/openscrapers/sources_openscrapers/en/watchepisodes.py | Python | gpl-2.0 | 4,574 |
from django.conf import settings
from django.template import Template, Context
from django.template.loader import render_to_string
from django.db import models
from .backends import send_notification
from .constants import INFO, HTML, TEXT
class Notification(object):
name = None
context_object_name = 'objec... | tddv/readthedocs.org | readthedocs/notifications/notification.py | Python | mit | 2,276 |
# -*- coding: utf-8 -*-
##############################################################################
# Copyright (C) 2012 SICLIC http://siclic.fr
#
# 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 Fr... | OpenSTC-Eleger/stc-prets | siclic_time_extensions.py | Python | agpl-3.0 | 1,950 |
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap, NumberActionMap
from Components.MenuList import MenuList
from Components.Button import Button
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.ActionMap import NumberActionMap, ActionMap
from Com... | popazerty/dvbapp2-gui | lib/python/EGAMI/EGAMI_Green.py | Python | gpl-2.0 | 9,194 |
import hs_plugin
def command_guest_list_cmd():
'''
List all command
wrapper of base.hs_plugin.list_cmd()
@rtype: dict
@return: ["value"] = base.hs_plugin.list_cmd() output
'''
return hs_plugin.ok({"value":hs_plugin.list_cmd()})
| luzi82/HiSocial | core/hs_plugin/_hisocial.py | Python | gpl-3.0 | 262 |
# Copyright (c) 2010-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 agree... | dpgoetz/swift | swift/obj/server.py | Python | apache-2.0 | 38,864 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-23 05:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='userloc... | Thiyageshv/PizzaReminder | drf_demo/model_less/migrations/0001_initial.py | Python | bsd-3-clause | 672 |
from django.shortcuts import redirect
from django.shortcuts import render
from django.contrib.auth.models import User
from django.views.generic.base import View
from perfis.models import Perfil
from usuarios.forms import RegistrarUsuarioForm
class RegistrarUsuarioView(View):
template_name = 'registrar.html'
... | alvarocneto/alura_django | usuarios/views.py | Python | mit | 1,485 |
from __future__ import print_function
import webbrowser
import neuroglancer
viewer = neuroglancer.Viewer()
with viewer.txn() as s:
s.layers['image'] = neuroglancer.ImageLayer(
source='precomputed://gs://neuroglancer-public-data/flyem_fib-25/image',
)
s.layers['ground_truth'] = neuroglancer.Segme... | seung-lab/neuroglancer | python/examples/example_row_layout.py | Python | apache-2.0 | 692 |
# -*- coding: utf-8 -*-
import hashlib
import json
import os
import tempfile
import zipfile
from datetime import datetime
from django import forms
from django.core.files.storage import default_storage as storage
from django.conf import settings
from django.test.utils import override_settings
import mock
import pytest... | tsl143/addons-server | src/olympia/files/tests/test_models.py | Python | bsd-3-clause | 56,292 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as publish... | rogerscristo/BotFWD | env/lib/python3.6/site-packages/telegram/inline/inlinequeryresultdocument.py | Python | mit | 4,538 |
#!/usr/bin/env python3
# Copyright (c) 2018-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Verify that starting bitcoin with -h works as expected."""
from test_framework.test_framework import B... | yenliangl/bitcoin | test/functional/feature_help.py | Python | mit | 2,481 |
#TODO replace RPSGame with this class(for clarity)
__author__ = "Paul Council, Joseph Gonzoph, Anand Patel"
__version__ = "sprint1"
__credits__ = ["Greg Richards"]
# imports
from ServerPackage import Game
class RockPaperScissors(Game.Game):
""" this class simulates two players playing a game of rock, paper, sci... | PaulieC/sprint2-Council | AvailableGames/RockPaperScissors.py | Python | apache-2.0 | 2,006 |
# Copyright 2010 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, 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.apach... | redhat-openstack/nova | nova/api/openstack/compute/servers.py | Python | apache-2.0 | 62,598 |
#!/usr/bin/env python
"""
Copyright 2015 Scott Wales
author: Scott Wales <scott.wales@unimelb.edu.au>
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... | ScottWales/ftools | ftools/format/Format.py | Python | apache-2.0 | 1,464 |
import re
# import sys
import threading
from PyQt4.QtGui import (
QWidget,
QRect,
QPalette,
QPen,
QPainter,
Qt,
QDialog,
QLabel,
QRadioButton,
QVBoxLayout,
QStackedLayout,
QGridLayout,
QGroupBox,
QButtonGroup,
Buttons,
CancelButton,
OkButton,
Clos... | gjhiggins/electrum | gui/qt/installwizard.py | Python | gpl-3.0 | 20,226 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import json
import datetime
import mimetypes
import os
import frappe
from frappe import _
import frappe.model.document
import frappe.utils
import frappe.sessions
import werkzeug.u... | gangadharkadam/saloon_frappe | frappe/utils/response.py | Python | mit | 4,943 |
#!/usr/bin/python
#Pyserial is used to talk to the LCD using the TX pin.
import serial
#used to pack variable number commands for serial to use
import struct
#the time module is used for the sleep function, this gives the LCD screen time to process incoming commands.
import time
#Python Imaging Library is used to proce... | jmtyson/pyrasplcd | pyrasplcd/__init__.py | Python | gpl-2.0 | 7,670 |
"""Utilities to assist with commerce tasks."""
import json
import logging
from urllib import urlencode
from urlparse import urljoin
import requests
import waffle
from django.conf import settings
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.utils.translation import ugettext... | Stanford-Online/edx-platform | lms/djangoapps/commerce/utils.py | Python | agpl-3.0 | 15,246 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2015 Kitware 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 cop... | cjh1/cumulus | tests/cases/transport_test.py | Python | apache-2.0 | 2,678 |
#!/usr/bin/env python3
# Copyright (c) 2014-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.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import unhexlif... | jtimon/bitcoin | test/functional/test_framework/util.py | Python | mit | 22,775 |
# wpa_supplicant control interface
# Copyright (c) 2014, Qualcomm Atheros, Inc.
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
from remotehost import remote_compatible
import logging
logger = logging.getLogger()
import os
import socket
import subprocess
import t... | s0lst1c3/eaphammer | local/hostapd-eaphammer/tests/hwsim/test_wpas_ctrl.py | Python | gpl-3.0 | 96,304 |
#!/usr/bin/python
"""
django management command: dump grades to csv files
for use by batch processes
"""
from instructor.offline_gradecalc import offline_grade_calculation
from courseware.courses import get_course_by_id
from xmodule.modulestore.django import modulestore
from opaque_keys import InvalidKeyError
from opaq... | olexiim/edx-platform | lms/djangoapps/instructor/management/commands/compute_grades.py | Python | agpl-3.0 | 2,000 |
# A Database and Query Analyze Tool
# Copyright (c) 2010-2011 John Anderson <sontek@gmail.com>
# License: GPLv3. See COPYING
import locale
import gettext
APP = 'PyQuil'
DIR = 'locale'
locale.setlocale(locale.LC_ALL, '')
gettext.bindtextdomain(APP, DIR)
gettext.textdomain(APP)
_ = gettext.gettext
| sontek/PyQuil | lib/common.py | Python | gpl-3.0 | 300 |
# criar lista com range
lista = [1,2,3,4]
print(lista)
# append() adiciona novos indices e valores a lista
lista.append(5)
lista.append(6)
lista.append(7)
print(lista)
# index() retorna o indice do valor contido na lista
# porém deve ser usado quando você tem certeza que
# o valor existe na lista
# quando você nã... | GlauberGoncalves/Python | 09-listas4.py | Python | mit | 1,217 |
# coding : utf-8
#file: Reduce.py
import os,os.path,re
def Reduce(sourceFoler,targetFile):
tempData = {} #缓存列表
p_re = re.compile(r'(.*?)(\d{1,}$)',re.IGNORECASE) #用正则表达式解析数据
for root,dirs,files in os.walk(sourceFolder):
for fil in files:
if fil.endswith('_map.txt'): #判断是reduce文件
sFile = open(o... | FannyCheung/python_Machine-Learning | MapReduce处理日志文件/Reduce.py | Python | gpl-2.0 | 1,172 |
# ===========================================================================
# eXe
# Copyright 2004-2006, University of Auckland
# Copyright 2004-2007 eXe Project, http://eXeLearning.org/
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | kohnle-lernmodule/palama | exe/webui/editorpage.py | Python | gpl-2.0 | 13,946 |
from django.contrib import admin
from .models import Name, AutoName
class NameAdmin(admin.ModelAdmin):
date_hierarchy = 'dated'
list_display = ('name', 'dated')
list_filter = ('dated',)
ordering = ('dated',)
admin.site.register(Name, NameAdmin)
class AutoNameAdmin(admin.ModelAdmin):
list_display... | aaugustin/django-tz-demo | tz_app/admin.py | Python | bsd-3-clause | 534 |
"""Offer time listening automation rules."""
import voluptuous as vol
from homeassistant.const import CONF_PLATFORM
from homeassistant.core import HassJob, callback
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.event import async_track_time_change
# mypy: allow-untyped-defs, no-... | sander76/home-assistant | homeassistant/components/homeassistant/triggers/time_pattern.py | Python | apache-2.0 | 2,692 |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Client(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
address = models.CharField(max_length=50, blank=True, null=True)
address2 = models.Cha... | vzvenyach/tenacious | attorneyclient/models.py | Python | mit | 1,156 |
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the... | karrtikr/ete | ete3/tools/phylobuild_lib/workflow/common.py | Python | gpl-3.0 | 25,833 |
# -*- coding: utf-8 -*-
# To force float point division
from __future__ import division
"""
Created on Sat Jun 21 18:18:41 2014
Author : Deokwoo Jung
E-mail : deokwoo.jung@gmail.com
"""
import os
import sys
import numpy as np
from numpy.linalg import inv
from numpy.linalg import norm
import uuid
import pylab as pl
... | deokwooj/DDEA | webgui/data_summerization.py | Python | gpl-2.0 | 18,175 |
# -*- coding: utf-8 -*-
#
#
# Copyright 2013 Netflix, 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 ... | VaishnoReddy/Aminator- | aminator/environment.py | Python | apache-2.0 | 3,491 |
#
# 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... | axbaretto/beam | sdks/python/apache_beam/internal/clients/bigquery/bigquery_v2_client.py | Python | apache-2.0 | 28,317 |
import pandas
s = pandas.Series([1, 2, 3])
print s
data = {'part': ['fidesz', 'jobbik'], 'szavazat': [60, 40]}
frame = pandas.DataFrame(data)
print frame
df = pandas.read_csv('../data/result_part.csv')
print df.head()
print df[:100]
print df['part']
print df['szavazat']
df['uj'] = 'NaN'
print df.tail()
new = d... | ceumicrodata/adatmesterseg | code/class11.py | Python | cc0-1.0 | 1,190 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy.table import Table, Column, QTable, table_helpers, NdarrayMixin, unique
from astropy.utils.exceptions import AstropyUserWarning
from astropy import time
from astropy import units as u
from astropy import coor... | StuartLittlefair/astropy | astropy/table/tests/test_groups.py | Python | bsd-3-clause | 21,682 |
import sys, os
sys.path.insert(1, os.path.join(sys.path[0], '../../../'))
import script.rio as io
import script.initial_condition.noh1D as noh1D
# Domain properties
lx = 1.0
ly = 1.0
Nx = 2097152
Ny = 1
# Scheme execution options
T = 0.6
CFL = 0.5
gamma = 5./3.
BClayer = 1
quantityList = ['rho', 'rhou_x', 'rhou_y'... | will-iam/Variant | casepy/eulerRuO2/nNoh2097152x1/chars.py | Python | mit | 473 |
import pymongo
con = pymongo.Connection()
db = con.school
students = db.students
amount = students.count()
print "Amount of elements in students: %s " % amount
exam_el = students.find({ "scores.type" : "exam" }).count()
print "Amount of exam types in students: %s " % exam_el
quiz_el = students.find({ "sco... | petervdb/eLearning | mongodb/dev_course/analyse_students.py | Python | apache-2.0 | 2,238 |
#!/usr/bin/env python
"""
Show storage quotas for specified users or for all registered users if nobody is specified
Example:
$ dirac-admin-user-quota
------------------------------
Username | Quota (GB)
------------------------------
atsareg | None
msapunov | Non... | ic-hep/DIRAC | src/DIRAC/DataManagementSystem/scripts/dirac_admin_user_quota.py | Python | gpl-3.0 | 1,611 |
# -*- coding: utf-8 -*-
# Author: Marcelo Huerta San Martín
# Contact: mghsm@uol.com.ar
# Revision: $Revision: 3968 $
# Date: $Date: 2005-10-29 14:28:44 +0200 (Sat, 29 Oct 2005) $
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please... | mfazekas/safaridriver | selenium/src/py/lib/docutils/languages/es.py | Python | apache-2.0 | 1,993 |
from setuptools import setup, find_packages
from pip.req import parse_requirements
from pip.download import PipSession
__version__ = '0.0.1'
it = parse_requirements('requirements.txt', session=PipSession())
setup(
name='fused',
author='vaultah',
license='MIT',
url='https://github.com/vaultah/fused'... | vaultah/fused | setup.py | Python | mit | 686 |
#!/usr/bin/env python2
import os,re,sys
from Tools.argue import Argue
from MommaArgue import MommaArgue, args
@args.argument(short='d')
def debug():
return False
@args.command(name='bub')
class BubbaArgue(args.root(MommaArgue)):
@args.attribute
def bubby(self):
return '@bubby'
@args.o... | eddo888/Tools | test/BubbaArgue.py | Python | mit | 529 |
import IcePick
from IcePick import HTMLStructureElt, HTMLStructure, EmptyHTMLElt, IcePick
import utils
| jack-michaud/IcePick | iPick/__init__.py | Python | gpl-3.0 | 104 |
# -*- coding: utf-8 -*-
"""
setup script
"""
__author__ = "Begon Jean-Michel <jm.begon@gmail.com>"
__copyright__ = "3-clause BSD License"
__version__ = 'dev'
from numpy.distutils.misc_util import Configuration
def configuration(parent_package="", top_path=None):
config = Configuration("util", parent_package, ... | jm-begon/randconv | randconv/util/setup.py | Python | bsd-3-clause | 497 |
from weibo import APIClient
import json
APP_KEY = "3722673574"
APP_SECRET = "3686fea0a65da883b6c2a7586f350425"
CALLBACK_URL = 'https://api.weibo.com/oauth2/default.html'
client = APIClient(app_key=APP_KEY, app_secret=APP_SECRET, redirect_uri=CALLBACK_URL)
with open('token.json', 'r') as f:
r = json.load(f)
a... | Heipiao/weibo | test1.py | Python | mit | 562 |
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns(
'popcorn_gallery.reports.views',
url(r'^$', 'report_form', name='report'),
)
| mozilla/popcorn_maker | popcorn_gallery/reports/urls.py | Python | bsd-3-clause | 168 |
'''
On mixed setups, flagall is already run. This defines the variables set
during that script so it doesn't need to be run multiple times.
BUT, if we're re-running the pipeline, the script will check for manual
flagging scripts saved in the appropriate project folder for the track.
'''
import os
import glob
import... | e-koch/VLA_Lband | 16B/pipeline4.7.1_custom/EVLA_pipe_fake_flagall.py | Python | mit | 2,655 |
# Copyright (c) 2014 - 2016 townhallpinball.org
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, p... | town-hall-pinball/project-omega | tests/lib/test_keyboard.py | Python | mit | 6,753 |
# -*- coding: utf-8 -*-
import csv
from cStringIO import StringIO
from datetime import datetime
import json
from django import test
from django.conf import settings
from django.core import mail
import mock
from nose.plugins.attrib import attr
from nose.tools import eq_
from piston.models import Consumer
from pyquery ... | jbalogh/zamboni | apps/zadmin/tests/test_views.py | Python | bsd-3-clause | 54,823 |
from setuptools import setup, Extension
setup(name='autoscalectl',
version='0.1',
author='Adam Flynn',
author_email='adam@contextlogic.com',
description="Tool to manage AWS AutoScale via a config file",
keywords="aws, infrastructure, autoscale",
license="MIT",
url="http://www.github.com/Con... | ContextLogic/awstools | autoscale/setup.py | Python | mit | 488 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of pandas-learn
# https://github.com/RichLewis42/pandas-learn
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT
# Copyright (c) 2015, Rich Lewis <rl403@cam.ac.uk>
"""
pdlearn.adaptor.regresssor
~~~~~~~~~~~~~~~~~~~~~~~~~~
M... | richlewis42/pandas-learn | pdlearn/adaptor/regressor.py | Python | mit | 714 |
import json
from enum import Enum
from modules.rpgdb import *
class SituationType(Enum):
WHERE_NOW = 0
WHAT_BROUGHT = 1
HOW_WORSE = 2
def init(conn):
c = conn.conn.cursor()
c.execute('''CREATE TABLE IF NOT EXISTS Facets
(facet_id INTEGER PRIMARY KEY,
expansion ... | xurxodiz/iria | iria/modules/inmf/db.py | Python | mit | 5,768 |
import asyncio
from functools import wraps
from nose.tools import nottest
from datetime import datetime
from datetime import timedelta
from unittest import SkipTest
from flaky import flaky
from acouchbase.cluster import (Cluster, get_event_loop,
close_event_loop)
from couchbase_tests.as... | couchbase/couchbase-python-client | acouchbase/tests/cases/collection_t.py | Python | apache-2.0 | 16,041 |
import array
@micropython.asm_thumb # test vldr, vstr
def arrayadd(r0):
vldr(s0, [r0, 0])
vldr(s1, [r0, 1])
vadd(s2, s0, s1)
vstr(s2, [r0, 2])
z = array.array("f", [2, 4, 10])
arrayadd(z)
print(z[2])
| jlillest/micropython | tests/inlineasm/asmfpldrstr.py | Python | mit | 223 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
import re
from datetime import datetime, timedelta
from operator ... | mic4ael/indico | indico/modules/events/management/forms.py | Python | mit | 21,229 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-09-07 03:22
from __future__ import unicode_literals
import ckeditor_uploader.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Creat... | light-white/meeting | news/migrations/0001_initial.py | Python | apache-2.0 | 995 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.