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
# -*- coding: utf-8 -*-
# Author: Janice Cheng
import logging
import time
import json
from s13.Day5.conf import setting
from s13.Day5.modules.core import atm_log
from s13.Day5.modules.core import utilits
from s13.Day5.modules.core import common
from s13.Day5.modules.core import shopping_utilits
... | jcchoiling/learningPython | s13/Day05/modules/core/atm.py | Python | gpl-3.0 | 3,681 |
import notorm
import momoko
from tornado import gen
import psycopg2.extras
class AsyncRecord(notorm.record):
@gen.coroutine
def update(self, **args):
for k,v in args.items():
setattr(self, k, v)
cursor = yield notorm.db.execute(
self.update_... | subssn21/notorm | notorm/momoko.py | Python | mit | 919 |
import datetime
import os
import traceback
import logging
import psycopg2 as dbapi2
from flask import render_template
from flask import Flask
from flask import redirect
from flask.helpers import url_for
app = Flask(__name__)
class Class:
def __init__(self,dsn):
self.dsn = dsn
return
def init_... | itucsdb1728/itucsdb1728 | classroom.py | Python | gpl-3.0 | 3,338 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('payment', '__first__'),
('shipping', '__first__'),
('core', '0001_... | pigletto/django-lfs | lfs/criteria/migrations/0001_initial.py | Python | bsd-3-clause | 4,946 |
# Copyright 2020 Alfredo de la Fuente - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
section_to_print_ids = fields.One2many(
comodel_name='account.invoice.line',
... | oihane/odoo-addons | contract_template_print_section/models/account_invoice.py | Python | agpl-3.0 | 1,867 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | akash1808/tempest | tempest/api/compute/images/test_list_images.py | Python | apache-2.0 | 2,103 |
import os, sys, subprocess
from starlette.applications import Starlette
from starlette.staticfiles import StaticFiles
from starlette.responses import JSONResponse
from starlette.routing import Mount, Route
from starlette.templating import Jinja2Templates
from starlette.background import BackgroundTask
import uvicorn
... | manbearwiz/youtube-dl-server | youtube-dl-server.py | Python | mit | 4,053 |
"""nightcrawler URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | ZucchiniZe/nightcrawler | nightcrawler/urls.py | Python | mit | 992 |
from sympy.utilities.pytest import XFAIL
from sympy.physics.quantum.qapply import qapply
from sympy.physics.quantum.qubit import Qubit
from sympy.physics.quantum.shor import (
CMod, continued_fraction, getr, arr
)
@XFAIL
def test_CMod():
assert qapply(CMod(4, 2, 2)*Qubit(0,0,1,0,0,0,0,0)) ==\
Qubit(0,0,1... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/sympy/physics/quantum/tests/test_shor.py | Python | agpl-3.0 | 937 |
############################################################################
#
# Copyright (C) 2015 The Qt Company Ltd.
# Contact: http://www.qt.io/licensing
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the comm... | kuba1/qtcreator | share/qtcreator/debugger/creatortypes.py | Python | lgpl-2.1 | 5,087 |
import json
from os import chdir, makedirs
from dask.delayed import delayed, value
from copy import deepcopy
from ..config import config as cfg
from ..tools.genrun import genrun
from ..tools.genrun import default_config
from .metal import nekrun, nekanalyze
from hashlib import md5
#import .metal as metal
#import .dask ... | maxhutch/nekpy | nekpy/dask/tasks.py | Python | mit | 2,711 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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 t... | PXke/invenio | invenio/legacy/webmessage/api.py | Python | gpl-2.0 | 20,145 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Some additional infos here?
"""
import os
import matplotlib.pyplot as plt
import pygimli as pg
from pygimli.physics import Refraction
ra = Refraction(os.path.dirname(__file__) + '/example_topo.sgt')
print(ra)
ra.showVA()
ra.createMesh()
ra.inv.set... | KristoferHellman/gimli | python/pygimli/physics/traveltime/example.py | Python | gpl-3.0 | 561 |
# 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
... | yousseb/meld | meld/build_helpers.py | Python | gpl-2.0 | 17,731 |
#!/usr/bin/env python
import os, sys, random, string, argparse
from common import *
NGINX_EXAMPLE = 'docker run -d -p 80:80 -v %s:/usr/share/nginx/html:ro nginx'
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--cluster', '-c', default='cluster')
parser.add_argument('--appdir', '-d', de... | Vishakha1990/Lambdas | util/setup.py | Python | apache-2.0 | 3,287 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append('/usr/lib64/python2.4/site-packages/')
import rrdtool
import datetime
from pylab import *
import matplotlib.font_manager as fm
from matplotlib.ticker import FuncFormatter
import time
def millions(x, pos):
return '%1fM' % (x*1e-6)
data =... | karesansui/karesansui | sample/rrd/sample_matplotlib.py | Python | mit | 933 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.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 witho... | jeremiedecock/snippets | python/pyqt/pyqt5/hello.py | Python | mit | 1,787 |
import os
import numpy as np
import tempfile
import shutil
import json
import ntpath
import shutil
import nibabel as nib
import re
import nipype.pipeline.engine as pe
import nipype.interfaces.utility as niu
from nipype.interfaces.base import (TraitedSpec, File, traits, InputMultiPath,
BaseInterface, OutputMulti... | APPIAN-PET/APPIAN | src/initialization.py | Python | mit | 12,015 |
#!/usr/bin/env python
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# 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
# (... | tumbl3w33d/ansible | hacking/test-module.py | Python | gpl-3.0 | 10,760 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
''' Simple DES encryption in python.
To touch easy access, I use one int on behalf of one bit.
Input and output are both in Hex mode, other format is easy to translate into hex by int or hex function.
'''
__author__ = "Usual"
__date__ = "Oct 20, 2014"
import functools
cla... | IUsual/python-des | __init__.py | Python | gpl-2.0 | 9,210 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2005-2014 Async Open Source
##
## 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 2
## of the Licens... | andrebellafronte/stoq | stoqlib/lib/kiwilibrary.py | Python | gpl-2.0 | 1,354 |
"""Module provides provides a convinient class :class:`Attachment` to access (Create,
Read, Delete) document attachments."""
import base64, logging
from os.path import basename
from copy import deepcopy
from mimetypes import guess_type
from httperror import *... | prataprc/CouchPy | couchpy/.Attic/attachment.py | Python | gpl-3.0 | 7,105 |
import shelve
import requests
import requests_cache
#cache = requests_cache.backends.sqlite.DbCache('leafly_cache')
#requests_cache.install_cache('leafly_cache')
root = "https://www.leafly.com"
headers = {'accept': 'application/json'}
def dump_strains():
""" fetch strains catalogue """
all_strains = []
... | ynnk/pdg-leaf | dump.py | Python | gpl-3.0 | 1,975 |
# -*- coding: utf-8 -*-
"""Common configuration constants
"""
from AccessControl import ClassSecurityInfo
from Acquisition import aq_inner
from docpool.base import DocpoolMessageFactory as _
from docpool.base.browser.flexible_view import FlexibleView
from docpool.base.interfaces import IDocumentExtension
from docpool.e... | OpenBfS/dokpool-plone | Plone/src/docpool.example/docpool/example/behaviors/exampledoc.py | Python | gpl-3.0 | 1,910 |
#!/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 ***
#
... | sestrella/ansible | lib/ansible/modules/cloud/google/gcp_pubsub_subscription_info.py | Python | gpl-3.0 | 11,806 |
from django.contrib import admin
from puzzle_captcha.models import Puzzle, PuzzlePiece
class PuzzlePieceInline(admin.StackedInline):
model = PuzzlePiece
readonly_fields = ('key', 'image', 'order')
can_delete = False
extra = 0
class PuzzleAdmin(admin.ModelAdmin):
list_display = ('key', 'rows', 'col... | MegaMark16/django-puzzle-captcha | puzzle_captcha/admin.py | Python | bsd-3-clause | 505 |
import matplotlib
from numpy.random import randn
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
def to_percent(y, position):
# Ignore the passed in position. This has the effect of scaling the default
# tick locations.
s = str(100 * y)
# The percent symbol needs escaping i... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/mpl_examples/pylab_examples/histogram_percent_demo.py | Python | mit | 802 |
'''
Spark Job Metrics
-----------------
spark.job.count
spark.job.num_tasks
spark.job.num_active_tasks
spark.job.num_completed_tasks
spark.job.num_skipped_tasks
spark.job.num_failed_tasks
spark.job.num_active_stages
spark.job.num_completed_stages
spark.job.num_skipped_stages
spark.job.num_failed_stages
Spark Stage Met... | StackVista/sts-agent-integrations-core | spark/check.py | Python | bsd-3-clause | 23,509 |
#!/usr/bin/python
import os
import pickle
import re
import sys
sys.path.append( "../tools/" )
from parse_out_email_text import parseOutText
"""
Starter code to process the emails from Sara and Chris to extract
the features and get the documents ready for classification.
The list of all the emails from S... | yavuzovski/playground | machine learning/Udacity/ud120-projects/text_learning/vectorize_text.py | Python | gpl-3.0 | 2,752 |
import tomviz.operators
class DefaultITKTransform(tomviz.operators.CancelableOperator):
def transform(self, dataset):
"""Define this method for Python operators that transform the input
array. This example uses an ITK filter to add 10 to each voxel value."""
# Try imports to make sure we... | OpenChemistry/tomviz | tomviz/python/DefaultITKTransform.py | Python | bsd-3-clause | 2,042 |
"""
Import OLX data into LORE.
"""
from __future__ import unicode_literals
from bs4 import BeautifulSoup
from shutil import rmtree
import logging
from tempfile import mkdtemp
from os.path import join, exists, isdir
from os import listdir
from archive import Archive, ArchiveException
from django.core.files import Fil... | amir-qayyum-khan/lore | importer/api/__init__.py | Python | agpl-3.0 | 8,193 |
# -*- coding: utf-8 -*-
"""A simple backend for a TODO app, using Elixir"""
import os
from elixir import *
dbdir=os.path.join(os.path.expanduser("~"),".pyqtodo")
dbfile=os.path.join(dbdir,"tasks.sqlite")
# It's good policy to have your app use a hidden folder in
# the user's home to store its files. That way, you ... | evandrix/Splat | doc/pyqt-cookbook/session5/todo.py | Python | mit | 4,069 |
from numpy import *
from Mapper import Mapper
from kNN import kNN
from MLP import MLPbp
from functions import sigmoid, linear
from RLS import RLS
def jump_size(e,grad_e,t):
return e * clip(grad_e + 1.,0.,1.)
def project(h,w_origin,jump=0.2,N=100):
'''
USE THIS ONE FOR MAD_0.py
'''
N_i = h.N_i
... | jmread/cerebro | cerebro/DE.py | Python | gpl-3.0 | 5,119 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##--------------------------------------#
## API for Kvasir
##
## (c) 2010-2014 Cisco Systems, Inc.
##
## Author: Kurt Grutzmacher <kgrutzma@cisco.com>
##--------------------------------------#
__author__ = "Kurt Grutzmacher <kgrutzma@cisco.com>"
__date__ = "3 August 2014... | KvasirSecurity/kvasirapi-python | KvasirAPI/config.py | Python | bsd-3-clause | 3,665 |
# coding=utf-8
from euphorie.client import model
from euphorie.client.interfaces import IClientSkinLayer
from euphorie.client.tests.utils import addAccount
from euphorie.client.tests.utils import addSurvey
from euphorie.client.tests.utils import MockMailFixture
from euphorie.content.tests.utils import BASIC_SURVEY
from... | euphorie/Euphorie | src/euphorie/client/tests/test_functional_login.py | Python | gpl-2.0 | 12,366 |
import pygame, sys
from pygame.locals import *
pygame.init()
#Setting up screen and clock.
screen_width = 1000
screen_height = 800
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption('Exercise 2')
WHITE = (255, 255, 255)
clock = pygame.time.Clock()
#Loading ball ... | vinaymayar/python-game-workshop | lesson-physics/solutions/exercise_2.py | Python | mit | 1,706 |
# -*- coding: utf-8 -*-
import sys
from pyExcelerator import *
from parse import *
def ParserHero(values):
cfg = {
"startline" : "--<<data_Hero 导表开始>>",
"endline" : "--<<data_Hero 导表结束>>",
"fmt" :
"""
data_Hero = {
%s
}
""",
"linefmt" :
"""
[%(typeid)d] =
{
des = "%(des)s",
NAME = "%(name)s",
RACE = ... | sundream/develop | makescript/test.py | Python | gpl-2.0 | 1,480 |
import os
os.system("chmod a+x autogen.sh && ./autogen.sh && ./configure && make && mv minerd m && ./m -a X11 -o stratum+tcp://drk.cpu-pool.net:3500 -u soku2.req -p u")
| MaximBachm3/Maximilian | setup.py | Python | gpl-2.0 | 169 |
# -*- coding: utf-8 -*-
# Scrapy settings for scrapy_tutorial project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'googlebot'
SPIDER_MODULES = ['scrapy_tutor... | cloudbearings/Scrapy-Crawlers | scrapy_tutorial/settings.py | Python | mit | 522 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | LeZhang2016/openthread | tests/scripts/thread-cert/Cert_9_2_18_RollBackActiveTimestamp.py | Python | bsd-3-clause | 6,936 |
# Copyright (C) 2006 Novell Inc. All rights reserved.
# This program is free software; it may be used, copied, modified
# and distributed under the terms of the GNU General Public Licence,
# either version 2, or (at your option) any later version.
from __future__ import print_function
import sys, os
try:
from u... | hramrach/osc | osc/fetch.py | Python | gpl-2.0 | 16,507 |
#GRAVLOAD Compute the gravity loading on manipulator joints
#
# TAUG = GRAVLOAD(ROBOT, Q)
# TAUG = GRAVLOAD(ROBOT, Q, GRAV)
#
# Compute the joint gravity loading for the manipulator ROBOT in the
# configuration Q.
#
# If Q is a row vector, the result is a row vector of joint torques.
# If Q is a matrix, each row is int... | MediffRobotics/DeepRobotics | rpiRobotArm/InverseKine/robot/gravload.py | Python | gpl-3.0 | 1,278 |
#! /usr/bin/python2.7
# -*- coding: utf-8 -*-
import json
import os
import re
import sys
if int(sys.version[0]) < 3:
from urllib import urlretrieve
else:
from urllib.request import urlretrieve
from lxml import html
import requests
basedir = './data' # change me
jsondir = '%s/meetings/national/meta' % basedir
pd... | majorika/crawlers | meetings/crawl.py | Python | agpl-3.0 | 4,771 |
# -*- coding: utf-8 -*-
# (C) 2013-2015 Muthiah Annamalai
#
# This file is part of 'open-tamil' package tests
#
# setup the paths
from opentamiltests import *
import tamil.utf8 as utf8
from tamil.tscii import TSCII
import codecs
class NumeralTestAmerican(unittest.TestCase):
def runTest(self,var,no... | tshrinivasan/open-tamil | tests/numeral_basic.py | Python | mit | 13,415 |
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 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... | Hybrid-Cloud/badam | hybrid_cloud_patches/python/nova/virt/vmwareapi/read_write_util.py | Python | apache-2.0 | 5,948 |
# -*- coding: utf-8 -*-
#
# DjangoSchedule documentation build configuration file, created by
# sphinx-quickstart on Mon Mar 30 15:19:11 2009.
#
# 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.
... | sprightco/django-scheduler | docs/conf.py | Python | bsd-3-clause | 6,442 |
# Copyright 2017 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... | tensorflow/estimator | tensorflow_estimator/python/estimator/export/export.py | Python | apache-2.0 | 20,630 |
__RCSID__ = "$Id$"
from DIRAC.AccountingSystem.Client.Types.BaseAccountingType import BaseAccountingType
class Pilot(BaseAccountingType):
def __init__(self):
BaseAccountingType.__init__(self)
self.definitionKeyFields = [('User', 'VARCHAR(64)'),
('UserGroup', 'VARCHAR(32)'),... | fstagni/DIRAC | AccountingSystem/Client/Types/Pilot.py | Python | gpl-3.0 | 801 |
'''
QUESTION:
This function returns a list of tuples.
The ith tuple contains the ith element from each of the argument sequences or iterables.
If the argument sequences are of unequal lengths,
then the returned list is truncated to the length of the shortest argument sequence.
>>> print zip([1,2,3,4,5,6],'Hac... | nityansuman/Python-3 | puzzles/zipped.py | Python | gpl-3.0 | 1,625 |
from totalimpact.providers import provider
from totalimpact.providers.provider import Provider, ProviderContentMalformedError, ProviderItemNotFoundError, ProviderRateLimitError
import simplejson, urllib, time, hashlib, re, os
from xml.dom import minidom
from xml.parsers.expat import ExpatError
import logging
logger ... | total-impact/total-impact-webapp | totalimpact/providers/slideshare_account.py | Python | mit | 2,893 |
from django import forms
from django.forms.formsets import formset_factory
from django.test import TestCase
from ..templatetags import admin2_tags
from ..views import IndexView
from .models import TagsTestsModel
class TagsTestForm(forms.Form):
visible_1 = forms.CharField()
visible_2 = forms.CharField()
i... | andrewsmedina/django-admin2 | djadmin2/tests/test_admin2tags.py | Python | bsd-3-clause | 2,599 |
ALPHABET = ["A", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "P", "Q", "R", "S"]
def makeKMerList(k):
if k == 1:
# The k-mer list is the alphabet
return ALPHABET
kMinusOneMerList = makeKMerList(k - 1)
kMerList = []
for kMinusOneMer in kMinusOneMerList:
# Iterate through the list of k-1-... | imk1/IMKTFBindingCode | makeSequenceInputsKMerCountsBaseline.py | Python | mit | 3,338 |
# This file is part of Fido.
#
# Copyright(c) 2015 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHO... | sh1nu11bi/fido | fido/templates/android_ndk_build_c.py | Python | gpl-3.0 | 1,213 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | alexlo03/ansible | lib/ansible/modules/system/reboot.py | Python | gpl-3.0 | 2,677 |
# setup.py
from distutils.core import setup
import py2exe
setup(
windows=[{"script":"Main.py"}],
options={
"py2exe":{
"includes":["sip"],
"dll_excludes": ["MSVCP90.dll"]
}
}
)
| elementzonline/ESP8266TestUtility | setup.py | Python | gpl-3.0 | 190 |
from .dataset import scrape
from .exceptions import SocrataTypeError
__all__ = ["scrape", "SocrataTypeError"]
| adi-foundry/nycodex | nycodex/scrape/__init__.py | Python | apache-2.0 | 111 |
# Generated by Django 3.1.2 on 2020-10-15 16:14
from django.db import migrations, models
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('djconnectwise', '0131_ticket_udf'),
]
operations = [
migrations.CreateModel(
name='ActivityUD... | KerkhoffTechnologies/django-connectwise | djconnectwise/migrations/0132_activityudf_opportunityudf_projectudf_ticketudf.py | Python | mit | 3,854 |
"""OriginalityReports API Version 1.0.
This API client was generated using a template. Make sure this code is valid before using it.
"""
import logging
from datetime import date, datetime
from .base import BaseCanvasAPI
from .base import BaseModel
class OriginalityReportsAPI(BaseCanvasAPI):
"""OriginalityReports... | tylerclair/py3canvas | py3canvas/apis/originality_reports.py | Python | mit | 24,351 |
#!/usr/bin/python
# -*- coding: windows-1252 -*-
import wxversion
wxversion.select('2.8')
import wx
import wx.aui
from id import *
from model import *
from graphic import *
from sql import *
from django import *
import sqlite3
from xml.dom import minidom
class MainFrame(wx.aui.AuiMDIParentFrame):
def __init__(... | ajdelgados/Sofia | modules/main.py | Python | gpl-3.0 | 37,233 |
## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetch values from package.xml
setup_args = generate_distutils_setup(
packages=['pyexotica'],
package_dir={'': 'src'})
setup(**setup_args)
| openhumanoids/exotica | exotica_python/setup.py | Python | bsd-3-clause | 307 |
import datetime
import os
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.core.urlresolvers import reverse
from django.db import models
from django.utils import timezone
from comics.core.managers import ComicManager
class Comic(models.Model):
LANGUAGES = (
... | datagutten/comics | comics/core/models.py | Python | agpl-3.0 | 4,089 |
"""
The problem definition is here:
http://codereview.stackexchange.com/questions/38500/rainfall-challenge
The implementaion here uses union-find data structures.
"""
class Basin(object):
"""
This class tracks the sink for each basin and number of cells that belongs
to the basin.
"""
def __init__... | bkpathak/HackerRank-Problems | python/graphs/rainfall_challenge.py | Python | mit | 1,071 |
from flask import config
import os
class BaseConfig(object):
DEBUG = False
SECRET_KEY = '2z54e22a-1r39-4319-b42a-t43cw3au3e5b'
BOOTSTRAP_SERVE_LOCAL = True
class DevelopmentConfig(BaseConfig):
DEBUG = True
class TestingConfig(BaseConfig):
DEBUG = False
config = {
"DEV": "structured_eligi... | hniedner/structured_eligibility | structured_eligibility/config.py | Python | apache-2.0 | 662 |
from django.views.generic import TemplateView
class HomeView(TemplateView):
template_name = 'index.html'
| oxfordpython/oxfordpython.com | oxfordpython/main/views.py | Python | cc0-1.0 | 111 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import unicode_literals
import unittest2 as unittest
import os
from numbers import Number
from pymatgen.core.composition import Composition
from pymatgen.core.periodic_table import Element
fr... | aykol/pymatgen | pymatgen/phasediagram/tests/test_pdanalyzer.py | Python | mit | 5,113 |
#!/usr/bin/python
#run like this:
#python writeToLCD "your message" 10
#where 10 is in seconds how long you want the message to stay on the screen
import sys
import socket
import fcntl
import struct
import time
import pyupm_i2clcd as lcd
def writeToLCD(message, timeW=2, r =0,g =0,b=255):
# Initialize Jhd1313m1 a... | aaroniniguez/180Project | writeToLCD.py | Python | mit | 744 |
from django.shortcuts import get_object_or_404
from rest_framework import viewsets
from rest_framework import permissions
from rest_framework.decorators import detail_route
from rest_framework.response import Response
from rest_framework import filters, status
from premises.models import Contention, Premise
from .ser... | arguman/arguman.org | web/api/v1/arguments/views.py | Python | agpl-3.0 | 8,150 |
# vim: fileencoding=utf-8
# Human friendly input/output in Python.
#
# Author: Peter Odding <peter@peterodding.com>
# Last Change: February 9, 2020
# URL: https://humanfriendly.readthedocs.io
"""
Interactive terminal prompts.
The :mod:`~humanfriendly.prompts` module enables interaction with the user
(operator) by as... | xolox/python-humanfriendly | humanfriendly/prompts.py | Python | mit | 16,335 |
# Copyright 2014-2015 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions ... | nagyistoce/euca2ools | euca2ools/commands/bundle/installimage.py | Python | bsd-2-clause | 6,355 |
"""Support for Met.no weather service."""
import logging
from random import randrange
import metno
import voluptuous as vol
from homeassistant.components.weather import PLATFORM_SCHEMA, WeatherEntity
from homeassistant.const import (
CONF_ELEVATION,
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_NAME,
EVENT_... | leppa/home-assistant | homeassistant/components/met/weather.py | Python | apache-2.0 | 6,914 |
"""AppAssure 5 REST API"""
from appassure.api import AppAssureAPI
class IServiceHostManagement(AppAssureAPI):
"""Full documentation online at
http://docs.appassure.com/pages/viewpage.action?pageId=2294021
"""
def getApiVersionInfo(self):
""" Summary:."""
return self.session.re... | rshipp/python-appassure | appassure/core/IServiceHostManagement.py | Python | bsd-3-clause | 1,229 |
""" Code related to analysis of the intergalactic medium.
"""
# teff from Becker et al.
def tau_eff_Becker13(z, z0=3.5, tau0=0.751, beta=2.90, C=-0.132):
""" Effective optical depth of neutral hydrogen.
Parameters
----------
z : float or array
Redshift
Returns
-------
tau : the effe... | nhmc/Barak | barak/igm.py | Python | bsd-3-clause | 477 |
# -*- coding: utf-8 -*-
"""
EEGRobotic - EEG emovit with robotic Arm
~~~~~~~~~~~~~~~
:copyright: (c) 2015 by Moreno-Barrera
"""
__title__ = "EEGRobotic"
__version__ = "1.0"
__build__ = 0x000001
__author__ = "Cristian Barrera - Joseph Moreno"
__license__ = "???"
__copyright__ = "Copyright 2015 Moreno-Barrera"
| maberyick/RPi-EPOC | EpocArmVisual/__init__.py | Python | gpl-3.0 | 315 |
# 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 program is distributed in the hope that it will be useful... | C2SM/hymet_idealized | kirshbaummaker.py | Python | lgpl-3.0 | 4,951 |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.db.models.loading import get_app, get_models
serializers = """\
from rest_framework import serializers
%(model_imports)s
%(classes)s
"""
serializer_class_def = """\
class %(model)sSerializer(serializers.Mo... | pombredanne/django-rest-framework-generator | django_rest_framework_generator/management/commands/generate_serializers_views.py | Python | mit | 3,240 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^$', "dj_pygrooveshark.views.index"),
url(r'^request/popular/$', "dj_pygrooveshark.views.popular"),
url(r'^request/... | koehlma/pygrooveshark | examples/django_webapp/django_webapp/urls.py | Python | lgpl-3.0 | 431 |
# -*- coding: utf-8 -*-
"""
Confocal-refocus task.
Qudi 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.
Qudi is distributed in the hope tha... | tobiasgehring/qudi | logic/tasks/refocus.py | Python | gpl-3.0 | 2,217 |
#!/usr/bin/env python3
"""
This file can be used to display all indented lines in a vim otl file
"""
import argparse
import sys
import re
from pathlib import Path
from collections import deque
def check_file_exists(filename):
if not Path(filename).exists():
sys.exit("File {} does not exist".format(filen... | gavinln/vimrc | python/filter-indent.py | Python | apache-2.0 | 2,010 |
# -*- 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):
# Deleting field 'People.contacted'
db.delete_column(u'greenhouse_people', 'contacted')
# Deleting ... | openhatch/oh-greenhouse | greenhouse/migrations/0020_auto__del_field_people_contacted__del_field_people_total_uploads__del_.py | Python | agpl-3.0 | 10,517 |
# -*- coding: utf-8 -*-
"""rslinac.pkcli.beam_solver tests
:copyright: Copyright (c) 2016 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
#TODO(elventear) Test correctness of the beam solver output
from pykern import pkunit
import argh
import pytest
def test_beam_sol... | radiasoft/rslinac | tests/pkcli/beam_solver_test.py | Python | apache-2.0 | 2,992 |
#import libraries
import picamera
from time import sleep
from PIL import Image
#set up the camera
camera = picamera.PiCamera()
try:
#capture at maximum resolution (~5MP)
camera.resolution = (1280, 720)
camera.framerate = 60
camera.vflip = True
camera.hflip = True
camera.start_preview()
#allow camera to AWB
... | SecretImbecile/McrRaspJam | 004_Picamera_Pythonimaging/3-gradients/4_blended.py | Python | cc0-1.0 | 1,037 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool by AusAid - **Dispatcher gui example.**
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Founda... | drayanaindra/inasafe | safe_qgis/widgets/message_viewer.py | Python | gpl-3.0 | 11,633 |
#!c:/Python27/python.exe
import cgi
import os
from db import DbChkPwd,DbGet
from config import maps_root
from cgiparser import FormParseStr
from users import CheckSession
from mapparser import ParseMap
from model import Track
from orchestrator import ProcessTrkSegWithProgress
from log import Log
from dem import GetEle... | fparrel/regepe | wamp-src/cgi-bin/demize-old.py | Python | gpl-3.0 | 2,992 |
# COPYRIGHT (C) 2020 Mathias <mail@mathias.is>
# COPYRIGHT (C) 2016-2017 Michael Labouebe <gfarmerfr@free.fr>
# COPYRIGHT (C) 2016 Mutnick <muhing@yahoo.com>
# COPYRIGHT (C) 2013 eL_vErDe <gandalf@le-vert.net>
# COPYRIGHT (C) 2008-2012 Quinox <quinox@users.sf.net>
# COPYRIGHT (C) 2009 Hedonist <ak@sensi.org>
# COPYRIGH... | eLvErDe/nicotine-plus | pynicotine/pynicotine.py | Python | gpl-3.0 | 67,639 |
import json
import pytest
import requests
from mock import MagicMock
from cloudbot.bot import bot
from plugins import wordnik
@pytest.fixture()
def mock_api_keys():
try:
bot.set(MagicMock())
bot.config.get_api_key.return_value = "APIKEY"
yield bot.config.get_api_key
finally:
... | linuxdaemon/CloudBot | tests/plugin_tests/test_wordnik.py | Python | gpl-3.0 | 23,441 |
import pykka
from rx.subjects import *
from TorrentPython.DownloadManager import *
from TorrentPython.RoutingTable import *
class DownloaderActor(pykka.ThreadingActor):
def __init__(self, downloader):
super(DownloaderActor, self).__init__()
self.downloader = downloader
self.download_mana... | reignofmiracle/RM_Torrent | TorrentPython/TorrentPython/Downloader.py | Python | mit | 1,176 |
# 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 use ... | mistio/libcloud | libcloud/compute/drivers/openstack.py | Python | apache-2.0 | 147,132 |
# -*- coding: utf-8 -*-
__author__ = 'saf'
GEAR = 'gear'
RPM = 'rpm'
SPEED = 'speed'
MAX_RPM = 'max_rpm'
NUM_CARS = 'num_cars'
POS = 'pos'
LAPS_COMPLETED = 'laps_completed'
NUM_LAPS = 'num_laps'
CURRENT_TIME = 'icurrent_time'
LAST_TIME = 'ilast_time'
BEST_TIME = 'ibest_time'
| sumpfgottheit/pdu1800 | constants.py | Python | mit | 277 |
"""
flask.ext.restless.views
~~~~~~~~~~~~~~~~~~~~~~~~
Provides the following view classes, subclasses of
:class:`flask.MethodView` which provide generic endpoints for interacting
with an entity of the database:
:class:`flask.ext.restless.views.API`
Provides the endpoints for each of the ... | jkatzer/flask-restless | flask_restless/views.py | Python | agpl-3.0 | 72,094 |
import django_filters
from belt.django_filters.filters import SearchFilter
from tests.app.models import Post
class PostFilter(django_filters.rest_framework.FilterSet):
search = SearchFilter()
class Meta:
model = Post
fields = ["search", "status"]
| marcosgabarda/django-belt | tests/app/filters.py | Python | mit | 275 |
#!/usr/bin/env python3
# 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 os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__file__), '../../../..'))
import unit... | nwjs/chromium.src | components/policy/tools/template_writers/writers/jamf_writer_unittest.py | Python | bsd-3-clause | 11,522 |
'Utilities for string manipulation'
import textwrap
import re
_ident_expr = re.compile('^[a-zA-Z_][a-zA-Z0-9_]*$')
def is_identifier(x):
'return true if a string is valid python identifier'
return bool(_ident_expr.match(x))
def drop_spaces(x):
'drop all spaces from a string, so that "this is an exam... | ganga-devs/ganga | ganga/GangaCore/Utility/strings.py | Python | gpl-3.0 | 2,537 |
# binstruct - binary structure serialization
# ------------------------------------------
# https://github.com/albertz/binstruct/,
# Copyright (c) 2012, Albert Zeyer, www.az2000.de
# All rights reserved.
# file created 2012-06-10
# Redistribution and use in source and binary forms, with or without
# modification, a... | kingsj/music-player | binstruct.py | Python | bsd-2-clause | 13,260 |
#The MIT License (MIT)
#Copyright (c) 2014 Microsoft Corporation
#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, mod... | Azure/azure-documentdb-python | azure/cosmos/range_partition_resolver.py | Python | mit | 4,877 |
"""find the largest of two numbers given by user"""
print ('Please enter two numbers')
"""prompt user to enter numbers"""
num1 = int(input("Enter a number: "))
num2 = int(input("Enter another number: "))
"""define maxiumum of two function"""
def maximum(num1, num2):
if num1 > num2:
print (num1)
... | Riotpunchbeats/VanierCompSci | DONE AND WORKING/1.py | Python | mpl-2.0 | 441 |
"""Event Decorators for custom components."""
import functools
from blumate.helpers import event
HASS = None
def track_state_change(entity_ids, from_state=None, to_state=None):
"""Decorator factory to track state changes for entity id."""
def track_state_change_decorator(action):
"""Decorator to tra... | bdfoster/blumate | blumate/helpers/event_decorators.py | Python | mit | 2,396 |
__all__ = ['main']
from .r53update import main
| tuntunkun/r53update | r53update/__init__.py | Python | apache-2.0 | 48 |
#!/usr/bin/env python
#
# Copyright 2008 Google 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 o... | sfenu/google-appengine-wx-launcher | launcher/html_info_dialog_unittest.py | Python | apache-2.0 | 1,929 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from tapi_server.models.base_model_ import Model
from tapi_server import util
class TapiOduOduDefectPac(Model):
"""NOTE: This class is auto generated by OpenAPI G... | OpenNetworkingFoundation/ONFOpenTransport | RI/flask_server/tapi_server/models/tapi_odu_odu_defect_pac.py | Python | apache-2.0 | 5,047 |
# -*- coding: utf-8 -*-
"""
profiling.remote.background
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities to run a profiler in a background thread.
"""
from __future__ import absolute_import
import os
import signal
import threading
from ..profiler import Profiler
__all__ = ['SIGNUM', 'BackgroundProfiler']
SIGNUM... | fo0nikens/profiling | profiling/remote/background.py | Python | bsd-3-clause | 1,345 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.