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 |
|---|---|---|---|---|---|
#Escreva um algoritmo para ler um valor e escrever o seu antecessor.
n=int(input("digite número: "))
a=(n-1)
print(a)
| erikaklein/algoritmo---programas-em-Python | LerUmValorEscreverAntecessor.py | Python | mit | 128 |
# Copyright 2011 David Malcolm <dmalcolm@redhat.com>
# Copyright 2011 Red Hat, Inc.
#
# This 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) a... | davidmalcolm/gcc-python-plugin | tests/plugin/diagnostics/script.py | Python | gpl-3.0 | 2,908 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | trunglq7/horizon | openstack_dashboard/dashboards/admin/users/views.py | Python | apache-2.0 | 4,417 |
import json
import requests
from django.views.decorators.csrf import csrf_exempt
FB_MESSENGER_ACCESS_TOKEN = "[TOKEN]"
def respond_FB(sender_id, text):
json_data = {
"recipient": {"id": sender_id},
"message": {"text": text + " to you!"}
}
params = {
"access_token": FB_MESSENGER_A... | voidabhi/python-scripts | webhook-fb-messenger.py | Python | mit | 1,193 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | t-wissmann/qutebrowser | qutebrowser/browser/webengine/tabhistory.py | Python | gpl-3.0 | 3,979 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 7 11:49:59 2015
mono.py
Executa os algoritmos mono-objetivo n vezes conforme o teorema do limite central da normalidade
Cria o gráfico comparativo das médias de cada geração/iteração
@author: victor
@todo Adicionar busca local ao fim da execução de cada algoritmo
"""
i... | vhte/cefetdiss | mono.py | Python | mit | 17,883 |
# Copyright (c) 2015-2016 Tigera, 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 by applicabl... | projectcalico/calico | networking-calico/networking_calico/compat.py | Python | apache-2.0 | 2,199 |
import os
from functools import wraps
from flask import abort, current_app
from flask_login import current_user, login_required
from app.notify_client.organisations_api_client import organisations_client
user_is_logged_in = login_required
with open('{}/email_domains.txt'.format(
os.path.dirname(os.path.realpat... | alphagov/notifications-admin | app/utils/user.py | Python | mit | 2,271 |
# -*- coding: utf8 -*-
"""
Модуль предоставляет обраточик Http-запросов.
"""
import cgi
from http.server import BaseHTTPRequestHandler
a="""
<html>
<head>
<meta charset="utf-8">
</head>
<body>
Привет !
</body>
</html>
"""
class clsHttpRequest(BaseHTTPRequestHandler):
def do_GET(se... | prospero78/pyTrans | Server/pakTransServ/pakControl/pakServerThread/pakHttpRequest/modHttpRequest.py | Python | bsd-2-clause | 2,061 |
#!/usr/bin/python
#
# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.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_version': '1.1',
... | EvanK/ansible | lib/ansible/modules/cloud/azure/azure_rm_route.py | Python | gpl-3.0 | 7,364 |
# Author: duramato <matigonkas@outlook.com>
# URL: https://github.com/SickRage/sickrage
#
# This file is part of SickRage.
#
# SickRage 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 L... | badloop/SickRage | sickbeard/providers/torrentproject.py | Python | gpl-3.0 | 4,952 |
"""
autoGonk -- auto-configuration script for break
Step 0: be vewy quiet, wew hunting wabbits! (silence on the wire)
Step 1: calculate victim IP and MAC address
Step 2: calculate gateway IP and MAC
Step 3: ?
Step 4: write our configuration to file
"""
import sys
from os import getuid
try:
from scapy.all import... | sodaphish/break | autoGonk.py | Python | mit | 3,048 |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Martine Lenders <mail@martine-lenders.eu>
#
# Distributed under terms of the MIT license.
from __future__ import print_function
import os
import sys
import random
import subprocess
import time
import types
import pexpect
import socke... | smlng/RIOT | tests/lwip/tests/01-run.py | Python | lgpl-2.1 | 13,682 |
# -- coding: utf-8 --
# ===========================================================================
# eXe
# Copyright 2013, Pedro Peña Pérez, Open Phoenix IT
#
# 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 Softwar... | exelearning/iteexe | exe/engine/locationbuttons.py | Python | gpl-2.0 | 4,114 |
def string_matching_rabin_karp(text='', pattern='', hash_base=256):
"""Returns positions where pattern is found in text.
worst case: O(nm)
O(n+m) if the number of valid matches is small and the pattern is large.
Performance: ord() is slow so we shouldn't use it here
Example: text = 'ababbababa', pa... | hadyelsahar/RE-NLG-Dataset | utils/matching.py | Python | mit | 2,527 |
#!/usr/bin/env python
# vim: sw=4:ts=4:sts=4:fdm=indent:fdl=0:
# -*- coding: UTF8 -*-
#
# I/O Utility functions.
# Copyright (C) 2012 Josiah Gordon <josiahg@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... | zepto/musio-python2 | musio/io_util.py | Python | gpl-3.0 | 14,987 |
# -*- coding: utf-8 -*-
#
# evaluate_quantal_stp_synapse.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 o... | kristoforcarlson/nest-simulator-fork | pynest/examples/evaluate_quantal_stp_synapse.py | Python | gpl-2.0 | 6,184 |
# This file is part of exhale: https://github.com/svenevs/exhale
#
# This file was generated on/around (date -Ru):
#
# Tue, 08 Nov 2016 07:18:48 +0000
#
# Copyright (c) 2016, Stephen McDowell
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are pe... | KIKI007/ReusedPrinter | external/nanogui/docs/exhale.py | Python | mpl-2.0 | 136,535 |
import os
import sys
from setuptools import setup, find_packages
pwd = os.path.abspath(os.path.dirname(__file__))
sys.path.append(pwd)
try:
import nuclai.__main__ as nuclai
VERSION = nuclai.__version__
except ImportError as e:
VERSION = 'N/A'
setup(name='nuclai',
version=VERSION,
descripti... | aigamedev/nuclai-installer | setup.py | Python | gpl-3.0 | 1,050 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | ThomasMiconi/htmresearch | projects/sequence_prediction/discrete_sequences/plotFaultyTMPerformance.py | Python | agpl-3.0 | 7,323 |
# Copyright 2016 F5 Networks 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 writi... | wojtek0806/f5-common-python | devtools/crawler.py | Python | apache-2.0 | 2,855 |
"""
This bootstrap module should be used to setup parts of the ircbot plugin
that need to exist before all controllers are loaded. It is best used to
define/register hooks, setup namespaces, and the like.
"""
import os
import json
import re
from urllib2 import urlopen, HTTPError, URLError
from time import sleep
... | iuscommunity/ius-tools | src/iustools.ircbot/iustools/bootstrap/ircbot.py | Python | gpl-2.0 | 5,050 |
#
# iutil.py - generic install utility functions
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
# Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwar... | masami256/Anaconda-for-ore-ore-kernel | pyanaconda/iutil.py | Python | gpl-2.0 | 27,310 |
from askbot.tests.cache_tests import *
from askbot.tests.email_alert_tests import *
from askbot.tests.on_screen_notification_tests import *
from askbot.tests.page_load_tests import *
from askbot.tests.permission_assertion_tests import *
from askbot.tests.db_api_tests import *
from askbot.tests.skin_tests import *
from ... | divio/askbot-devel | askbot/tests/__init__.py | Python | gpl-3.0 | 1,266 |
# fly ArduPlane QuadPlane in SITL
import util, pexpect, sys, time, math, shutil, os
from common import *
from pymavlink import mavutil
import random
# get location of scripts
testdir=os.path.dirname(os.path.realpath(__file__))
HOME_LOCATION='-27.274439,151.290064,343,8.7'
MISSION='ArduPlane-Missions/Dalby-OBC2016.t... | chapman/ardupilot | Tools/autotest/quadplane.py | Python | gpl-3.0 | 4,237 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/public-datasets-pipelines | datasets/covid19_vaccination_access/pipelines/vaccination_access_to_bq/vaccination_access_to_bq_dag.py | Python | apache-2.0 | 20,609 |
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
# * Redi... | DLR-SC/DataFinder | src/datafinder/gui/user/dialogs/authentification_dialog/auth_edit_dialog.py | Python | bsd-3-clause | 7,236 |
class Solution(object):
def isPalindrome(self, s):
s = s.lower()
start, end = 0, len(s) - 1
while start < end:
if not s[start].isalnum():
start += 1
elif not s[end].isalnum():
end -= 1
else:
if s[start] == s[... | luosch/leetcode | python/Valid Palindrome.py | Python | mit | 461 |
from dimensioning import *
from dimensioning import __dir__ # not imported with * directive
import dimensioning
class PreviewVars:
def __init__(self):
self.SVG_initialization_width = -1
self.SVG_initialization_height = -1
def setTransform(self,drawingVars):
self.x_offset = drawingVars.... | ulikoehler/FreeCAD_drawing_dimensioning | previewDimension.py | Python | gpl-3.0 | 7,480 |
from unittest import TestCase
from unittest.mock import Mock
from grortir.main.optimizers.grouping_strategy import GroupingStrategy
class TestGroupingStrategy(TestCase):
def test_get_items_from_group(self):
grouping_strategy = Mock()
grouping_strategy.get_actual_numbers_of_groups.return_value = 3... | qbahn/grortir | grortir/test/optimizers/test_groupingStrategy.py | Python | mit | 437 |
#!python
#!/usr/bin/env python
#
# Script to export a Cubit13+/Trelis 2D mesh in specfem2d format for the elements QUAD9
# pour creer des fichiers correspondant a Specfem2d a partir du maillage de Cubit
# Initial author unknown, comments and modifications by Alexis Bottero (alexis dot bottero At gmail dot com) et Ting ... | geodynamics/specfem2d | utils/cubit2specfem2d/cubit2specfem2d_QUAD9.py | Python | gpl-3.0 | 38,224 |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# file: main.py
import el, he | markomanninen/isopsephy | romanize/main.py | Python | mit | 78 |
# Copyright (C) 2009 Nokia Corporation
# Copyright (C) 2009-2012 Collabora Ltd.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) ... | freedesktop-unofficial-mirror/telepathy__telepathy-mission-control | tests/twisted/account-manager/create-with-properties.py | Python | lgpl-2.1 | 6,362 |
# -*- coding: utf-8 -*-
# added new list_tbl definition
from functools import partial
from navmazing import NavigateToAttribute, NavigateToSibling
from cfme.common import SummaryMixin, Taggable
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import CheckboxTable, toolbar as tb, paginator, InfoBlock, ... | kzvyahin/cfme_tests | cfme/containers/node.py | Python | gpl-2.0 | 3,038 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='BibliotikFulltext',
fields=[
... | grandmasterchef/WhatManager2 | bibliotik/migrations/0001_initial.py | Python | mit | 3,906 |
a = [int(i) for i in input().split()]
print(sum(a))
| maisilex/Lets-Begin-Python | list.py | Python | mit | 52 |
n5a_type_marker = '__is_n5a_type__'
from n5a.n5atype import *
| sschaetz/n5a | n5a/__init__.py | Python | mit | 62 |
from __future__ import absolute_import, unicode_literals
import operator
import sys
from collections import OrderedDict
from functools import reduce
from django import forms
from django.contrib.admin import FieldListFilter, widgets
from django.contrib.admin.exceptions import DisallowedModelAdminLookup
from django.con... | hamsterbacke23/wagtail | wagtail/contrib/modeladmin/views.py | Python | bsd-3-clause | 35,740 |
"""
gw2copilot/wine_mumble_reader.py
The latest version of this package is available at:
<https://github.com/jantman/gw2copilot>
################################################################################
Copyright 2016 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com>
This file is part of g... | jantman/gw2copilot | gw2copilot/wine_mumble_reader.py | Python | agpl-3.0 | 9,880 |
from __future__ import print_function
# Time: O(n * glogg), g is the max size of groups.
# Space: O(n)
#
# Given an array of strings, return all groups of strings that are anagrams.
#
# Note: All inputs will be in lower-case.
#
import collections
class Solution(object):
def groupAnagrams(self, strs):
""... | kamyu104/LeetCode | Python/group-anagrams.py | Python | mit | 822 |
# -*- coding: utf-8 -*-
"""
orthopoly.py - A suite of functions for generating orthogonal polynomials
and quadrature rules.
Copyright (c) 2014 Greg von Winckel
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated do... | NicovincX2/Python-3.5 | Analyse (mathématiques)/Analyse numérique/Équations différentielles numériques/Collocation method/orthopoly.py | Python | gpl-3.0 | 11,766 |
from django.conf import settings
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required
from django.urls import include, path
from django.views.generic import RedirectView
from api.urls import urlpatterns as api
from bridge_lti.url... | harvard-vpal/bridge-adaptivity | bridge_adaptivity/config/urls.py | Python | bsd-3-clause | 1,009 |
# -*- coding: utf-8 -*-
from bda.plone.orders import mailnotify as MN
import unittest
class TestMailnotifyUnit(unittest.TestCase):
def test_indent_wrap(self):
"""The _indent mehtod should wrap like defined by it's parameters.
"""
txt = u"abcd " * 3
ctrl = ' abcd\nabcd abcd' #... | andreesg/bda.plone.orders | src/bda/plone/orders/tests/test_mailnotify.py | Python | bsd-3-clause | 755 |
#MenuTitle: Delete Short Segments
# -*- coding: utf-8 -*-
__doc__="""
Deletes single-unit segments.
"""
thisFont = Glyphs.font # frontmost font
selectedLayers = thisFont.selectedLayers # active layers of selected glyphs
def process( thisLayer ):
for thisPath in thisLayer.paths:
for i in range(len(thisPath.nodes))[... | schriftgestalt/Mekka-Scripts | Paths/Delete Short Segments.py | Python | apache-2.0 | 993 |
import os.path
import os
import platform
import commands
import time
import uuid
import sys
import urllib2, urllib
import atexit
import socks
import socket
import socket
import select
os.system('clear')
print "Welcome to pseudo V0.2"
print " _"
print " | |" ... | jeremystevens/pseudo | source/pseudo.py | Python | gpl-2.0 | 20,422 |
"""Record simulated nightly statistics by program.
"""
from __future__ import print_function, division, absolute_import
import numpy as np
import astropy.io.fits
import desiutil.log
import desisurvey.config
import desisurvey.utils
import desisurvey.tiles
import desisurvey.plots
class SurveyStatistics(object):
... | desihub/surveysim | py/surveysim/stats.py | Python | bsd-3-clause | 13,280 |
N = int(input())
ans = []
i = 0
while N >> i:
if (N >> i) & 1:
ans.append(i+1)
i += 1
print(*ans[::-1])
| knuu/competitive-programming | hackerrank/contest/wfr2016_a.py | Python | mit | 120 |
# Manual labour - a library for step-by-step instructions
# Copyright (C) 2014 Johannes Reinhardt <jreinhardt@ist-dein-freund.de>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; eith... | jreinhardt/manual-labour | tests/test_stores.py | Python | lgpl-2.1 | 2,384 |
# Copyright 2010 Chet Luther <chet.luther@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | cluther/snmposter | snmposter/scripts.py | Python | apache-2.0 | 1,489 |
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
from common import runtests
from .shared import try_finally_maker3
from .shared import setGenerator, test_excep... | slozier/ironpython2 | Tests/compat/sbs_exceptions/try_finally3.py | Python | apache-2.0 | 385 |
###########################################################################
#
# Copyright (c) 2010 Davide Pesavento <davidepesa@gmail.com>
#
# This file is part of FORSE.
#
# FORSE 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 ... | Pesa/forse | src/forse/race_info/Main.py | Python | gpl-3.0 | 1,114 |
"""Tests for the class GnosisPackageTopicModel."""
from analytics_platform.kronos.src import config
from analytics_platform.kronos.gnosis.src.gnosis_package_topic_model import GnosisPackageTopicModel
from util.data_store.local_filesystem import LocalFileSystem
from util.analytics_platform_util import create_tags_for_p... | sara-02/fabric8-analytics-stack-analysis | tests/unit_tests/test_kronos_gnosis_package_topic_model.py | Python | gpl-3.0 | 3,353 |
from django.http import HttpResponse
import pymongo
from course_dashboard_api.v2.dbv import *
mongo_db = MONGO_DB
""" Description: Function to get grading policy of a course
Input Parameters:
course_name: name of the course for which grading policy is required (ex. CT101.1x)
course_run: ru... | jaygoswami2303/course_dashboard_api | v2/GradePolicyAPI/api.py | Python | mit | 6,687 |
sns.set_style("white")
histplot = sns.displot(data=tidy_experiment, x="optical_density",
color='grey', edgecolor='white')
histplot.fig.suptitle("Optical density distribution")
histplot.axes[0][0].set_ylabel("Frequency"); | jorisvandenbossche/DS-python-data-analysis | notebooks/_solutions/case3_bacterial_resistance_lab_experiment2.py | Python | bsd-3-clause | 244 |
import base64, os, traceback, zipfile
from lxml import etree
from abc import abstractmethod
from fbreader.format.bookfile import BookFile
from fbreader.format.mimetype import Mimetype
from fbreader.format.util import list_zip_file_infos
class FB2StructureException(Exception):
def __init__(self, error):
Ex... | geometer/book_tools | fbreader/format/fb2.py | Python | mit | 6,699 |
# -*- coding: utf-8 -*-
"""
Admin site configuration for third party authentication
"""
from django.contrib import admin
from config_models.admin import ConfigurationModelAdmin, KeyedConfigurationModelAdmin
from .models import OAuth2ProviderConfig, SAMLProviderConfig, SAMLConfiguration, SAMLProviderData
from .tasks i... | shashank971/edx-platform | common/djangoapps/third_party_auth/admin.py | Python | agpl-3.0 | 3,661 |
# coding=utf-8
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import os
import traceback
import sys
import time
import re
import tempfile
import logging
from flask import make_response
from octoprint.settings import settings, default... | ymilord/OctoPrint-MrBeam | src/octoprint/util/__init__.py | Python | agpl-3.0 | 7,222 |
#!/usr/bin/env python3
import h5py
import sys
import numpy as np
def main(args):
input_feat_path = args[1]
new_feat_path = args[2]
value = args[3]
feat_template = h5py.File(input_feat_path, 'r')
new_feat = h5py.File(new_feat_path, 'w')
for subj in feat_template:
for ictyp in feat_t... | Neuroglycerin/hail-seizure | python/create_dummy_data.py | Python | apache-2.0 | 1,435 |
"""
Base and utility classes for tseries type pandas objects.
"""
from datetime import datetime
from typing import Any, List, Optional, TypeVar, Union, cast
import numpy as np
from pandas._libs import NaT, Timedelta, iNaT, join as libjoin, lib
from pandas._libs.tslibs import Resolution, timezones
from pandas._libs.ts... | TomAugspurger/pandas | pandas/core/indexes/datetimelike.py | Python | bsd-3-clause | 31,546 |
import math
import csv
from django.shortcuts import render, render_to_response, redirect
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.template import RequestContext
from django.contrib import messages
from django.core.context_processors import csrf
from dja... | praekelt/ndoh-control | controlinterface/views.py | Python | bsd-3-clause | 21,742 |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error
class libsndfile(test.test):
"""
Autotest module for testing basic functionality
of libsndfile
@author Anitha MallojiRao amalloji@in.ibm.com ##
"""
... | PoornimaNayak/autotest-client-tests | linux-tools/libsndfile/libsndfile.py | Python | gpl-2.0 | 1,253 |
from handlers.base_handler import BaseHandler
db = {
1:{'id':1, 'name':'Fido', 'image_url':'https://images-na.ssl-images-amazon.com/images/G/01/img15/pet-products/small-tiles/23695_pets_vertical_store_dogs_small_tile_8._CB312176604_.jpg'},
2:{'id':2, 'name': 'Cesar', 'image_url':'http://3.bp.blogspot.com/-NAJ1... | xstrengthofonex/code-live-tutorials | python_web_development/templating/handlers/dog_handlers.py | Python | mit | 1,402 |
# preliminary tests indicate that for the sum of primes to be less than a million,
# there can only be at most 547 primes
import primes, sys
Pl = list(primes.sieve(1000000))
P = set(Pl)
for l in range(547, 1, -1):
if l % 1000 == 0:
print("Testing " + str(l))
for i in range(len(Pl) - l + 1):
... | firefly431/projecteuler | 50.py | Python | gpl-2.0 | 446 |
from a10sdk.common.A10BaseClass import A10BaseClass
class Oper(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param alloc_failed: {"type": "number", "format": "number"}
:param vrid: {"enum": ["default"], "type": "string", "format": "enum"}
:param ha_group_id: {... | amwelch/a10sdk-python | a10sdk/core/slb/slb_server_port_oper.py | Python | apache-2.0 | 2,709 |
################################################################################
# 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... | hequn8128/flink | flink-python/pyflink/dataset/__init__.py | Python | apache-2.0 | 1,234 |
import json
class Student(object):
def __init__(self, name, age, score):
self.name = name
self.age = age
self.score = score
s = Student('Bob', 20, 88)
print(json.dumps(s)) | tangming2010/gitRepository | we.py | Python | gpl-2.0 | 201 |
# -*- coding: utf-8 -*-
__author__ = 'xuanwo'
from setuptools import setup, find_packages
import chineseregion
entry_points = {
"console_scripts": [
"chineseregion = chineseregion.main:main",
]
}
# with open("requirements.txt") as f:
# requires = [l for l in f.read().splitlines() if ... | Xuanwo/chineseregion | setup.py | Python | mit | 1,230 |
from .fields import * | leliel12/handy | handy/models/__init__.py | Python | bsd-3-clause | 21 |
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import unittest
import frappe
from frappe.utils import flt, nowdate
from erpnext.assets.doctype.asset.test_asset import (
create_asset,
create_asset_data,
set_depreciation_settings_in_company,
)
class TestAssetRepair(unittest... | mhbu50/erpnext | erpnext/assets/doctype/asset_repair/test_asset_repair.py | Python | gpl-3.0 | 6,232 |
'''
Unit tests for oc route
'''
import os
import six
import sys
import unittest
import mock
# Removing invalid variable names for tests so that I can
# keep them brief
# pylint: disable=invalid-name,no-name-in-module
# Disable import-error b/c our libraries aren't loaded in jenkins
# pylint: disable=import-error,wro... | brenton/openshift-ansible | roles/lib_openshift/src/test/unit/test_oc_route.py | Python | apache-2.0 | 12,042 |
# encoding: UTF-8
'''
本文件中实现了行情数据记录引擎,用于汇总TICK数据,并生成K线插入数据库。
使用DR_setting.json来配置需要收集的合约,以及主力合约代码。
'''
import json
import os
import copy
from collections import OrderedDict
from datetime import datetime, timedelta
from Queue import Queue
from threading import Thread
from eventEngine import *
from vtGateway import V... | yongfuyang/vnpy | vn.trader/dataRecorder/drEngine_kangseung.py | Python | mit | 22,549 |
# -*- coding: utf-8 -*-
"""Combatant self-serve views."""
# standard library imports
import uuid
from datetime import datetime
# third-party imports
from flask import Blueprint, render_template, current_app
from flask_login import current_user
# application imports
from emol.models import Combatant, Discipline, Upda... | lrt512/emol | emol/emol/views/combatant/combatant.py | Python | mit | 2,510 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import sys
import os
import datetime
import numpy as np
from .. import core
from .. import util
def emulate_weather(initialdata,finaltimestamp=-1,mincloudcover=0,maxcloudcover=1,minambienttemperature=-5,maxambienttemperature=25):
"""
... | BrechtBa/homeconn | homecon/demo/weather.py | Python | gpl-3.0 | 4,353 |
#-*- coding: UTF-8 -*-
from ctypes import POINTER, c_void_p, c_int, c_uint, c_char, c_float, Structure, c_char_p, c_double, c_ubyte, c_size_t, c_uint32
class Vector2D(Structure):
"""
See 'aiVector2D.h' for details.
"""
_fields_ = [
("x", c_float),("y", c_float),
]
class Matrix... | xupei0610/ComputerGraphics-HW | hw4/lib/assimp/port/PyAssimp/pyassimp/structs.py | Python | mit | 34,579 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | coreycb/horizon | openstack_dashboard/dashboards/admin/hypervisors/compute/views.py | Python | apache-2.0 | 3,885 |
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
... | beppec56/core | solenv/gdb/libreoffice/vcl.py | Python | gpl-3.0 | 3,155 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TopicSkeleton.description'
db.add_column(u'detective_topi... | jplusplus/detective.io | app/detective/migrations/0031_auto__add_field_topicskeleton_description.py | Python | lgpl-3.0 | 10,498 |
# Sketch - A Python-based interactive drawing program
# Copyright (C) 1996, 1997, 1998, 1999 by Bernhard Herzog
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of th... | shumik/skencil-c | Sketch/Graphics/layer.py | Python | gpl-2.0 | 10,895 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | akhilaananthram/nupic.research | sound_encoder/live_sound_encoding_demo.py | Python | gpl-3.0 | 2,476 |
# Copyright 2014 IBM Corp.
#
# 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 t... | rajalokan/keystone | keystone/tests/unit/test_v3_endpoint_policy.py | Python | apache-2.0 | 10,097 |
# 334-inceasing-triplet-subsequence.py
class Solution(object):
def increasingTriplet(self, nums):
"""
:type nums: List[int]
:rtype: bool
"""
if len(nums) < 3: return False
start = 0
minimal = nums[0]
bound = 0 # Second minimal (must after min... | daicang/Leetcode-solutions | 334-increasing-triplet-subsequence.py | Python | mit | 870 |
"""
spring2.py
The rk4_two() routine in this program does a two step integration using
an array method. The current x and xprime values are kept in a global
list named 'val'.
val[0] = current position; val[1] = current velocity
The results are compared with analytically calculated values.
"""
from pylab import *
d... | wavicles/pycode-browser | Code/Physics/spring2.py | Python | gpl-3.0 | 1,784 |
from __future__ import absolute_import
# #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 Gener... | Unode/ete | ete3/treeview/_open_newick.py | Python | gpl-3.0 | 2,521 |
from django.conf import settings
from django.contrib.auth.models import User
from rest_framework import authentication
from rest_framework import filters
from rest_framework import generics
from rest_framework import permissions
from rest_framework import viewsets
from user_api.serializers import UserSerializer, UserPr... | hkawasaki/kawasaki-aio8-1 | common/djangoapps/user_api/views.py | Python | agpl-3.0 | 2,257 |
# -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
#$HeadURL$
#$LastChangedDate$
#$LastChangedRevision$
import os
import sys
import re
from copy import copy
from types import *
from os.path import abspath, dirname, expanduser, join
import docutils.nodes
import reportlab
from reportlab.platypus import *
im... | openpolis/rst2pdf-patched-docutils-0.8 | rst2pdf/styles.py | Python | mit | 38,322 |
from pylearn2.models.mlp import MLP
class Autoencoder(MLP):
"""
An MLP whose output domain is the same as its input domain.
"""
def get_target_source(self):
return 'features'
| CKehl/pylearn2 | pylearn2/scripts/tutorials/convolutional_network/autoencoder.py | Python | bsd-3-clause | 201 |
from django.utils import timezone
from django.views import generic
from django.http import HttpResponse
from django.shortcuts import render
from events.models import Event
# home page
class IndexView(generic.ListView):
template_name = 'mysite/index.html'
def get_queryset(self):
return Event.objects... | cs98jrb/Trinity | mysite/mysite/views/index.py | Python | gpl-2.0 | 725 |
import unittest
from unittest.mock import MagicMock
import io
from snail import vlq
class TestVlq(unittest.TestCase):
def setup(self):
pass
def teardown(self):
pass
def test_read(self):
pass
def test_write(self):
pass
| sjzabel/snail | tests/test-vlq.py | Python | bsd-3-clause | 271 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# putfuncs - helpers for the put handler
# Copyright (C) 2003-2014 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... | heromod/migrid | mig/shared/putfuncs.py | Python | gpl-2.0 | 7,108 |
# coding: utf-8
import argparse
from PIL import Image
import qrcode
import os
import re
parser = argparse.ArgumentParser()
parser.add_argument('query', nargs='?', default=None)
args = parser.parse_args()
query = args.query.split('bound')[0]
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERRO... | wizyoung/workflows.kyoyue | ss.py | Python | mit | 552 |
# -*- coding: utf-8 -*-
__author__ = """Raghavendra Prabhu"""
__email__ = "me@rdprabhu.com"
__version__ = "0.1.2"
| ronin13/pyvolume | pyvolume/__init__.py | Python | mit | 115 |
# Copyright 2015 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 by applicable law or a... | YanTangZhai/tf | tensorflow/python/ops/gradients_test.py | Python | apache-2.0 | 13,357 |
"""
WSGI config for YaoGlobal project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | JasonYao/Yao-Global | YaoGlobal/wsgi.py | Python | gpl-2.0 | 395 |
#! /usr/bin/env python
import argparse
import operator
import os
import sys
from collections import namedtuple
from functools import lru_cache
from functools import reduce
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
import addict
import arrow
import googleapiclient.e... | ipwnponies/youtube-sort-playlist | playlist_updates.py | Python | unlicense | 13,622 |
# -*- coding: utf-8 -*-
from pyglet.graphics import OrderedGroup
from pyglet.gl import glPushMatrix, glPopMatrix, glScalef
from GestureAgentsDemo.Utils import DynamicValue
from GestureAgentsDemo.Render import basegroup
class ShellAppGroup(OrderedGroup):
"""docstring for ShellAppGroup"""
def __init__(self, ord... | chaosct/GestureAgents | Apps/DemoApp/DemoApp.py | Python | mit | 3,194 |
from blackjack.cmake.ScriptBase import ScriptBase
from blackjack.cmake.storage.SetList import SetList
from .cmake_set import cmake_set
class add_executable(ScriptBase):
"""
CMake Command - Add Executable Target
"""
def __init__(self, name: str, opts: str, srcs: []):
super().__init__()
... | grbd/GBD.Build.BlackJack | blackjack/cmake/cmd/add_executable.py | Python | apache-2.0 | 1,180 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | david-ragazzi/nupic | nupic/regions/ImageSensorFilters/Crop.py | Python | gpl-3.0 | 1,768 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Rackspace
#
# 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
#
# ... | rackerlabs/qonos | qonos/api/v1/workers.py | Python | apache-2.0 | 3,305 |
"""
conttest
--------
This task uses ``conttest`` to monitor a directory for changes and executes the specified
task everytime a change is made. The following configuration is supported::
config = {
'conttest': {
'task': 'registered_task',
'directory': './directory/to/monitor/'
... | abantos/bolt | bolt/tasks/bolt_conttest.py | Python | mit | 1,545 |
def fact_iter(n):
"""This function will find the Factorial of the given number by iterative
method. This function is coded in Pyhton 3.5."""
# check for integer
if not isinstance(n, int):
raise TypeError("Please only enter integer")
if n <= 0:
raise ValueError("Kindly Enter posi... | rvsingh011/NitK_Assignments | Sem1/Algorithm/Factorial_iter.py | Python | mit | 1,055 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.