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 |
|---|---|---|---|---|---|
# vi: syntax=python:et:ts=4
from glob import glob
from os.path import join
def backup_env(env, vars):
backup = dict()
for var in vars:
backup[var] = env.get(var, [])
return backup
def restore_env(env, backup):
for var in backup.keys():
env[var] = backup[var]
def find_include(prefixes,... | drunklurker/wesnoth | scons/config_check_utils.py | Python | gpl-2.0 | 743 |
# encoding: utf-8
from __future__ import absolute_import, division, print_function
import sys
import textwrap
from _pytest.compat import MODULE_NOT_FOUND_ERROR
from _pytest.doctest import DoctestItem, DoctestModule, DoctestTextfile
import pytest
class TestDoctests(object):
def test_collect_testtextfile(self, test... | ddboline/pytest | testing/test_doctest.py | Python | mit | 35,798 |
"""Test utilities for writing foreman tests
All test cases for foreman tests are defined in this module and have utilities
to help writting API, CLI and UI tests.
"""
import logging
import os
import signal
import sys
try:
import unittest
except ImportError:
import unittest2 as unittest
from automation_tools ... | apagac/robottelo | robottelo/test.py | Python | gpl-3.0 | 12,098 |
while True:
str_input = raw_input('input a year: ')
if str_input.isdigit() == False:
print "please input a year."
else:
year = int(str_input)
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
# print "%d is a leap year." % year
... | seerjk/reboot06 | 01/exec07-01.py | Python | mit | 618 |
#!/usr/bin/python
#
# 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 b... | coxmediagroup/googleads-python-lib | examples/adwords/v201502/targeting/get_targetable_languages_and_carriers.py | Python | apache-2.0 | 1,969 |
from subprocess import Popen, PIPE
from compressor.conf import settings
from compressor.filters import FilterBase, FilterError
from compressor.utils import cmd_split
class ClosureCompilerFilter(FilterBase):
def output(self, **kwargs):
arguments = settings.CLOSURE_COMPILER_ARGUMENTS
command = '%... | bancek/egradebook | src/lib/compressor/filters/closure.py | Python | gpl-3.0 | 809 |
# Copyright 2007 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
import re
import inspect
import pydoc
import gtk
from... | rschroll/reinteract | lib/reinteract/data_format.py | Python | bsd-2-clause | 10,284 |
# -*- coding: utf-8 -*-
# Copyright 2016 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import partner_risk_adjustment
from . import res_partner
from . import res_company
| open-synergy/opnsynid-partner-contact | partner_financial_risk_adjustment/models/__init__.py | Python | agpl-3.0 | 218 |
import os
import fnmatch
import pickle
import shutil
import errno
from gppylib.commands.base import Command, REMOTE
from gppylib.operations import Operation
from gppylib.operations.utils import RemoteOperation
# TODO: Improve RawRemoteOperation
"""
Requirements:
1. Clean Code: Remove python -c "lots of inline stuff".... | hornn/interviews | tools/bin/gppylib/operations/unix.py | Python | apache-2.0 | 6,133 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2007 Søren Roug, European Environment Agency
#
# This is free software. You may redistribute it under the terms
# of the Apache license and the GNU General Public License Version
# 2 or at your option any later version.
#
# This program is distributed in th... | cloudera/hue | desktop/core/ext-py/odfpy-1.4.1/tests/testdrawelement.py | Python | apache-2.0 | 2,623 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
# Based on https://groups.google.com/d/topic/sqlalchemy/cQ9e9IVOykE/discussion
# By David Gardner (dgardne... | DirkHoffmann/indico | indico/core/db/sqlalchemy/custom/static_array.py | Python | gpl-3.0 | 2,389 |
'''
Created on Jun 29, 2016
@author: Thomas Adriaan Hellinger
'''
import pytest
from roodestem.voting_systems.voting_system import Result
class TestResult:
def test_null_result_not_tolerated(self):
with pytest.raises(TypeError):
Result()
def test_passed_multiple_winners(self):
... | brotherjack/RoodeStem | tests/test_voting_systems.py | Python | mit | 709 |
# "magictoken" is used for markers as beginning and ending of example text.
import unittest
from numba.tests.support import captured_stdout
class DocsLiterallyUsageTest(unittest.TestCase):
def test_literally_usage(self):
with captured_stdout():
# magictoken.ex_literally_usage.begin
... | sklam/numba | numba/tests/doc_examples/test_literally_usage.py | Python | bsd-2-clause | 1,625 |
'''
The purpose of this 'test' is not exactly to 'do' anything, but
rather it mashes the buttons and switches in various completely
random ways to try and find any possible control situations and
such that would probably never *normally* come up, but.. well,
given a bit of bad luck, could totally ... | frc1418/2014 | robot/robot/tests/fuzz_test.py | Python | bsd-3-clause | 3,574 |
# -*- coding: utf-8 -*-
from django.db import models, connection
class HostList_yz1(models.Model):
ip = models.CharField(max_length=20, verbose_name=u'IP地址')
hostname = models.CharField(max_length=30, verbose_name=u'主机名')
product = models.CharField(max_length=20, verbose_name=u'产品')
application = model... | luojianlong19880709/oms-master | asset/models.py | Python | gpl-2.0 | 5,497 |
# -*- coding: utf-8 -*-
# 建立大小为n的heap 以第i个元素为根
def build_max_heap(arr, n, i):
l = i * 2 + 1
r = i * 2 + 2
largest = i
if l < n and arr[largest] < arr[l]:
largest = l
if r < n and arr[largest] < arr[r]:
largest = r
if largest != i:
arr[largest], arr[i] = arr[i], arr... | sonymoon/algorithm | src/main/python/geeksforgeeks/search-sorting/max-binary-heap-sort.py | Python | apache-2.0 | 793 |
import wx
from Command import Command
class SaveAllDocumentsCommand(Command):
"""Saves all opened documents."""
caption = "Save all files"
tooltip = "Save all files"
toolbarimage = "document-save"
def Execute(self):
application = wx.GetApp()
# Get the registry of documents. This class holds a... | nsmoooose/csp | csp/tools/layout2/scripts/ui/commands/SaveAllDocumentsCommand.py | Python | gpl-2.0 | 807 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-23 15:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_ca', '0001_initial'),
]
operations = [
migrations.AlterField(
... | fsinf/certificate-authority | ca/django_ca/migrations/0002_auto_20151223_1508.py | Python | gpl-3.0 | 1,224 |
from conans.client.output import Color
from conans.model.ref import PackageReference
from conans.model.ref import ConanFileReference
from collections import OrderedDict
class Printer(object):
""" Print some specific information """
INDENT_COLOR = {0: Color.BRIGHT_CYAN,
1: Color.BRIGHT_RED... | AversivePlusPlus/AversivePlusPlus | tools/conan/conans/client/printer.py | Python | bsd-3-clause | 8,887 |
import sys
sys.path.append('..')
import unittest
from sorting.InsertionSort import InsertionSort
class TestInsertionSort(unittest.TestCase):
def setUp(self):
self.to_sort = [3, 4, 1, 2]
def testing_sort(self):
insertion_sort = InsertionSort(self.to_sort)
self.assertEqual(inserti... | luisalves05/dsa-python | test/insertion_test.py | Python | mit | 406 |
# coding: utf-8
# Copyright 2016 Thomas Schatz, Xuan-Nga Cao, Mathieu Bernard
#
# This file is part of abkhazia: 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 v... | bootphon/abkhazia | abkhazia/corpus/prepare/aic_preparator.py | Python | gpl-3.0 | 7,851 |
########################################################################
# $HeadURL$
# Author : Andrei Tsaregorodtsev
########################################################################
"""
Utilities for managing DIRAC configuration:
getCEsFromCS
getUnusedGridCEs
getUnusedGridSEs
getSiteUpdates
get... | calancha/DIRAC | ConfigurationSystem/Client/Utilities.py | Python | gpl-3.0 | 16,712 |
from monadic.functor_def import functor_law_identity, functor_law_compose
from monadic.functor_def import add1, add2
from monadic.monad_def import monad_law_one, monad_law_two, monad_law_three
from monadic.monad.maybe import maybe_monad, nothing, just
test_data = [
nothing,
just(nothing),
just(just(nothin... | andorp/monadic | test/monad/test_maybe.py | Python | lgpl-3.0 | 1,006 |
class MinStack:
# @param x, an integer
def __init__(self):
self.stack = []
self.min_stack = []
# @return an integer
def push(self, x):
self.stack.append(x)
if len(self.min_stack) == 0 or self.min_stack[-1] >= x:
self.min_stack.append(x)
... | Chasego/cod | leetcode/155-Min-Stack/MinStack_001.py | Python | mit | 654 |
## Importing helper class for setting up a reachability planning problem
from hpp.corbaserver.rbprm.rbprmbuilder import Builder
# Importing Gepetto viewer helper class
from hpp.gepetto import Viewer
import time
import math
import omniORB.any
from planning.configs.walk_bauzil_stairs import *
from hpp.corbaserver impor... | pFernbach/hpp-rbprm-corba | script/scenarios/sandbox/dynamic/walkBauzil_hrp2_pathKino.py | Python | lgpl-3.0 | 7,125 |
import numpy as np
import math
import copy
import json
from domain import * # Task environments
from utils import *
from .nsga_sort import nsga_sort
from .neat import Neat
class Wann(Neat):
"""NEAT main class. Evolves population given fitness values of individuals.
"""
def __init__(self, hyp):
"""Intializ... | google/brain-tokyo-workshop | WANNRelease/prettyNeatWann/neat_src/wann.py | Python | apache-2.0 | 2,038 |
"""
WSGI config for todo_project project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... | linhyo/todo | todo_project/todo_project/wsgi.py | Python | mit | 1,572 |
def has_no_e(word):
if word.find('e') == -1:
return True
def count_lines(filename):
num_lines = sum(1 for line in open(filename))
return num_lines
def has_no_e_list(wordlist):
count = 0
words = open(wordlist)
for line in words:
word = line.strip()
if has_no_e(word) == True:
print(word)
count += 1
t... | alexjj/learning_python | think_python/has_no_e.py | Python | mit | 574 |
# Copyright 2014 Big Switch Networks, 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 ... | projectcalico/calico-neutron | neutron/tests/unit/bigswitch/test_servermanager.py | Python | apache-2.0 | 30,488 |
#!/usr/bin/env python
#
# Copyright 2012 the V8 project 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:
#
# * Redistributions of source code must retain the above copyright
# noti... | sgraham/nope | v8/tools/run-tests.py | Python | bsd-3-clause | 23,862 |
# -*- coding: utf-8 -*-
import scrapy
from scrapy.selector import Selector
from scrapy.loader import ItemLoader
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import exp... | hbbhbbh/TmallSingleCrawler | TmallSingleCrawler/spiders/tmall.py | Python | mit | 11,888 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | lucienfostier/gaffer | python/GafferTest/UndoTest.py | Python | bsd-3-clause | 5,821 |
#encoding: utf-8
import curses
import weakref
from .widget import Widget
class Container(Widget):
"""
"""
def __init__(self,
workspace,
parent,
*args,
**kwargs):
super(Container, self).__init__(workspace,
... | SavinaRoja/gruepy | gruepy/oldcontainer.py | Python | gpl-3.0 | 3,039 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hs_geo_raster_resource', 'custom_migration_for_tif_to_vrt_20160223'),
]
operations = [
migrations.RemoveField(
model_name='cellinformation',
... | hydroshare/hydroshare | hs_geo_raster_resource/migrations/0005_auto_20160509_2116.py | Python | bsd-3-clause | 880 |
from django.db import models, transaction
from django.db.models import Count
from django.urls import reverse
import world.templatetags
from messaging import shortcuts
class PositionElection(models.Model):
position = models.ForeignKey('Organization', models.CASCADE)
turn = models.IntegerField()
closed = m... | jardiacaj/finem_imperii | organization/models/election.py | Python | agpl-3.0 | 3,562 |
import rospy
# The map is represented by a rectangle from (x1,y1) to (x2,y2)
mapX1 = rospy.get_param('/map_x1', -5.0)
mapX2 = rospy.get_param('/map_x2', 5.0)
mapY1 = rospy.get_param('/map_y1', -5.0)
mapY2 = rospy.get_param('/map_y2', 5.0)
#Map size
mapLX = mapX2 - mapX1
mapLY = mapY2 - mapY1
# Grid size
gn = rospy.g... | dsaldana/roomba_sensor_network | roomba_sensor/src/roomba_sensor/params/map.py | Python | gpl-3.0 | 471 |
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ... | anthonysandrin/kafka-utils | tests/kafka_cluster_manager/partition_count_balancer_test.py | Python | apache-2.0 | 26,033 |
# This script calculates how many error reports are in each subdirectory
# and how many error reports are in total.
# Edit in_dir and out_file parameters as you need.
import os
in_dir = "D:/Projects/CrashRpt/valid_reports"
out_file = "stats.txt"
f = open(out_file, "w")
def get_txt_file_count(dirname):
count = 0... | BeamNG/crashrpt | processing/scripts/basic_stats.py | Python | bsd-3-clause | 1,335 |
import sqlite3
import directORM
class Proveedor:
def __init__(self):
self.idProveedor = -1
self.nombre = ''
self.email = ''
self.tlf_fijo = ''
self.tlf_movil = ''
self.tlf_fijo2 = ''
self.tlf_movil2 = ''
self.banco = ''
self.cuenta_bancaria ... | arkadoel/directORM | python/salida/directORM/forProveedores.py | Python | gpl-2.0 | 3,696 |
../../../../../../share/pyshared/twisted/internet/test/test_protocol.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/twisted/internet/test/test_protocol.py | Python | gpl-3.0 | 71 |
# Copyright (c) 2015-2017 Cisco Systems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | retr0h/molecule | molecule/command/check.py | Python | mit | 2,722 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.tests import opus_unittest
from opus_core.datasets.dataset import Dataset
from opus_core.datasets.dataset_pool import DatasetPool
from opus... | apdjustino/DRCOG_Urbansim | src/opus_core/variables/expression_tests/aggregate_disaggregate_expression.py | Python | agpl-3.0 | 22,844 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
... | RickMohr/nyc-trees | src/nyc_trees/nyc_trees/urls.py | Python | apache-2.0 | 1,061 |
# coding=utf-8
# Copyright (c) 2016-2018, 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 applicabl... | F5Networks/f5-openstack-agent | test/functional/neutronless/testlib/fake_rpc.py | Python | apache-2.0 | 7,323 |
"""Support for WeMo switches."""
import asyncio
import logging
from datetime import datetime, timedelta
import requests
import async_timeout
from homeassistant.components.switch import SwitchDevice
from homeassistant.exceptions import PlatformNotReady
from homeassistant.util import convert
from homeassistant.const im... | MartinHjelmare/home-assistant | homeassistant/components/wemo/switch.py | Python | apache-2.0 | 8,674 |
"""
@name: PyHouse/src/Modules/Computer/Web/_test/test_web_schedules.py
@author: D. Brian Kimmel
@contact: D.BrianKimmel@gmail.com
@copyright: (c) 2016-2017 by D. Brian Kimmel
@license: MIT License
@note: Created on Nov 23, 2016
@summary: Test
"""
__updated__ = '2020-02-14'
# Import system type st... | DBrianKimmel/PyHouse | Project/src/Modules/Computer/Web/test/test_web_schedules.py | Python | mit | 5,250 |
#!/usr/bin/env python
#
# Copyright 2007-2013 The Python-Twitter Developers
#
# 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... | MosheBerman/brisket-mashup | source/libraries/python-twitter-1.1/setup.py | Python | mit | 2,426 |
# Copyright (c) 2016-present, Facebook, 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... | Yangqing/caffe2 | caffe2/python/net_builder_test.py | Python | apache-2.0 | 12,198 |
from ..exception import ValidationException
from .candidate_factory import CandidateFactory
from ..candidate import Candidate
class ListFactory(CandidateFactory):
"""
Generates candidates with data represented by integer list.
:param random: Random number generator
:param max_value: int maximum value... | Eyjafjallajokull/pyga | pyga/candidate_factory/list.py | Python | mit | 1,464 |
# -*- encoding: utf-8 -*-
"""
Число
"""
a = 0
if a:
print "Here"
a = 2
if a:
print "There"
| h4/fuit-webdev | examples/lesson2/1.3/1.3.3.py | Python | mit | 112 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 coding=utf-8
# coding: utf-8
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _, ugettext_lazy
from onadata.apps.logger.models.instance import Instance
class Command(BaseCommand):
... | kobotoolbox/kobocat | onadata/apps/logger/management/commands/update_is_sync_with_mongo.py | Python | bsd-2-clause | 1,863 |
#############################################################################
##
## Copyright (C) 2010 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENSE:BSD$
## You may use th... | Khilo84/PyQt4 | examples/activeqt/webbrowser/webbrowser.py | Python | gpl-2.0 | 5,927 |
from frowns.Smiles import smilin
from frowns.perception import RingDetection, BasicAromaticity, figueras, sssr, rings
transform1 = [
rings.sssr,
BasicAromaticity.aromatize
]
transform2 = [RingDetection.sssr,
BasicAromaticity.aromatize]
lastSmiles = None
def test():
global lastSmiles
... | tuffery/Frog2 | frowns/test/test_nci.py | Python | gpl-3.0 | 2,465 |
# -*- coding: utf-8 -*-
from openerp import http
# class Mmog(http.Controller):
# @http.route('/mmog/mmog/', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/mmog/mmog/objects/', auth='public')
# def list(self, **kw):
# return http.request.render('mmog.li... | xxjcaxx/sge20152016 | mmog/controllers.py | Python | gpl-2.0 | 657 |
# Generated by Django 2.1.2 on 2018-11-22 16:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scoping', '0253_docownership_title_only'),
]
operations = [
migrations.AlterField(
model_name='query',
name='databas... | mcallaghan/tmv | BasicBrowser/scoping/migrations/0254_auto_20181122_1629.py | Python | gpl-3.0 | 586 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# AltaPay Python SDK documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 2 16:32:57 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present i... | coolshop-com/AltaPay | docs/conf.py | Python | mit | 9,756 |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, with_statement
from tornado import gen
from tornado.log import app_log
from tornado.stack_context import (StackContext, wrap, NullContext, StackContextInconsistentError,
ExceptionStackContext, run... | bufferx/tornado | tornado/test/stack_context_test.py | Python | apache-2.0 | 11,717 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Athanasios Theocharis <athatheoc@gmail.com>
# This was made under ESA Summer of Code in Space 2019
# by Athanasios Theocharis, mentored by Daniel Estevez
#
# This file is part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
import numpy... | daniestevez/gr-satellites | python/ccsds/space_packet_parser.py | Python | gpl-3.0 | 4,556 |
from __future__ import print_function
import errno
import itertools
import math
import numbers
import os
import platform
import signal
import subprocess
import sys
import threading
def norm_path(path):
path = os.path.realpath(path)
path = os.path.normpath(path)
path = os.path.normcase(path)
return pa... | root-mirror/root | interpreter/llvm/src/utils/lit/lit/util.py | Python | lgpl-2.1 | 14,759 |
import re
match = re.search(r'[1-9]\d{5}', 'BTN 100081')
if match:
print(match.group(0))
# 匹配结果要用if检测是否为空
# re函数 search match (从头位置开始) find_all(返回列表类型)
# re.split 将字符串按照正则表达式匹配结果进行分割
# re.finditer 迭代获得匹配的结果 ,返回match对象的列表
for m in re.finditer(r'[1-9]\d{5}', 'BIU 100081,TSU 100084'):
if m:
print(m.group(... | hdhqsmile/learnSpyder | learnRe/learnRe.py | Python | mit | 1,478 |
from __future__ import print_function
import os
import numpy as np
from obspy import UTCDateTime
# Function to change picking mode to the wanted mode...
# ... Return the original mode if the wanted mode is not defined
def setPickMode(*args,**kwargs):
availPickModes=sorted([str(key) for key in args[0].k... | AndrewReynen/Lazylyst | lazylyst/Plugins/General.py | Python | mit | 5,820 |
from __future__ import unicode_literals
from collections import defaultdict
from django.core import checks
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db import models, router, transaction, DEFAULT_DB_ALIAS
from django.db.models import signals, FieldDoesNotExist
... | DrMeers/django | django/contrib/contenttypes/fields.py | Python | bsd-3-clause | 23,145 |
#!/usr/bin/env python
#
# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | cherba/apitools | apitools/base/py/list_pager.py | Python | apache-2.0 | 3,419 |
# -*- coding: utf-8 -*-
# Copyright (c) 2005 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a Diff lexer with some additional methods.
"""
from __future__ import unicode_literals
from PyQt5.Qsci import QsciLexerDiff
from .Lexer import Lexer
class LexerDiff(Lexer, QsciLexerDiff):
... | testmana2/test | QScintilla/Lexers/LexerDiff.py | Python | gpl-3.0 | 1,455 |
from Expression import *
class Range(Expression):
"""
Class representing a range in the AST of the MLP
"""
def __init__(self, rangeInit, rangeEnd, by = None):
"""
Set the range init and end
:param rangeInit : NumericExpression | Identifier
:param rangeEnd ... | rafaellc28/Latex2MiniZinc | latex2minizinc/Range.py | Python | mit | 1,864 |
# -*- coding: utf-8 -*-
from pandas.compat import range
import pandas.tools.rplot as rplot
import pandas.util.testing as tm
from pandas import read_csv
import os
import nose
def curpath():
pth, _ = os.path.split(os.path.abspath(__file__))
return pth
def between(a, b, x):
"""Check if x is in the somewhe... | bdh1011/wau | venv/lib/python2.7/site-packages/pandas/tests/test_rplot.py | Python | mit | 11,485 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
d = []
S = 0
C = 0
K = 0
n = 0
def parsear_entrada(nombre_archivo):
global d
global S
global C
global K
global n
try:
archivo = open(nombre_archivo,'r')
except IOError:
raise IOError, "Fallo al abrir el archivo de entrada"
n = int( archivo.readlin... | Xero-Hige/PythonTDA | TP2/Inventario.py | Python | gpl-3.0 | 2,245 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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... | tlakshman26/cinder-https-changes | cinder/tests/unit/test_quota.py | Python | apache-2.0 | 77,166 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#---------------------------------------------------------------------------
# Name: config.py
# Purpose: 各種設定
#
# Author: Kosuke Akizuki
#
# Created: 2015/03/11
# Copyright: (c) Kosuke Akizuki 2015-2018
# Licence: The MIT License (MIT)
#-----------... | k4zzk/mercre | config.py | Python | mit | 1,739 |
'''
Rhaposdy XBMC Plugin
Copyright (C) 2014 Jerimiah Ham
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... | jerimiah797/rhapsody-xbmc | lib/plugin.py | Python | gpl-3.0 | 3,017 |
from __future__ import absolute_import, division, print_function
import pandas as pd
import sys, os
import tarfile
import gzip
class ValidatePhoSimCatalogs(object):
MegaByte = 1024*1024
def __init__(self,
obsHistIDValues,
prefix='InstanceCatalogs/phosim_input_'):
self... | DarkEnergyScienceCollaboration/Twinkles | python/desc/twinkles/validation/validate.py | Python | mit | 5,393 |
"""Append module search paths for third-party packages to sys.path.
****************************************************************
* This module is automatically imported during initialization. *
****************************************************************
In earlier versions of Python (up to 1.5a3), scripts or... | kmod/icbd | stdlib/python2.5_small/site.py | Python | mit | 14,404 |
# -*- coding: utf-8 -*-
from rest_framework import generics, permissions as drf_permissions
from rest_framework.exceptions import ValidationError
from api.base import permissions as base_permissions
from api.base.views import JSONAPIBaseView
from api.base.pagination import SearchPagination
from api.base.settings impo... | aaxelb/osf.io | api/search/views.py | Python | apache-2.0 | 27,712 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
from __future__ import unicode_literals
"""
Contains the Document class representing an object / record
"""
_toc = ["webnotes.model.doc.Document"]
import webnotes
import webnotes.model.meta
import MySQLdb
from webnotes.utils impo... | gangadhar-kadam/sapphite_lib | webnotes/model/doc.py | Python | mit | 20,173 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
RJUST = 12
def format_fans(fans):
return format_line(prefix='fans'.rjust(RJUST), values=fans)
def format_rpms(rpms):
return format_line(prefix='rpms'.rjust(RJUST), values=rpms)
def format_pwms(pwm... | Bengt/AL-FanControl | python/fancontrol/ui/cli_util.py | Python | mit | 2,042 |
from warpnet_framework.warpnet_client import *
from warpnet_framework.warpnet_common_params import *
from warpnet_experiment_structs import *
from twisted.internet import reactor
from datetime import *
from numpy import log10, linspace
import time
import sys
mods = [[2,2,2100,78-1]]
pktLens = [1412]; #range(1412, 91,... | shailcoolboy/Warp-Trinity | ResearchApps/Measurement/warpnet_coprocessors/phy_logger/examples/twoNode_cfoLogging.py | Python | bsd-2-clause | 6,164 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
import twoauth
if __name__ == "__main__":
ckey = sys.argv[1]
csecret = sys.argv[2]
atoken = sys.argv[3]
asecret = sys.argv[4]
api = twoauth.api(ckey, csecret, atoken, asecret)
# Get Home Timeline
for status in api.home_timel... | techno/python-twoauth | sample/home_timeline.py | Python | mit | 389 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jbedorf/tensorflow | tensorflow/python/training/tracking/util_test.py | Python | apache-2.0 | 67,612 |
# coding=utf-8
"""InaSAFE Keyword Wizard Band Selector."""
import logging
# noinspection PyPackageRequirements
from qgis.PyQt import QtCore
from qgis.PyQt.QtWidgets import QListWidgetItem
from qgis.core import QgsRasterBandStats
from safe.gui.tools.wizard.wizard_step import (
get_wizard_step_ui_class, WizardSte... | mbernasocchi/inasafe | safe/gui/tools/wizard/step_kw13_band_selector.py | Python | gpl-3.0 | 3,569 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext_lazy as _
class N... | shoopio/shoop | shuup/core/utils/name_mixin.py | Python | agpl-3.0 | 767 |
from __future__ import absolute_import
from sentry.models import ProcessingIssue, EventError, RawEvent, EventProcessingIssue
from sentry.testutils import TestCase
class ProcessingIssueTest(TestCase):
def test_simple(self):
team = self.create_team()
project1 = self.create_project(teams=[team], nam... | mvaled/sentry | tests/sentry/models/test_processingissue.py | Python | bsd-3-clause | 904 |
from collections import defaultdict
import logging
import numpy as np
import math
from typing import List
import ray
from ray.rllib.evaluation.metrics import get_learner_stats, LEARNER_STATS_KEY
from ray.rllib.evaluation.worker_set import WorkerSet
from ray.rllib.execution.common import \
STEPS_SAMPLED_COUNTER, ST... | richardliaw/ray | rllib/execution/train_ops.py | Python | apache-2.0 | 16,136 |
# coding=utf-8
# This file is part of Medusa.
#
# Medusa 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.
#
# Medusa is distributed in t... | pymedusa/Medusa | tests/legacy/show/coming_episodes_tests.py | Python | gpl-3.0 | 3,005 |
# Webhooks for external integrations.
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
fr... | jphilipsen05/zulip | zerver/webhooks/stripe/view.py | Python | apache-2.0 | 8,118 |
# -*- coding: utf-8 -*-
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from reversion.admin import VersionAdmin
from django.contrib.gis import admin
from .model... | ngageoint/geoq | geoq/agents/admin.py | Python | mit | 710 |
import boto.sqs
from django.conf import settings
from boto.sqs.message import Message
import json
import logging
def push_message_to_sqs_queue(message):
"""
A utility function that pushes the message to the common SQS queue.
:param message: A JSON document with the request details.
"""
connection... | Knowty/marksafe | processor/utils.py | Python | mit | 1,994 |
# -*- coding: utf-8 -*-
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
class TestBaseLocationGeonamesImport(common.SavepointCase):
@classmethod
def setUpClass(cls):
super(TestBaseLocationGeona... | sergiocorato/partner-contact | base_location_geonames_import/tests/test_base_location_geonames_import.py | Python | agpl-3.0 | 2,436 |
from django.http import HttpRequest
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import render
from django.contrib.auth.models import User
from django.contrib import auth
import json
def check_username(request):
if request.method == 'GET':
username = ... | MichaelTong/edx-ivic | djangoapp/vmtemplates/verification.py | Python | gpl-2.0 | 2,118 |
# on success, nothing is printed
import simplexorrequestor
# I'm keeping some of these datastructures tiny in order to make the output
# more readable if an error is discovered
mirrorinfolist = [{'name':'mirror1'}, {'name':'mirror2'}, {'name':'mirror3'}, {'name':'mirror4'}, {'name':'mirror5'}]
blocklist = [12,34]
#... | scotfu/uppir | test_simplexorrequestor.py | Python | mit | 2,272 |
import sys
from resources.datatables import WeaponType
def setup(core, object):
object.setStfFilename('static_item_n')
object.setStfName('weapon_pistol_trader_roadmap_01_02')
object.setDetailFilename('static_item_d')
object.setDetailName('weapon_pistol_trader_roadmap_01_02')
object.setStringAttribute('class_requi... | ProjectSWGCore/NGECore2 | scripts/object/weapon/ranged/pistol/weapon_pistol_trader_roadmap_01_02.py | Python | lgpl-3.0 | 580 |
# Copyright (c) 2015 Huawei Technologies Co., Ltd.
# 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
#
# ... | nikesh-mahalka/cinder | cinder/volume/drivers/huawei/fc_zone_helper.py | Python | apache-2.0 | 2,814 |
#!/usr/bin/python3
#
# Copyright (C) 2010-2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in ... | kellinm/anaconda | tests/regex_tests/groupparse_test.py | Python | gpl-2.0 | 2,309 |
from django.conf.urls import patterns, url
from apps.users import views
urlpatterns = patterns('',
#Authentication urls
url(r'^$', views.index, name='index'),
url(r'^logout/$', views.logout, name='logout'),
url(r'^register/$', views.register_user, name='register_user'),
url(r'^register_succes/$', ... | Sult/Buah | apps/users/urls.py | Python | gpl-2.0 | 371 |
"""
Copyright 2014 Quentin Kaiser
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
dis... | QKaiser/pynessus | pynessus/models/scanner.py | Python | apache-2.0 | 2,984 |
# $Id: components.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Docutils component-related transforms.
"""
__docformat__ = 'reStructuredText'
import sys
import os
import re
import time
from docutils import nodes,... | akiokio/centralfitestoque | src/.pycharm_helpers/docutils/transforms/components.py | Python | bsd-2-clause | 2,003 |
#!/usr/bin/env python
"""Load a texture with alpha from a file and draw with mask."""
import os
import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()
from VisionEgg.Core import *
from VisionEgg.Textures import *
import pygame
from pygame.locals import *
filename = os.path.join(VisionEgg.co... | visionegg/visionegg | demo/spiral.py | Python | lgpl-2.1 | 1,893 |
from django.apps import AppConfig
class GiftsConfig(AppConfig):
name = 'gifts'
| helfertool/helfertool | src/gifts/apps.py | Python | agpl-3.0 | 85 |
# 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/.
from selenium.webdriver.common.by import By
from pages.base import BasePage
class FirefoxWelcomePage7(BasePage):
... | ericawright/bedrock | tests/pages/firefox/welcome/page7.py | Python | mpl-2.0 | 598 |
from __future__ import unicode_literals
from __future__ import print_function
import decimal
import datetime
import click
import boto.ec2
from prettytable import PrettyTable
from . import get_reserved_analysis
from . import get_price_table
from . import price_table_to_price_mapping
from . import LINUX_ON_DEMAND_PRICE... | balanced-ops/ec2-cost-tools | ec2_costs/__main__.py | Python | mit | 5,899 |
import elementary
import evas
import ecore
import urllib
import time
import os
import shutil
import datetime
class playerWindow(elementary.Box):
def __init__( self, parent ):
#Builds an elementary tabel that displays our information
elementary.Box.__init__(self, parent.mainWindow)
#Store t... | JeffHoogland/eandora | eAndora/playerWindow.py | Python | bsd-3-clause | 12,769 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.