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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# quiz/quiz.py
from flask import Flask
from flask import render_template
app = Flask(__name__)
@app.route('/')
def index():
# return 'Cześć, tu Python!'
return render_template('index.html')
if __name__ == '__main__':
app.run(debug=True)
| koduj-z-klasa/python101 | docs/webflask/quiz/quiz3.py | Python | mit | 281 |
# Copyright (C) 2005 Colin McMillen <mcmillen@cs.cmu.edu>
#
# This file is part of GalaxyMage.
#
# GalaxyMage 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 opti... | jemofthewest/GalaxyMage | src/engine/Class.py | Python | gpl-2.0 | 3,831 |
from setuptools import setup, find_packages
setup(
name = "greatape",
version = "0.3.0",
url = 'http://github.com/threadsafelabs/greatape',
license = 'BSD',
description = "A MailChimp API client.",
author = 'Jonathan Lukens',
packages = find_packages('src'),
package_dir = {'': 'src'},
... | kmike/greatape | setup.py | Python | bsd-3-clause | 360 |
import unittest, datetime
from django.db import models
from shrubbery.db.tests.many_related_join import ManyRelatedJoinTest
from shrubbery.db.tests.reverse_fields import ReverseFieldTest
from shrubbery.db.tests.union import UnionTest
#from shrubbery.db.tests.q_utils import QUtilsTest
| emulbreh/shrubbery | shrubbery/db/tests/__init__.py | Python | mit | 286 |
# -*- coding: utf-8 -*-
"""
Testing module that triggers tests in the browser and then extracts
the results in text form.
Unfortunately we cannot rely on phantomjs for this, because of
https://github.com/ariya/phantomjs/issues/11195
that prevents us to use ajax requests appropriately.
"""
import time
import os
import... | simphony/tornado-webapi | jstests/selenium_testrunner.py | Python | bsd-3-clause | 3,948 |
# 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 u... | zhouyao1994/incubator-superset | superset/forms.py | Python | apache-2.0 | 1,556 |
names = [ "Dave", "Mark", "Ann", "Phil" ]
a = names[2]
names[0] = "Jeff"
names.append("Paula")
names.insert(2, "Thomas")
b = names[0:2]
c = names[2:]
d = [1, "Dave", 3.14, ["Mark", 7, 9, [100,101]], 10]
e = [2*s for s in d]
print e
print d[1]
print d[3][2]
print d[3][3][1]
print b
print names | wufengwhu/my_blog | exercise/list.py | Python | apache-2.0 | 294 |
__version__ = "0.9.6"
#------------------------------------------------------------------------------
# CHANGELOG:
# ... oldest changes
# 2014-07-07 v0.9.3 - Removed requirement of config.py variables (token, account)
# 2015-02-22 v0.9.4 - Supported changes from API
# 2015-02-22 v0.9.5-1+ - Supported changes from API
| horacioibrahim/iugu-python | lib/iugu/version.py | Python | apache-2.0 | 320 |
# Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
#
# MIT License (MIT)
#
# 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 lim... | gangadhar-kadam/mtn-wnframework | webnotes/utils/email_lib/receive.py | Python | mit | 5,712 |
from kombu.tests.utils import unittest
from kombu.transport.virtual import exchange
from kombu.tests.mocks import Channel
class ExchangeCase(unittest.TestCase):
type = None
def setUp(self):
if self.type:
self.e = self.type(Channel())
class test_Direct(ExchangeCase):
type = exchang... | pantheon-systems/kombu | kombu/tests/test_virtual_exchange.py | Python | bsd-3-clause | 3,747 |
# 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)
import logging
impor... | sameerparekh/pants | src/python/pants/build_graph/target.py | Python | apache-2.0 | 21,285 |
import reader
def pr_list(l):
tokens = map(pr_str, l)
return ' '.join(tokens)
def pr_str(ast, indent=0):
if (isinstance(ast, list)):
return '(' + pr_list(ast) + ')'
elif (isinstance(ast, reader.GenericMap)):
(open_token, close_token) = ast.separators
return open_token + pr_list... | jsharf/mal | python/printer.py | Python | mpl-2.0 | 885 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2004-2009 Edgewall Software
# Copyright (C) 2004-2005 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2006-2007 Christian Boos <cboos@edgewall.org>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part o... | pkdevbox/trac | trac/ticket/roadmap.py | Python | bsd-3-clause | 46,809 |
from collections.abc import Iterator
from io import BytesIO, StringIO
import pytest
from javaproperties import Properties, dumps
# Making the global INPUT object a StringIO would cause it be exhausted after
# the first test and thereafter appear to be empty. Thus, a new StringIO must
# be created for each test instea... | jwodder/javaproperties | test/test_propclass.py | Python | mit | 19,811 |
import time, logging, random, struct
import pyhash
from datasketch.hyperloglog import HyperLogLog
from datasketch.minhash import MinHash
logging.basicConfig(level=logging.INFO)
# Produce some bytes
int_bytes = lambda x : ("a-%d-%d" % (x, x)).encode('utf-8')
class Hash(object):
def __init__(self, h):
self... | ekzhu/datasketch | benchmark/sketches/cardinality_benchmark.py | Python | mit | 2,597 |
# This import fixes sys.path issues
from . import parentpath
from datawrap import tablewrap
import unittest
class TableWrapTest(unittest.TestCase):
'''
Tests the capability to wrap 2D objects in Tables and transpose them.
'''
def setUp(self):
# self.table doesn't need the tablewrap.Table objec... | OpenGov/python_data_wrap | tests/table_wrap_test.py | Python | lgpl-2.1 | 4,724 |
#!/usr/bin/env python
# coding=UTF-8
#
# Generated by pykdeuic4 from centralwidget.ui on Wed Mar 7 09:04:11 2012
#
# WARNING! All changes to this file will be lost.
from PyKDE4 import kdecore
from PyKDE4 import kdeui
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
... | keremispirli/autokey-py3 | src/lib/qtui/centralwidget.py | Python | gpl-3.0 | 4,377 |
#!/usr/bin/env python
# Copyright (c) 2016 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.
"""Tests for generate_token.py"""
import argparse
import generate_token
import unittest
# TODO(https://crbug.com/1274995): Use uni... | ric2b/Vivaldi-browser | chromium/tools/origin_trials/generate_token_unittest.py | Python | bsd-3-clause | 2,656 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/font-dec-misc/package.py | Python | lgpl-2.1 | 2,094 |
import draw
import numpy as np
csp = np.loadtxt('mah_csp')
toz = np.loadtxt('mah_toz')
hjo = np.loadtxt('mah_hjorth')
print csp, toz, hjo
filename = 'mahalanobis.png'
draw.mahalanobis(toz, hjo, csp, filename)
| karolaug/p300-csp | mahala_draw.py | Python | gpl-3.0 | 212 |
# -*- coding: utf-8 -*-
"""Music Library access."""
from __future__ import unicode_literals
import logging
from . import discovery
from .data_structures import (
SearchResult,
from_didl_string,
DidlResource,
DidlObject,
DidlMusicAlbum
)
from .exceptions import SoCoUPnPException
from .utils impor... | dundeemt/SoCo | soco/music_library.py | Python | mit | 21,591 |
#!/usr/bin/python
print " __ "
print " |__|____ ___ __ "
print " | \__ \\\\ \/ / "
print " | |/ __ \\\\ / "
print " /\__| (____ /\_/ "
print " \______| \/ "
p... | nomad-vino/SPSE-1 | Module 3/x3.1.py | Python | gpl-3.0 | 1,903 |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | joshuago78/autograder | project/project/settings.py | Python | mit | 3,130 |
#!/usr/bin/env python
"""
@package mi.dataset.parser.WFP_E_file_common
@file mi/dataset/parser/WFP_E_file_common
@author Emily Hahn, Mike Nicoletti, Maria Lutz
@brief A common parser for the E file type of the wire following profiler
"""
import re
from mi.core.log import get_logger
from mi.core.exception... | oceanobservatories/mi-instrument | mi/dataset/parser/WFP_E_file_common.py | Python | bsd-2-clause | 8,199 |
import telegram
from telegram.error import *
def NoAsciiCharName(bot,update):
gid = update.message.chat_id
new_members = update.message.new_chat_members
for user in new_members:
name = user.first_name
uid = user.id
try:
name.encode('ascii')
except UnicodeEncodeEr... | Nhoya/YATAB | modules/onjoin/notasciiname.py | Python | gpl-3.0 | 637 |
#!/usr/bin/env python
import sys
import random
import copy
import argparse
class City:
def __init__(self, name, x, y):
self.name = name
self.x = x
self.y = y
def __copy__(self):
return City(self.name,self.x,self.y)
def __eq__(self,other):
return self.name == other.... | stumped2/school | CS325/hw5/tsp1.py | Python | apache-2.0 | 4,284 |
import json
from getJsonData import getJSONData
import os
from datetime import date, datetime
import numpy as np
import stock
import matplotlib.pyplot as plt
dataPath = 'data/SZ#002637.txt'
fileName, fileExtension = os.path.splitext(os.path.basename(dataPath))
jsonPath = os.path.join('data', '{0}.json'.format(fileNa... | m860/data-analysis-with-python | practises/macd.py | Python | mit | 635 |
"""
Django settings for ACM_General project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
# sta... | sigdotcom/acm.mst.edu | ACM_General/ACM_General/settings.py | Python | gpl-3.0 | 5,083 |
__author__ = 'kat4ma'
from helper import *
def greet_person(person):
greeting("Hello, " + person + '!')
greet_person("Kyle") | karttrak/cs3240-labdemo | develop.py | Python | mit | 130 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import collections
import os.path
class Plumed(AutotoolsPackage):
"""PLUMED is an open source library for free energ... | iulian787/spack | var/spack/repos/builtin/packages/plumed/package.py | Python | lgpl-2.1 | 8,042 |
from sklearn.datasets import load_iris
import matplotlib.pyplot as plt
import pandas as pd
# Cargar conjunto de datos.
dataset = load_iris()
# Transformar a pandas dataframe para ver un resumen de los datos.
data = pd.DataFrame(dataset.data, columns=dataset.feature_names)
data['target'] = dataset['target']
# Anali... | roxana-lafuente/CursoAA | clase1_solucion.py | Python | gpl-3.0 | 820 |
#
# ParameterWeaver: a code generator to handle command line parameters
# and configuration files for C/C++/Fortran/R/Octave
# Copyright (C) 2013 Geert Jan Bex <geertjan.bex@uhasselt.be>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | gjbex/parameter-weaver | src/vsc/parameter_weaver/c/formatter.py | Python | gpl-3.0 | 11,489 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 20 16:16:26 2017
@author: jdstokes
"""
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets, linear_model
from sklearn.metrics import mean_squared_error
def mse1(targets,predictions):
m = len(targe... | jdstokes/nsc211 | src/deeplearning.py | Python | mit | 1,648 |
"""!wiki <topic> returns a wiki link for <topic>"""
import re
from mattermost_bot.bot import listen_to
from mattermost_bot.bot import respond_to
try:
from urllib import quote
except ImportError:
from urllib.request import quote
import requests
from bs4 import BeautifulSoup
@respond_to('wiki (.*)')
def wiki(... | csik/mattermost_bot_plugins | wiki.py | Python | agpl-3.0 | 1,291 |
#!/usr/bin/env python3
#!/usr/local/bin/python3.7
#!/usr/bin/env python3
#!/usr/bin/python3
for i1 in range(256):
str2 = "%s %d 0x%x '%c'" % (str(i1), i1, i1, i1)
print(("str2 = %s" % str2))
#for i1 in range(32, 127):
# c1 = chr(i1)
# print "%d %s" % (i1, c1)
| jtraver/dev | python3/char/chr2.py | Python | mit | 280 |
from __future__ import print_function
import os, sys
from pdb import set_trace
from Bio import SeqIO
"""
How to run:
python scripts/mumps.csv-and-fasta-to-vipr-fasta.py INPUT_FASTA INPUT_CSV OUTPUT_FASTA
Inputs:
(1) FASTA file with sequences
(2) CSV file with fields (no header, comment lines starting with #)
1.... | blab/nextstrain-db | scripts/mumps.csv-and-fasta-to-vipr-fasta.py | Python | agpl-3.0 | 1,876 |
"""Even Length Grid Partitioner"""
import numpy as np
import math
import random as rnd
import functools, operator
from pyFTS.common import FuzzySet, Membership
from pyFTS.partitioners import partitioner
class SingletonPartitioner(partitioner.Partitioner):
"""Singleton Partitioner"""
def __init__(self, **kwa... | petroniocandido/pyFTS | pyFTS/partitioners/Singleton.py | Python | gpl-3.0 | 786 |
"""Generate mypy config."""
from __future__ import annotations
import configparser
import io
import os
from pathlib import Path
from typing import Final
from homeassistant.const import REQUIRED_PYTHON_VER
from .model import Config, Integration
# Modules which have type hints which known to be broken.
# If you are a... | mezz64/home-assistant | script/hassfest/mypy_config.py | Python | apache-2.0 | 10,884 |
# -*- coding: latin-1 -*-
#/* SERIAL COMMANDER
#* A simple serial interface to send commands
#*
#* Copyright 2013, Carlos Gonzalez Cortes, carlgonz@ug.uchile.cl
#*
#* This program is free software: you can redistribute it and/or modify
#* it under the terms of the GNU Gener... | carlgonz/SerialCommander | SerialCommander.py | Python | gpl-3.0 | 13,272 |
import logging
import yaml
import datetime
from funcy import compact, project
from redash.utils.requests_session import requests_or_advocate, UnacceptableAddressException
from redash.utils import json_dumps
from redash.query_runner import (
BaseHTTPQueryRunner,
register,
TYPE_BOOLEAN,
TYPE_DATETIME,
... | getredash/redash | redash/query_runner/json_ds.py | Python | bsd-2-clause | 5,438 |
"""
Copyright 2017 BlazeMeter 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, software... | Blazemeter/taurus | bzt/soapui2yaml.py | Python | apache-2.0 | 4,115 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import pytest
import tempfile
import torch
import torch.distributed as dist
from ray import tune
from ray.tests.conftest import ray_start_2_cpus # noqa: F401
from ray.experimental.sgd.pytorch import... | ujvl/ray-ng | python/ray/experimental/sgd/tests/test_pytorch.py | Python | apache-2.0 | 3,175 |
import doctest
import unittest2
DOCTEST_FLAGS = (
doctest.ELLIPSIS |
doctest.NORMALIZE_WHITESPACE |
doctest.REPORT_NDIFF
)
class TestSonata(unittest2.TestCase):
def test_dummy(self):
# TODO: replace with a test which does something once we start to have
# tests!
pass
def ad... | onto/sonata | sonata/tests/__init__.py | Python | gpl-3.0 | 508 |
from datetime import timedelta
from furl import furl
from django.conf import settings
from share.harvest.base import BaseHarvester
class BiomedCentralHarvester(BaseHarvester):
VERSION = 1
def __init__(self, app_config):
super().__init__(app_config)
self.offset = 1
self.page_size = ... | laurenbarker/SHARE | share/harvesters/com_biomedcentral.py | Python | apache-2.0 | 1,620 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser, Group
from django.contrib.sites.models import Site
from django.test.utils import override_settings
from cms.api import create_page
from cms.menu import get... | Venturi/oldcms | env/lib/python2.7/site-packages/cms/tests/menu_page_viewperm.py | Python | apache-2.0 | 23,828 |
#Copyright ReportLab Europe Ltd. 2000-2016
#see license.txt for license details
#history www.reportlab.co.uk/rl-cgi/viewcvs.cgi/rlextra/graphics/Csrc/renderPM/renderP.py
__version__='3.3.0'
__doc__="""Render drawing objects in common bitmap formats
Usage::
from reportlab.graphics import renderPM
renderPM.draw... | Ashaba/rms | rmslocalenv/lib/python2.7/site-packages/reportlab/graphics/renderPM.py | Python | mit | 27,312 |
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def deleteNode(self, node):
"""
:type node: ListNode
:rtype: void Do not return anything, modify node in-place instead.
... | tedye/leetcode | Python/leetcode.237.delete-node-in-a-linked-list.py | Python | mit | 414 |
# -*- coding: utf-8 -*-
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
engine = create_engine("mysql://root:654321@localhost/mx", echo=True)
| hbrls/mx | models/__init__.py | Python | mit | 216 |
# -*- coding: utf-8 -*-
#########################################################################
## Changes the menu active item
#########################################################################
def toggle_menuclass(cssclass='pressed',menuid='headermenu'):
"""This function changes the menu class to put pr... | stryder199/RyarkAssignments | Assignment2/web2py/applications/examples/models/menu.py | Python | mit | 1,354 |
# Radioco - Broadcasting Radio Recording Scheduling system.
# Copyright (C) 2014 Iago Veloso Abalo
#
# 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 yo... | iago1460/django-radio | radioco/apps/users/models.py | Python | gpl-3.0 | 2,454 |
# Copyright(c) 2009, Gentoo Foundation
#
# Copyright 2010 Brian Dolbec <brian.dolbec@gmail.com>
# Copyright(c) 2010, Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
#
# $Header: $
"""Analyse Base Module class to hold common module operation functions
"""
from __future__ import pri... | djanderson/equery | pym/gentoolkit/analyse/base.py | Python | gpl-2.0 | 3,534 |
from __future__ import unicode_literals
import unittest
import warnings
from datetime import datetime
from django.core.paginator import (
EmptyPage, InvalidPage, PageNotAnInteger, Paginator,
UnorderedObjectListWarning,
)
from django.test import TestCase
from django.utils import six
from .custom import ValidA... | cloudera/hue | desktop/core/ext-py/Django-1.11.29/tests/pagination/tests.py | Python | apache-2.0 | 15,082 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20150814_2057'),
]
operations = [
migrations.RemoveField(
model_name='vbuserprofile',
... | hbuyse/VBTournaments | accounts/migrations/0004_remove_vbuserprofile__share_phone.py | Python | mit | 366 |
#!/usr/bin/python
import time
# some python code that I want
# to keep on running
# Is this the right way to run the python program forever?
# And do I even need this time.sleep call?
while True:
time.sleep(5)
print "Vanakkam!"
| markpollack/spring-cloud-skipper | spring-cloud-skipper-server-core/src/test/resources/repositories/sources/test/python/python-printer-1.0.1/vanakkam.py | Python | apache-2.0 | 240 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# kate: space-indent on; indent-width 4; mixedindent off; indent-mode python;
from trac.db import Table, Column, Index
name = 'crashdump'
version = 13
tables = [
Table('crashdump', key=('id'))[
Column('id', type='int', auto_increment=True),
Column('uuid', ... | aroth-arsoft/arsoft-web-crashupload | app/crashdump/db_default.py | Python | gpl-3.0 | 7,881 |
import logging
from . import helpers, models
from .log import event_logger
logger = logging.getLogger(__name__)
def log_invoice_save(sender, instance, created=False, **kwargs):
if created:
event_logger.paypal_invoice.info(
'{invoice_invoice_date}-{invoice_end_date}. Invoice for customer {cus... | opennode/waldur-mastermind | src/waldur_paypal/handlers.py | Python | mit | 2,647 |
N, R = map(int, input().split())
board = list(input())
ans = 0
for i in range(N-1, -1, -1):
if board[i] == '.':
ans += max(0, i-R+1)
break
i = 0
while i < N:
if board[i] == '.':
ans += 1
i += R
else:
i += 1
print(ans)
| knuu/competitive-programming | atcoder/arc/arc040_b.py | Python | mit | 271 |
#!/usr/bin/env python
#
# Scatter example using mpi4py.
#
#
# agomez (at) tacc.utexas.edu
# 30 Oct 2014
#
# ---------------------------------------------------------------------
from mpi4py import MPI
comm = MPI.COMM_WORLD
size = comm.size
rank = comm.rank
if rank == 0:
data = [i for i in range(size)]
print ... | antoniogi/HPC | Python/TACC_HPC/4_mpi4py/scatter.py | Python | apache-2.0 | 487 |
DOIT_CONFIG = {'verbose': 2}
def task_xxx1():
"""task doc"""
return {'actions':['do nothing']}
def task_yyy2():
return {'actions':None}
def bad_seed():
pass
| swayf/doit | tests/loader_sample.py | Python | mit | 178 |
#!/usr/bin/env python
#
# Generate seeds.txt from Pieter's DNS seeder
#
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 200000
# These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node).
SUSPICIOUS_HOSTS = set([
"144.76.33.134","95.31.211.13",
"92.255.229.121"... | baltcoinh/eternity | contrib/seeds/makeseeds.py | Python | mit | 3,541 |
#!/usr/bin/python
#
# Copyright 2013 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... | zaret-rocket/googleads-adsense-examples | python/v1.4/get_all_alerts.py | Python | apache-2.0 | 2,038 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Autor: jordi collell <jordi@tempointeractiu.cat>
# http://tempointeractiu.cat
# -------------------------------------------------------------------
'''
'''
from django.conf import settings
from django.shortcuts import render_to_response
from django.template import Request... | jordic/django_tiny_shop | tshop/payment/__init__.py | Python | bsd-3-clause | 1,869 |
from datetime import datetime, timedelta
from http.cookies import SimpleCookie
from mach9 import Mach9
from mach9.response import json, text
import pytest
# ------------------------------------------------------------ #
# GET
# ------------------------------------------------------------ #
def test_cookies():
a... | silver-castle/mach9 | tests/test_cookies.py | Python | mit | 3,074 |
# vim: set fileencoding=utf-8 :
#
# Copyright (c) 2012 Retresco GmbH
# Copyright (c) 2011 Daniel Truemper <truemped at googlemail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ht... | truemped/dopplr | dopplr/solr/client.py | Python | apache-2.0 | 14,084 |
from odoo import models, fields
class ResPartner(models.Model):
_inherit = 'res.partner'
skype = fields.Char(string='Skype')
| multidadosti-erp/multidadosti-addons | base_partner_skype/models/res_partner.py | Python | agpl-3.0 | 136 |
from __future__ import unicode_literals
from django.core.management import call_command
from django.db import connection
from django.test import TransactionTestCase, skipUnlessDBFeature
@skipUnlessDBFeature("gis_enabled")
class MigrateTests(TransactionTestCase):
"""
Tests running the migrate comman... | yephper/django | tests/gis_tests/gis_migrations/test_commands.py | Python | bsd-3-clause | 2,762 |
from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, lm, oid
from forms import LoginForm, EditForm
from models import User, ROLE_USER, ROLE_ADMIN
from datetime import datetime
@lm.user... | hmdavis/flask-mega-tutorial | app/views.py | Python | bsd-3-clause | 4,940 |
import unittest
from typing import List
import utils
from tree import TreeNode
# O(n) time. O(log(n)) space. Recursive pre-order DFS.
class Solution:
def preorderTraversal(self, root: TreeNode) -> List[int]:
result = []
def dfs(curr):
if not curr:
return
r... | chrisxue815/leetcode_python | problems/test_0144_recursive.py | Python | unlicense | 835 |
#
# Copyright 2015 Red Hat, Inc.
#
# 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 th... | simon3z/virt-deploy | virtdeploy/drivers/libvirt.py | Python | gpl-2.0 | 12,264 |
from rockstar import RockStar
ruby_code = "puts 'Hello world'"
rock_it_bro = RockStar(days=400, file_name='helloWorld.rb', code=ruby_code)
rock_it_bro.make_me_a_rockstar()
| yask123/rockstar | examples/ruby_rockstar.py | Python | mit | 173 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/media/azure-mgmt-media/azure/mgmt/media/operations/_streaming_policies_operations.py | Python | mit | 16,815 |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/sockeye/test/unit/test_utils.py | Python | apache-2.0 | 13,301 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/ocil_2_0/QuestionResultElement.py | Python | gpl-3.0 | 896 |
"""
Define a data structure that supports push, pop, and min in O(1)
min returns the smallest element in the list
"""
class StackMin:
items = []
mins = []
def peek(self):
if self.items:
return self.items[len(self.items) - 1]
return None
def min(self):
if self.mins:
... | lorden/algofun | stack_getmin.py | Python | mit | 1,068 |
# https://oj.leetcode.com/problems/combination-sum-ii/
class Solution:
# @param candidates, a list of integers
# @param target, integer
# @return a list of lists of integers
def combinationSum2(self, candidates, target):
self.result = []
# sort in desending order
# O(nlogn)
candidates = sorted(... | yaoxuanw007/forfun | leetcode/python/combinationSumII.py | Python | mit | 1,034 |
__all__ = ["myfunction"]
| Suiname/LearnPython | mypackage/__init__.py | Python | mit | 25 |
# coding=utf-8
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "..")))
from common.JsonHelper import loadJsonConfig
from db.MysqlUtil import initMysql, execute, select, batchInsert, disconnect
import time
from threading import Timer
from wechat.weChatSender import sendMessageToMySel... | zwffff2015/stock | task/TechForecastTask.py | Python | mit | 5,126 |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
DEBUG = True
TESTING = True
PRODUCTION = False
HOST = '0.0.0.0'
SQLALCHEMY_DATABASE_URI = 'sqlite:////tmp/ggrc-dev.db'
SQLALCHEMY_ECHO = True
AUTOBUILD_ASSETS = True
ENABLE_JASMINE = True
| edofic/ggrc-core | src/ggrc/settings/development_sqlite.py | Python | apache-2.0 | 301 |
# -*- coding: utf-8 -*-
from cms import constants
from cms.utils.conf import get_cms_setting
from django.core.exceptions import PermissionDenied
from cms.exceptions import NoHomeFound, PublicIsUnmodifiable
from cms.models.managers import PageManager, PagePermissionsPermissionManager
from cms.models.metaclasses import P... | adaptivelogic/django-cms | cms/models/pagemodel.py | Python | bsd-3-clause | 44,462 |
"""Support for KNX/IP binary sensors."""
from typing import Any, Dict, Optional
from xknx.devices import BinarySensor as XknxBinarySensor
from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity
from .const import ATTR_COUNTER, DOMAIN
from .knx_entity import KnxEntity
async def async_s... | tboyce021/home-assistant | homeassistant/components/knx/binary_sensor.py | Python | apache-2.0 | 1,718 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# WSStat documentation build configuration file, created by
# sphinx-quickstart on Fri Sep 23 22:33:44 2016.
#
# 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
# aut... | Fitblip/wsstat | docs/conf.py | Python | mit | 9,867 |
# -*- coding: utf-8 -*-
# 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... | googleads/google-ads-python | google/ads/googleads/v10/enums/types/customizer_attribute_status.py | Python | apache-2.0 | 1,194 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Hiroaki Nakamura <hnakamur@gmail.com>
# 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_vers... | brandond/ansible | lib/ansible/modules/cloud/lxd/lxd_profile.py | Python | gpl-3.0 | 12,501 |
#!/usr/bin/env python2.7
# Copyright 2015 gRPC 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 applicable la... | jtattermusch/grpc | test/cpp/naming/utils/dns_resolver.py | Python | apache-2.0 | 2,311 |
def foo(a, b, c):
pass
foo(1, 2, <arg1>)
| samthor/intellij-community | python/testData/paramInfo/PartialSimple.py | Python | apache-2.0 | 44 |
import sim
import datetime
def open_log(file_name):
log_file = open(file_name, "a+")
# Header for the log file
time = datetime.datetime.now()
log_file.write("%s" %(time.strftime("%Y-%m-%d %H:%M:%S")))
return log_file
def close_log(log_file):
log_file.close()
def log_arms(log_file, arms):
... | CMPUT496/project | Simulator/logger.py | Python | gpl-2.0 | 1,124 |
from mpi4py import MPI
from cplpy.cpl import CPL
import numpy as np
#lib.set("output_mode", 0)
CPL = CPL()
nsteps = 1
dt = 0.2
# Parameters of the cpu topology (cartesian grid)
NPx = 3
NPy = 3
NPz = 3
NProcs = NPx*NPy*NPz
# Parameters of the mesh topology (cartesian grid)
ncxyz = np.array([18, 18, 18], order='F', d... | Crompulence/cpl-library | src/bindings/python/cplpy/examples/lib_example/cfd_init2.py | Python | gpl-3.0 | 3,054 |
from _App import *
| xbmc/atv2 | xbmc/lib/libPython/Python/Lib/plat-mac/Carbon/App.py | Python | gpl-2.0 | 19 |
# -*- coding: utf-8 -*-
"""Test for Poll Xmodule functional logic."""
from xmodule.poll_module import PollDescriptor
from . import LogicTest
class PollModuleTest(LogicTest):
"""Logic tests for Poll Xmodule."""
descriptor_class = PollDescriptor
raw_field_data = {
'poll_answers': {'Yes': 1, 'Dont_kn... | xingyepei/edx-platform | common/lib/xmodule/xmodule/tests/test_poll.py | Python | agpl-3.0 | 1,133 |
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.views.generic import View
from django.utils.decorators import method_decorator
from goal.v... | mnieber/shared-goal | django/suggestion/views.py | Python | apache-2.0 | 5,641 |
"""
KeepNote
Update notebook dialog
"""
#
# KeepNote
# Copyright (c) 2008-2009 Matt Rasmussen
# Author: Matt Rasmussen <rasmus@mit.edu>
#
# 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... | reshadh/Keepnote-LaTeX | keepnote/gui/dialog_node_icon.py | Python | gpl-2.0 | 11,352 |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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... | OpenDaisy/daisy-api | daisy/search/api/v0_1/search.py | Python | apache-2.0 | 13,617 |
def array(strng):
return ' '.join(strng.split(',')[1:-1]) or None
| the-zebulan/CodeWars | katas/kyu_8/remove_first_and_last_char_part_two.py | Python | mit | 70 |
import pysam
import argparse
import sys
import logging
import os
import pandas as pd
from asyncore import read
DEBUG = False
NOT_DEBUG= not DEBUG
parser = argparse.ArgumentParser(description="split bam to subsamples.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.ad... | shengqh/ngsperl | lib/scRNA/split_samples.py | Python | apache-2.0 | 2,494 |
# Software License Agreement (BSD License)
#
# Copyright (c) 2008, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... | ros/ros | core/roslib/src/roslib/resources.py | Python | bsd-3-clause | 4,541 |
"""Tasks related to projects
This includes fetching repository code, cleaning ``conf.py`` files, and
rebuilding documentation.
"""
import os
import shutil
import json
import logging
import socket
import requests
import hashlib
from collections import defaultdict
from celery import task, Task
from djcelery import cel... | VishvajitP/readthedocs.org | readthedocs/projects/tasks.py | Python | mit | 31,419 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_spannertools_PianoPedalSpanner___eq___01():
r'''Spanner is strict comparator.
'''
spanner_1 = spannertools.PianoPedalSpanner()
spanner_2 = spannertools.PianoPedalSpanner()
assert not spanner_1 == spanner_2 | mscuthbert/abjad | abjad/tools/spannertools/test/test_spannertools_PianoPedalSpanner___eq__.py | Python | gpl-3.0 | 284 |
# -*- coding: utf-8 -*-
"""tests/fixtures/__init__.py
By David J. Thomas, thePortus.com, dave.a.base@gmail.com
The init file the module-wide test fixtures
"""
| thePortus/usf-dime-novels | usf_dime_novels/tests/fixtures/__init__.py | Python | mit | 160 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/everytrace-example/package.py | Python | lgpl-2.1 | 1,786 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# 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',
... | skg-net/ansible | lib/ansible/modules/network/junos/junos_rpc.py | Python | gpl-3.0 | 5,333 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.