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 |
|---|---|---|---|---|---|
# test for wasanbon/core/plugins/admin/idl_plugin/idl_parser/node.py
import unittest
from unittest.mock import Mock
from wasanbon.core.plugins.admin.idl_plugin.idl_parser import node
class TestPlugin(unittest.TestCase):
def test_init(self):
"""test for init"""
test_classname = 'test... | sugarsweetrobotics/wasanbon | test/test_admin_idl_plugin/test_idl_parser/test_node.py | Python | gpl-3.0 | 6,661 |
tile = [[0,1,4,5],
[2,3,6,7],
[8,9,12,13],
[10,11,14,15]]
shift = 0
align = 1
value = 0L
holder = []
import sys
basemask = [0x
fd = sys.stdout
indent = " "*9
for c in range(4):
fd.write(indent + "*pdst++ = \n");
for l,line in enumerate(tile):
fd.write(indent + " %s_mm_shuffle_epi8(line%d, (__m128i){"... | zcbenz/cefode-chromium | third_party/mesa/MesaLib/src/gallium/drivers/llvmpipe/lp_tile_shuffle_mask.py | Python | bsd-3-clause | 716 |
# Copyright (C) 2007 Canonical Ltd
#
# 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 ... | harsh-a1/repeater-testing | mapping.py | Python | gpl-2.0 | 3,000 |
import idautils
import idaapi
import idc
import socket
import select
# remote control for IDA using a text protocol
# by default listens on localhost:56789
# tested with IDA7.3, IDA7.4
# to stop, run 'idaremote.quit()' from within IDA
class IdaRemote:
sock = None
sock_client = None
ida_timer_delay = 50
... | jjyg/metasm | samples/ida/idaremote.py | Python | lgpl-2.1 | 14,647 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : DB Manager
Description : Database manager plugin for QGIS
Date : May 23, 2011
copyright : (C) 2011 by Giuseppe Sucameli
email : brush.tyler@... | medspx/dbmanager-cache | db_tree.py | Python | gpl-2.0 | 4,893 |
# Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import portage
from portage import os
from portage.const import CACHE_PATH, PROFILE_PATH
def _get_legacy_global(name):
constructed = portage._legacy_globals_constructed
if name in constructed:
return getattr(port... | funtoo/portage-funtoo | pym/portage/_legacy_globals.py | Python | gpl-2.0 | 2,254 |
# Python program to find whether a number is a palindrome or not
# Function to reverse a number
def reverse(num):
# Initialize variable
rev = 0
while ( num > 0 ) :
dig = num % 10
rev = rev * 10 + dig
num = num // 10
# Returning reversed number
return rev
# --- main... | jainaman224/Algo_Ds_Notes | Palindrome/palindrome_no.py | Python | gpl-3.0 | 690 |
#!/usr/bin/env python
import sys, json, os
# Traits stuff
from traits.api import HasTraits, Instance, Array, Bool, Dict, Range, \
Color, List, Int, Property, Any, Function, DelegatesTo, Str, Enum, \
on_trait_change, Button, Set, File, Int, Bool, cached_property
from traitsui.api import View, Item, VGroup, HGr... | mattcieslak/DSI2 | dsi2/ui/local_data_importer.py | Python | gpl-3.0 | 21,479 |
from module.plugins.Hoster import Hoster
from module.common.json_layer import json_loads
from module.network.HTTPRequest import BadHeader
class ReloadCc(Hoster):
__name__ = "ReloadCc"
__version__ = "0.5"
__type__ = "hoster"
__description__ = """Reload.Cc hoster plugin"""
# Since we want to allo... | Rusk85/pyload | module/plugins/hoster/ReloadCc.py | Python | gpl-3.0 | 4,866 |
from setuptools import setup
setup (
name='ujs-jsonvalidate',
version='0.1.0',
description='JSON validation utility',
long_description=open('README.rst').read(),
url='http://github.com/usingjsonschema/ujs-jsonvalidate-python',
author='Joe McIntyre',
author_email='j_h_mcintyre@yahoo.com',
... | usingjsonschema/ujs-jsonvalidate-python | setup.py | Python | mit | 1,154 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/operations/_virtual_hub_ip_configuration_operations.py | Python | mit | 22,118 |
# coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... | souravbadami/oppia | core/domain/state_domain_test.py | Python | apache-2.0 | 64,983 |
#!/usr/bin/env python
"""
Generic python script.
"""
__author__ = "Alex Drlica-Wagner"
import numpy as np
import ugali.analysis.results
def test_surface_brightness():
# Draco values from McConnachie et al. 2012
abs_mag = -8.8
app_mag = 10.6
distance = 76 #kpc
distance_modulus = 19.40
a_ha... | kadrlica/ugali | tests/test_results.py | Python | mit | 836 |
from django.conf.urls.defaults import url, patterns
from projects.constants import LANGUAGES_REGEX
from urls import urlpatterns as main_patterns
urlpatterns = patterns(
'', # base view, flake8 complains if it is on the previous line.
url((r'^projects/(?P<project_slug>[\w.-]+)/(?P<lang_slug>\w{2})/'
... | nyergler/pythonslides | readthedocs/core/subdomain_urls.py | Python | mit | 1,443 |
import asyncio as aio
import datetime
from collections import OrderedDict as ODict
from typing import Text
def test(s, cond, td):
# type: (Text, aio.Condition, datetime.timedelta) -> ODict
return ODict()
| smmribeiro/intellij-community | python/testData/refactoring/move/withImportedFunctionTypeComments/after/src/dst.py | Python | apache-2.0 | 214 |
from general_imports import *
from generic_functions import *
import views
def get_movies_by_age(request):
# Remove the last letter 's' from the year and convert to integer.
age_1 = int(request.GET['value'][:-1])
# add a range of 9 years so it completes the decade, ex. 199 8
age_2 = str(age_1 + 9)
movie_filter =... | otreblatercero/cinesnob | califas/ajax_functions.py | Python | gpl-2.0 | 1,641 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | ClearCorp-dev/odoo-clearcorp | TODO-9.0/budget/account.py | Python | agpl-3.0 | 28,048 |
# -*- encoding: utf-8 -*-
# back ported from CPython 3
# A. HISTORY OF THE SOFTWARE
# ==========================
#
# Python was created in the early 1990s by Guido van Rossum at Stichting
# Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
# as a successor of a language called ABC. Guido remains Py... | andrewor14/iolap | python/pyspark/heapq3.py | Python | apache-2.0 | 37,518 |
import sys
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from kaleo.models import InvitationStat
class Command(BaseCommand):
help = "Makes sure all users have a certain number of invites."
def handle(self, *args, **kwargs):
if len(args) == 0:
... | justhamade/kaleo | kaleo/management/commands/topoff_invites.py | Python | bsd-3-clause | 877 |
from django.core.management.base import BaseCommand, CommandError
from shipping.modules.tieredweight.models import Carrier as TWCarrier, Zone as TWZone, ZoneTranslation as TWZoneTranslation, WeightTier as TWWeightTier
from nogroth.models import *
class Command(BaseCommand):
help = 'Converts existing Tiered Weight ... | kevinharvey/satchmo-nogroth | nogroth/management/commands/satchmo_nogroth_copy_tiers.py | Python | mit | 1,282 |
# for localized messages
from . import _
from Screens.Screen import Screen
from enigma import eTimer
from boxbranding import getMachineBrand, getMachineName
from Screens.MessageBox import MessageBox
from Screens.Standby import TryQuitMainloop
from Components.ActionMap import ActionMap
from Components.Label import Labe... | popazerty/test-1 | lib/python/Plugins/Extensions/ExtrasPanel/MountManager.py | Python | gpl-2.0 | 20,177 |
# -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2012 Andrew Bettison <andrewb@zip.com.au> #
# Copyright 2012 Dima Kukushkin <dima@kukushkin.me> ... | danielecook/gist-alfred | github/Requester.py | Python | mit | 22,248 |
from enum import Enum
# ChessBoard Info
ChessBoardHeight = 10
ChessBoardWidth = 10
# Role Info
Roles = {'Human':0,'Computer':1,'Self_A':2,'Self_B':3, 'Eva_base':4, 'Eva_new':5}
# Chess Info
ChessInfo = {'Human':-1,'Computer':1,'Self_A':1,'Self_B':-1, 'Eva_base':1, 'Eva_new':-1}
# Victory Info
Victories = {'Human':... | longyangking/AlphaGomoku | alphagomoku/Config.py | Python | lgpl-2.1 | 401 |
"""empty message
Revision ID: 17fa4624585
Revises: 551ba562ce44
Create Date: 2015-03-11 00:03:19.301176
"""
# revision identifiers, used by Alembic.
revision = '17fa4624585'
down_revision = '551ba562ce44'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pl... | jglamine/phamdb | webphamerator/migrations/versions/17fa4624585_.py | Python | gpl-3.0 | 504 |
# *****************************************************************************
# Copyright (c) 2019 IBM Corporation and other Contributors.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution,... | ibm-watson-iot/iot-python | test/test_api_state_devices.py | Python | epl-1.0 | 13,924 |
"""
Module for three dimensional baroclinic solver
"""
from __future__ import absolute_import
from .utility import *
from . import shallowwater_eq
from . import momentum_eq
from . import tracer_eq
from . import turbulence
from . import coupled_timeintegrator
import thetis.limiter as limiter
import time as time_mod
impo... | tkarna/cofs | thetis/solver.py | Python | mit | 64,942 |
#!/usr/bin/env python
#
# vector3 and rotation matrix classes
# This follows the conventions in the ArduPilot code,
# and is essentially a python version of the AP_Math library
#
# Andrew Tridgell, March 2012
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser... | Yndal/ArduPilot-SensorPlatform | ardupilot/Tools/autotest/pysim/rotmat.py | Python | mit | 10,966 |
#
# ===============================================================
# Description: Test performance of dynamic repartitioning on
# clustering program.
#
# Created: 12/08/2013 01:09:08 PM
#
# Author: Ayush Dubey, dubey@cs.cornell.edu
#
# Copyright (C) 2013, Cornell University, s... | dubey/weaver | tests/python/benchmarks/clustering_migration.py | Python | bsd-3-clause | 3,266 |
"""
Complex example which is a combination of the rr* examples from the zguide.
"""
from gevent import spawn
from gevent_zeromq import zmq
# server
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.connect("tcp://localhost:5560")
def serve(socket):
while True:
message = socket.recv()
... | ContinuumIO/gevent-zeromq | examples/reqrep.py | Python | bsd-3-clause | 1,110 |
# -*- coding: latin -*-
NO_ARGS = "Contar o que a quem?"
SELF = "A falar contigo proprio?"
TARGET = "%s conta-te: %s"
MSG = "Tu contas a %s: %s"
NO_TARGET = "O '%s' nao esta' online."
HELP = """Uso: .tell <utilizador> <texto>\r
Envia o <texto> ao <utilizador> de forma privada."""
import src.messages
class Execute:
... | marado/pytalker | commands-pt/tell.py | Python | gpl-2.0 | 1,142 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
'''Unit tests for the rc_header formatter'''
# GRD samples exceed the 80 character limit.
# pylint: disable-msg=C6310
import os
i... | leighpauls/k2cro4 | tools/grit/grit/format/rc_header_unittest.py | Python | bsd-3-clause | 6,724 |
from typing import List
from bson import ObjectId
from common.common_consts import zero_trust_consts
from monkey_island.cc.models.zero_trust.event import Event
from monkey_island.cc.models.zero_trust.monkey_finding import MonkeyFinding
from monkey_island.cc.models.zero_trust.monkey_finding_details import MonkeyFindin... | guardicore/monkey | monkey/monkey_island/cc/services/zero_trust/monkey_findings/monkey_zt_finding_service.py | Python | gpl-3.0 | 2,388 |
# -*- coding: utf-8 -*-
# This file is part of pygal
#
# A python svg graph plotting library
# Copyright © 2012-2014 Kozea
#
# 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... | colevscode/pygal | pygal/graph/funnel.py | Python | lgpl-3.0 | 3,592 |
#!/usr/bin/python
# Copyright: (c) 2018, Pluribus Networks
# 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',
'status': ['... | alxgu/ansible | lib/ansible/modules/network/netvisor/pn_switch_setup.py | Python | gpl-3.0 | 13,294 |
#!/usr/bin/env python
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_numbers('../data/fm_train_real.dat')
testdat = lm.load_numbers('../data/fm_test_real.dat')
parameter_list = [[traindat,testdat,1.4,10],[traindat,testdat,1.5,10]]
def preprocessor_normone (fm_train_real=traindat,fm_test_real=te... | sorig/shogun | examples/undocumented/python/preprocessor_normone.py | Python | bsd-3-clause | 978 |
#!/usr/bin/env python
import base64
import os
from avocado import Test
from avocado import main
class WhiteBoard(Test):
"""
Simple test that saves test custom data to the test whiteboard
:param whiteboard_data_file: File to be used as source for whiteboard data
:param whiteboard_data_size: Size of... | thomas-schmid-ubnt/avocado | examples/tests/whiteboard.py | Python | gpl-2.0 | 1,449 |
import _plotly_utils.basevalidators
class TextsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="textsrc", parent_name="volume", **kwargs):
super(TextsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
ed... | plotly/python-api | packages/python/plotly/plotly/validators/volume/_textsrc.py | Python | mit | 437 |
import os
import api_user
import re
from logger import Logger
ADDRESSVERSIONS = (3,4)
class BMAMaster:
def __init__(self, configPath=None, apiUser=None):
self.config = loadConfig(configPath)
if 'runPath' in self.config:
os.chdir(self.config['runPath'])
logPath = self.config['lo... | Eylrid/BMaggregator | bmamaster.py | Python | mit | 3,582 |
# -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... | hclivess/Stallion | nuitka/Cryptodome/Util/__init__.py | Python | gpl-3.0 | 1,951 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import argparse
try:
from html import unescape # py3.4+
except ImportError:
from six.moves.html_parser import HTMLParser
unescape = HTMLParser().unescape
import os
import re
import subprocess
import sys
i... | btnpushnmunky/pelican | pelican/tools/pelican_import.py | Python | agpl-3.0 | 33,232 |
# gcompris - mining.py
#
# Copyright (C) 2012 Peter Albrecht
# based on template by Bruno Coudoin
#
# 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
#... | keshashah/GCompris | src/mining-activity/mining.py | Python | gpl-2.0 | 38,746 |
import os
from celery import Celery
from django.conf import settings
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dojo.settings.settings')
app = Celery('dojo')
# Using a string here means the worker will not have to
# pickle the object when usin... | OWASP/django-DefectDojo | dojo/celery.py | Python | bsd-3-clause | 551 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#... | MDAnalysis/mdanalysis | testsuite/MDAnalysisTests/analysis/test_diffusionmap.py | Python | gpl-2.0 | 3,663 |
#!/usr/bin/env python
# coding=utf-8
"""559. Permuted Matrices
https://projecteuler.net/problem=559
An **ascent** of a column j in a matrix occurs if the value of column j is
smaller than the value of column j+1 in all rows.
Let P(k, r, n) be the number of r x n matrices with the following properties:
* The rows... | openqt/algorithms | projecteuler/pe559-permuted-matrices.py | Python | gpl-3.0 | 754 |
#!/usr/bin/python
import sys
import urllib2
import csv
import re
import time
import traceback
from bs4 import BeautifulSoup
from difflib import SequenceMatcher
#################### Importing Liraries ########################
if ( len(sys.argv) != 3 ) :
print "Only 2 arguments are allowed"
quit()
if ( sys.ar... | charlie1404/gopalhtmlparser | igiworld.py | Python | unlicense | 4,906 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | benfinke/ns_python | nssrc/com/citrix/netscaler/nitro/resource/config/cs/csvserver_cspolicy_binding.py | Python | apache-2.0 | 10,784 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import throw, _
import frappe.defaults
from frappe.utils import cint, flt, get_fullname, cstr
from erpnext.utilities.doctype.a... | hatwar/buyback-erpnext | erpnext/shopping_cart/cart.py | Python | agpl-3.0 | 12,077 |
#!/usr/bin/env python
#
# Copyright (c) 2017, 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
# notic... | librasungirl/openthread | tools/harness-automation/autothreadharness/rf_shield_controller.py | Python | bsd-3-clause | 3,315 |
"""
This file is about errors in Python files and not about exception handling in
Jedi.
"""
def parso_to_jedi_errors(grammar, module_node):
return [SyntaxError(e) for e in grammar.iter_errors(module_node)]
class SyntaxError:
"""
Syntax errors are generated by :meth:`.Script.get_syntax_errors`.
"""
... | snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/jedi_deps/jedi/jedi/api/errors.py | Python | gpl-3.0 | 1,253 |
# python library for gridding, degridding, autocalibrated sensitivity map, and CG SENSE in 2D
#
# Code modified based on code from Nick Zwart at BNI
# author: Mike Schar
import numpy as np
def window2(shape, windowpct=100.0, widthpct=100.0, stopVal=0, passVal=1):
# 2D hanning window just like shapes
# OUTPU... | gpilab/bni-nodes | gridding/Kaiser2D_utils.py | Python | bsd-3-clause | 6,648 |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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.
CVXPY is distributed i... | mwytock/cvxpy | cvxpy/performance_tests/test_robustness.py | Python | gpl-3.0 | 3,392 |
# The contents of this file are subject to the Mozilla Public License
# (MPL) Version 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/lepl/_example/performance.py | Python | agpl-3.0 | 4,295 |
# -*- coding: utf-8 -*-
#
# aBRI documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 30 13:24:06 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable... | pyspace/test | docs/conf.py | Python | gpl-3.0 | 22,175 |
from base import *
SERVER = "redir_paths_1"
MAGIC = 'Reproducing bug report #432'
CONF = """
vserver!2270!nick = %s
vserver!2270!document_root = %s
vserver!2270!rule!1!match = default
vserver!2270!rule!1!handler = file
vserver!2270!rule!10!match = request
vserver!2270!rule!10!match!request = file.*
vserver!2270!... | lmcro/webserver | qa/227-Redir-Paths.py | Python | gpl-2.0 | 1,107 |
from unittest import TestCase
from nose.tools import assert_equal, assert_raises
from pycassa.logging.pool_stats_logger import StatsLogger
from pycassa.pool import ConnectionPool, NoConnectionAvailable, InvalidRequestError
__author__ = 'gilles'
_credentials = {'username': 'jsmith', 'password': 'havebadpass'}
class ... | pycassa/pycassa | tests/test_pool_logger.py | Python | mit | 4,992 |
# Eloipool - Python Bitcoin pool server
# Copyright (C) 2011-2012 Luke Dashjr <luke-jr+eloipool@utopios.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# L... | FinalHashLLC/eloipool | lib/interactivemode.py | Python | agpl-3.0 | 1,385 |
#!/usr/bin/python
# This program will find the coefficients in an energy expansion of a
# probability vector
import sys # Mainly for file IO
from math import *
from array import * #For fast arrays
def readPVector (filename):
""" reads a probability vector from the file given in filename"""
try:
f = o... | tom111/cipi | src/product_coefficients.py | Python | gpl-3.0 | 2,798 |
import os
import errno
import itertools
from datetime import datetime
from django.conf import settings
from django.core.exceptions import SuspiciousFileOperation
from django.core.files import locks, File
from django.core.files.move import file_move_safe
from django.utils.encoding import force_text, filepath_to_uri
fro... | adambrenecki/django | django/core/files/storage.py | Python | bsd-3-clause | 10,943 |
import pygration
@pygration.step_class
class AccountTable(object):
"""Creates an account table."""
def add( self, db ):
db.sql("CREATE TABLE account (id integer, balance integer);")
| mdg/pygrate | test/test1/v002.py | Python | apache-2.0 | 202 |
API_XML_NSMAP = {
"csw": "http://www.opengis.net/cat/csw/2.0.2",
"dc": "http://purl.org/dc/elements/1.1/",
"dct": "http://purl.org/dc/terms/",
"geonet": "http://www.fao.org/geonetwork",
"xsi": "http://www.w3.org/2001/XMLSchema-instance",
}
LINKED_XML_NSMAP = {
"csw": "http://www.opengis.net/cat... | opendatatrentino/opendata-harvester | harvester_odt/pat_geocatalogo/constants.py | Python | bsd-2-clause | 669 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
from ....util import Stub, StubProxy
from testing_tools.adapter.errors import UnsupportedCommandError
from testing_tools.adapter.pytest._cli import add_subparser
class StubSubparsers(StubProxy):
def __i... | DonJayamanne/pythonVSCode | pythonFiles/tests/testing_tools/adapter/pytest/test_cli.py | Python | mit | 1,960 |
#!/usr/bin/python
import os, sys
from optparse import OptionParser
from subprocess import *
import shutil
def parseArgs():
parser = OptionParser()
parser.add_option("-e", "--elf-file", dest="elf_file",
help="elf file to extract", metavar="ELF")
parser.add_option("-o", "--objdump", d... | danceos/dosek | fail/mapper.py | Python | lgpl-3.0 | 1,641 |
"""
Python bindings to odesk API
python-odesk version 0.1
(C) 2010 oDesk
"""
import odesk
PUBLIC_KEY = None
SECRET_KEY = None
#TODO: Desktop app example (check if it's working at all - wasn't last time)
def web_based_app(public_key, secret_key):
print "Emulating web-based app"
#Instantiating a client withou... | solex/python-odesk | examples/examples.py | Python | bsd-3-clause | 2,045 |
# Generated by Django 2.2.13 on 2021-03-29 13:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("klasses", "0024_add_bootcamp_run_id")]
operations = [
migrations.AddField(
model_name="bootcamprun",
name="allows_skipped_steps"... | mitodl/bootcamp-ecommerce | klasses/migrations/0025_bootcamprun_allows_skipped_steps.py | Python | bsd-3-clause | 392 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://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 co... | sailfish-sdk/sailfish-qtcreator | tests/system/suite_editors/tst_generic_highlighter/test.py | Python | gpl-3.0 | 12,463 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Provides the is_empty() method."""
def get_member_count(my_sequence):
"""Returns the number of members of a list object.
Args:
my_sequence (sequence): The sequence object being measured.
Returns:
mixed: If the object can be measured it ret... | eliz79/is210-week-03-synthesizing | task_05.py | Python | mpl-2.0 | 1,491 |
#!/usr/bin/env python
'''
The entry point of this module is parse_args() method which calls
other methods to collect user supplied arguments, parses and
verifies them. Description of these methods are the following:
collect_args: This method collects the user supplied arguments and
returns... | arkatebi/SwissProt-stats | ArgParser_xTract_trainingSet.py | Python | gpl-3.0 | 4,101 |
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This program is distributed in... | estaban/pyload | module/plugins/hooks/XMPPInterface.py | Python | gpl-3.0 | 8,389 |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def isBalanced(self, root: TreeNode) -> bool:
def dfs(root):
if root is None:
return (True, 0)
lb, ... | jiadaizhao/LeetCode | 0101-0200/0110-Balanced Binary Tree/0110-Balanced Binary Tree.py | Python | mit | 493 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from distutils.version import LooseVersion
from cms.admin.change_list import CMSChangeList
from cms.admin.forms import PageForm, AdvancedSettingsForm
from cms.admin.pageadmin import PageAdmin
from cms.admin.permissionadmin import PagePermissionInlineAdmin
fr... | 11craft/django-cms | cms/tests/admin.py | Python | bsd-3-clause | 47,111 |
from other import setup
exec('x/_version.py')
setup(
name='x',
version=__version__
)
| github/codeql | python/ql/test/query-tests/Variables/undefined/uses_exec.py | Python | mit | 99 |
#!/usr/bin/python
import sys, argparse, re, gzip
from subprocess import Popen, PIPE
from Bio.Format.Sam import SAM
def main():
parser = argparse.ArgumentParser(description="",formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('input',help="Use BAM or - for SAM STDIN")
parser.add_argument... | jason-weirather/Au-public | iron/utilities/bam_to_bed_exons.py | Python | apache-2.0 | 964 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/effective_network_security_group_list_result_py3.py | Python | mit | 1,288 |
#!/usr/bin/env python
"""This script solves the Project Euler problem "Even Fibonacci numbers". The
problem is: By considering the terms in the Fibonacci sequence whose values do
not exceed four million, find the sum of the even-valued terms.
"""
def main():
"""Even Fibonacci numbers"""
# Constants
MAX_... | iansealy/projecteuler | optimal/2.py | Python | gpl-3.0 | 578 |
#! /usr/bin/env python3
"""
This file is used to setup and maintain a connection with an IRC server.
"""
import traceback
import socket
import random
import time
import sys
# as the file is loaded separately, the imports have to be adjusted.
sys.path.append('./PlebNet')
from plebnet.agent.qtable import QTable
from ... | rjwvandenberg/PlebNet | plebnet/communication/irc/ircbot.py | Python | lgpl-3.0 | 10,976 |
"""
The GeoDjango GEOS module. Please consult the GeoDjango documentation
for more details: https://docs.djangoproject.com/en/dev/ref/contrib/gis/geos/
"""
from .collections import ( # NOQA
GeometryCollection, MultiLineString, MultiPoint, MultiPolygon,
)
from .error import GEOSException # NOQA
from .fact... | yephper/django | django/contrib/gis/geos/__init__.py | Python | bsd-3-clause | 791 |
'''
Harvester for the eScholarship@UMMS for the SHARE project
Example API call: http://escholarship.umassmed.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class UmassmedHarvester(OAIHarvester):
short_name = 'umassmed'
long... | erinspace/scrapi | scrapi/harvesters/umassmed.py | Python | apache-2.0 | 578 |
# Copyright (C) 2014 Andreas M. Weller <andreas.m.weller@gmail.com>
import os
def unite(output, target_folder = "./"):
files = [x for x in os.listdir(target_folder) if x.endswith("_coverage.csv")]
with open(target_folder + output, "w") as out:
for filename in files:
sample = filename[:-13]
with open(ta... | aweller/CoverageCheck | unite_coverage_files.py | Python | bsd-3-clause | 791 |
# This file is part of Medieer.
#
# Medieer 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.
#
# Medieer is distri... | toddself/Medieer | src/lib/tvdb.py | Python | gpl-3.0 | 1,094 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ppries/tensorflow | tensorflow/contrib/losses/python/losses/loss_ops.py | Python | apache-2.0 | 30,744 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('pacientes', '0012_auto_20150505_2053'),
]
operations = [
migrations.AlterField(
model_name='paci... | btenaglia/hpc-historias-clinicas | hpc-historias-clinicas/pacientes/migrations/0013_auto_20150506_0117.py | Python | bsd-3-clause | 874 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Moritz Luca Schmid, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT).
#
# 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 Softwa... | andrmuel/gr-dab | python/qa_dabplus_audio_decoder_ff.py | Python | gpl-3.0 | 3,065 |
# Zed Attack Proxy (ZAP) and its related class files.
#
# ZAP is an HTTP/HTTPS proxy for assessing web application security.
#
# Copyright 2016 the ZAP development team
#
# 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... | Woolworths/zap-api-python | src/zapv2/authorization.py | Python | apache-2.0 | 2,284 |
# (c) 2012-2014, 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
# (at your option) an... | azaghal/ansible | lib/ansible/plugins/action/fetch.py | Python | gpl-3.0 | 9,755 |
"""
Testing for the forest module (sklearn.ensemble.forest).
"""
# Authors: Gilles Louppe, Brian Holt
# License: BSD 3
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_equal
from numpy.testing import assert_almost_equa... | cdegroc/scikit-learn | sklearn/ensemble/tests/test_forest.py | Python | bsd-3-clause | 10,632 |
from pathlib import Path
def parse_args():
import argparse #perfectly acceptable to do the import in the function
epilog = 'message displayed at the end of the help message'
parser = argparse.ArgumentParser(epilog=epilog)
parser.add_argument('-s', '--string', dest='string', type=str, help='arg takes a ... | JesseAChristensen/linuxprofile | python/arg_parsing.py | Python | gpl-3.0 | 2,023 |
from . import BitmovinError
class InvalidTypeError(BitmovinError):
pass
| bitmovin/bitmovin-python | bitmovin/errors/invalid_type_error.py | Python | unlicense | 78 |
"""
run py.test
""" | joshmorel/datacompare | datacompare/example.py | Python | mit | 21 |
from dolfin import *
from math import exp, sqrt, pi
import sw_lib
params=sw_lib.parameters({
'depth' : 2.,
'g' : 9.81,
'f' : 0.0,
'dump_period' : 1,
'eta0' : 2 # Wave height
})
# Basin radius.
basin_x=3000 # The length of the basin
basin_y=1000 # The width of the basin
nx=20 # Number of cell... | ellipsis14/dolfin-adjoint | tests_dolfin/shallow_water_time_functional/divett.py | Python | lgpl-3.0 | 1,694 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010 by Joel Andersson, Moritz Diehl, K.U.Leuven. All rights reserved.
#
# CasADi is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Pub... | jgillis/casadi | test/python/sdp.py | Python | lgpl-3.0 | 12,021 |
# 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)
from spack import *
class RSquarem(RPackage):
"""Algorithms for accelerating the convergence of slow, monotone seque... | iulian787/spack | var/spack/repos/builtin/packages/r-squarem/package.py | Python | lgpl-2.1 | 1,065 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import shutil
import sys
from contextlib import contextmanager
from pathlib import Path, PurePath
from textwrap import dedent
from typing import Dict, Iterable, Optional
import ... | patricklaw/pants | tests/python/pants_test/init/test_plugin_resolver.py | Python | apache-2.0 | 10,358 |
import json,httplib
import sys
config_data = json.load(open('conf/net/ext_service/parse.json'))
interval = "interval_%s" % sys.argv[1]
print "pushing for interval %s" % interval
silent_push_msg = {
"channels": [
interval
],
"data": {
# "alert": "The Mets scored! The game is now tied 1-1.",
"c... | yw374cornell/e-mission-server | bin/remotePush.py | Python | bsd-3-clause | 772 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
if PY3:
import urllib.parse as urlparse # Es muy lento en PY2. En PY3 es nativo
else:
import... | alfa-addon/addon | plugin.video.alfa/channels/pelisencastellano.py | Python | gpl-3.0 | 6,956 |
#
# 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... | airbnb/airflow | airflow/api/common/experimental/trigger_dag.py | Python | apache-2.0 | 4,451 |
# Copyright 2017 SrMouraSilva
#
# 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,... | PedalPi/PluginsManager | pluginsmanager/model/port.py | Python | apache-2.0 | 2,161 |
#!/usr/bin/env python
import argparse
import mirheo as mir
import numpy as np
import os
import pandas as pd
parser = argparse.ArgumentParser()
parser.add_argument('--out', type=str, required=True)
args = parser.parse_args()
dt = 0.001
ranks = (1, 1, 1)
domain = (32, 32, 32)
tdump_every = 0.001
dump_every = int(tdu... | dimaleks/uDeviceX | tests/stress/pressure.py | Python | gpl-3.0 | 1,475 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
riko.currencies
~~~~~~~~~~~~~~~
Provides currency lookup dictionaries
Attributes:
CURRENCY_SYMBOLS (dict): Currency symbol to code mapping
CURRENCY_CODES (dict): Currency symbol to info mapping
"""
CURRENCY_SYMBOLS = {
'$': 'USD', '£': 'GBP', '€': 'EU... | nerevu/riko | riko/currencies.py | Python | mit | 30,514 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger("scheduler")
from precious import models
from precious.worker import ProjectManagment
def check_remote_git_revision():
logger.info("Checking project remote revision")
for project in models.Project.query.all():
p... | bzyx/precious | precious/sheduler/tasks.py | Python | bsd-3-clause | 943 |
# -*- coding: utf-8 -*-
# Tested on Markdown 2.3.1
#
# Copyright (c) 2014, Esteban Castro Borsani
# Copyright (c) 2014, Jesús Espino García
# The 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... | CoolCloud/taiga-back | taiga/mdrender/extensions/emojify.py | Python | agpl-3.0 | 14,195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.