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 |
|---|---|---|---|---|---|
from unittest import TestCase
from sys import version_info
try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.http import HttpResponse, HttpRequest
from django.utils.functional import allow_lazy, lazy, memoize
from django.views.dec... | adviti/melange | thirdparty/google_appengine/lib/django_1_2/tests/regressiontests/decorators/tests.py | Python | apache-2.0 | 5,210 |
#!/usr/bin/env python
# Python module for simulated annealing - anneal.py - v1.0 - 2 Sep 2009
#
# Copyright (c) 2009, Richard J. Wagner <wagnerr@umich.edu>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright... | wpj-cz/Spritemapper | spritecss/packing/anneal.py | Python | mit | 12,791 |
#!/usr/bin/env python
# encoding: utf-8
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2012 by the RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this sof... | faribas/RMG-Py | rmgpy/display.py | Python | mit | 2,002 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apac... | denismakogon/trove-guestagent | trove_guestagent/openstack/common/wsgi.py | Python | apache-2.0 | 27,964 |
#! /usr/bin/python
# -*- coding: utf-8; -*-
# Copyright (C) 2009 Østfold University College
#
# This file is part of ANDP.
#
# ANDP 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 Li... | audunv/andp | python/andp/model/users.py | Python | gpl-2.0 | 8,162 |
H, W = map(int, input().split())
N = H * W
board = [[int(x == "#") for x in input()] for _ in range(H)]
INF = N ** 2
A = [[INF] * N for _ in range(N)]
for i in range(N):
A[i][i] = 0
drc = [(-1, 0), (1, 0), (0, 1), (0, -1)]
for r in range(H):
for c in range(W):
for dr, dc in drc:
nr, nc = r +... | knuu/competitive-programming | atcoder/abc/abc151_d.py | Python | mit | 922 |
from __future__ import division
from PyQt4 import QtCore
from drivepy.thorlabs.aptlib import AptPiezo, AptMotor
from drivepy.thorlabs.aptlib import aptconsts as consts
#from drivepy.newfocus.powermeter import PowerMeter
from drivepy.newport.powermeter import PowerMeter
from numpy import *
from scipy import optimize... | timrae/pylase | align.py | Python | gpl-2.0 | 12,776 |
import os
from openquake.commonlib.calculators import base
@base.calculators.add('hello')
class HelloCalculator(base.BaseCalculator):
def pre_execute(self):
pass
def execute(self):
return 'hello world'
def post_execute(self, result):
fname = os.path.join(self.oqparam.export_dir, ... | vup1120/oq-risklib | docs/my_calculators/hello.py | Python | agpl-3.0 | 405 |
# -*- coding: utf-8 -*-
from math import ceil
from rest_framework.serializers import \
Serializer, CharField, DateTimeField, IntegerField, SerializerMethodField
from rest_framework_gis.serializers import GeometryField
from rest_framework.utils.urls import remove_query_param, replace_query_param
from django.conf i... | WikiWatershed/model-my-watershed | src/mmw/apps/bigcz/serializers.py | Python | apache-2.0 | 2,192 |
import util, pexpect, time, math
from pymavlink import mavwp
# a list of pexpect objects to read while waiting for
# messages. This keeps the output to stdout flowing
expect_list = []
def expect_list_clear():
'''clear the expect list'''
global expect_list
for p in expect_list[:]:
expect_list.remov... | owenson/ardupilot | Tools/autotest/common.py | Python | gpl-3.0 | 8,336 |
from django.conf.urls.defaults import patterns, url
from ga_ows.views.wfs import WFS
from ga_ows.views.wms import WMS, GeoDjangoWMSAdapter
| hydroshare/hydroshare_temp | ga_ows/urls.py | Python | bsd-3-clause | 140 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... | ReactiveX/RxPY | docs/conf.py | Python | mit | 5,837 |
import psycopg2
def get_counts():
counts = [0, 0, 0]
try:
connection = psycopg2.connect("dbname=voting user=www host=db")
counts = get_counts_internal(connection)
except psycopg2.Error as e:
print e
finally:
connection.close()
return counts
def get_counts_internal(connection):
try:
cur... | mwellner/voting | result-python/db.py | Python | mit | 591 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | lyynocs/magento-connector-v8 | magentoerpconnect/unit/export_synchronizer.py | Python | agpl-3.0 | 17,391 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_generated_aiplatform_v1_tensorboard_service_create_tensorboard_sync.py | Python | apache-2.0 | 1,742 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests the event extraction worker."""
from __future__ import unicode_literals
import collections
import unittest
from dfvfs.lib import definitions as dfvfs_definitions
from dfvfs.resolver import context
from dfvfs.path import factory as path_spec_factory
from plaso.... | rgayon/plaso | tests/engine/worker.py | Python | apache-2.0 | 17,494 |
from pysqlite2 import dbapi2 as sqlite3
class MySum:
def __init__(self):
self.count = 0
def step(self, value):
self.count += value
def finalize(self):
return self.count
con = sqlite3.connect(":memory:")
con.create_aggregate("mysum", 1, MySum)
cur = con.cursor()
cur.execute("creat... | waqasbhatti/astroph-coffee | pysqlite/doc/includes/sqlite3/mysumaggr.py | Python | mit | 495 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 IBM Corp.
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#... | ntt-sic/cinder | cinder/volume/drivers/storwize_svc.py | Python | apache-2.0 | 79,938 |
import os
import base64
import xmlrpclib
import urllib2
import cookielib
import httplib
import cherrypy
import pickle
from tempfile import mkstemp
from openipam.utilities import error
class PickleCookieJar( cookielib.CookieJar ):
def __init__( self, *args ):
self._initargs = args
cookielib.CookieJar.__init__(se... | ehuelsmann/openipam | openIPAM/openipam/web/resource/xmlrpcclient.py | Python | gpl-3.0 | 2,306 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-09 05:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0042_auto_20160506_1306'),
]
operations = [
migrations.AlterField(
... | uclouvain/OSIS-Louvain | base/migrations/0043_auto_20160509_0748.py | Python | agpl-3.0 | 466 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import json
import sys
from collections import Counter, defaultdict
def read_full_results(results_file, skip_gold=True):
processed = defaultdict(list)
with open(results_file, 'rb') as i:
results = csv.DictReader(i)
fields =... | sm86/DBTax | original/python/majority_vote.py | Python | apache-2.0 | 2,216 |
import numpy as np
import itertools
from .ind import Ind, getLayer, getNodeOrder
def evolvePop(self):
""" Evolves new population from existing species.
Wrapper which calls 'recombine' on every species and combines all offspring
into a new population. When speciation is not used, the entire population is
trea... | google/brain-tokyo-workshop | WANNRelease/WANN/wann_src/_variation.py | Python | apache-2.0 | 12,889 |
# -*- coding: utf-8 -*-
"""For running command line executables with a timeout"""
import subprocess
import threading
import salt.exceptions
class TimedProc(object):
'''
Create a TimedProc object, calls subprocess.Popen with passed args and **kwargs
'''
def __init__(self, args, **kwargs):
sel... | MadeiraCloud/salt | sources/salt/utils/timed_subprocess.py | Python | apache-2.0 | 2,036 |
# Copyright (c) 2016 Intel Corporation
#
# 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 ... | tellesnobrega/sahara | sahara/tests/unit/plugins/cdh/v5_3_0/test_config_helper_530.py | Python | apache-2.0 | 5,642 |
from django import forms
from core.site.models import Site
from core.vlan.models import Vlan
from core.network.models import Network
class NetworkForm(forms.ModelForm):
site = forms.ModelChoiceField(
queryset=Site.objects.all(),
empty_label="(Defaults to parent's site.)",
required=False)
... | rtucker-mozilla/mozilla_inventory | core/network/forms.py | Python | bsd-3-clause | 1,551 |
#!/usr/bin/env python3
##############################################################################
# Copyright (c) 2021: Leonardo Cardoso
# https://github.com/LeoFCardoso/pdf2pdfocr
##############################################################################
# OCR a PDF and add a text "layer" in the original file ... | LeoFCardoso/pdf2pdfocr | pdf2pdfocr.py | Python | apache-2.0 | 73,585 |
#!/usr/bin/env python3
import fstimer.fslogger
import fstimer.timer
from gi.repository import Gtk
def main():
pytimer = fstimer.timer.PyTimer()
Gtk.main()
if __name__ == '__main__':
main()
| bletham/fstimer | fstimer.py | Python | gpl-3.0 | 206 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)
"""
Various configuration tests.
"""
from waflib import Task
from waflib.Configure import conf
from waflib.TaskGen import feature, before_method, after_method
LIB_CODE = '''
#ifdef _MSC_VER
#define testEXPORT __declspec(dllexport)
#else
#define testEX... | evancich/apm_motor | modules/waf/waflib/Tools/c_tests.py | Python | gpl-3.0 | 5,912 |
# vim:tw=50
"""Docstrings
Now that we have defined our own functions, it
makes sense to talk about how to document them
properly. Earlier, it was briefly mentioned that
comments are not the favored tool for creating
documentation in Python: **docstrings** are.
A string becomes a docstring when it is the first
state... | shiblon/pytour | tutorials/docstrings.py | Python | apache-2.0 | 1,709 |
#!/usr/bin/python
#
# update_localizable_strings
#
# Updates Localizable.strings files using a base language Localizable.strings file.
#
# Author: Mark Jones (github.com/markljones)
# Created: 5 September 2013
#
import sys
import os
import re
import shutil
import argparse
import codecs
import collections
import loggin... | markljones/patchwork-tools-ios | update_localizable_strings.py | Python | mit | 5,235 |
from common import * # NOQA
from cattle import ApiError
import yaml
def _get_agent_for_container(context, container):
agent = None
for map in container.hosts()[0].instanceHostMaps():
try:
c = map.instance()
except Exception:
continue
if c.agentId is not None:
... | vincent99/cattle | tests/integration-v1/cattletest/core/test_healthcheck.py | Python | apache-2.0 | 45,344 |
# This file is part of rERPy
# Copyright (C) 2012-2013 Nathaniel Smith <njs@pobox.com>
# See file LICENSE.txt for license information.
| rerpy/rerpy | rerpy/io/__init__.py | Python | gpl-2.0 | 135 |
from charm.adapters.pkenc_adapt_hybrid import HybridEnc
from charm.adapters.pkenc_adapt_chk04 import CHK04
from charm.adapters.pkenc_adapt_bchk05 import BCHKIBEnc
from charm.adapters.ibenc_adapt_identityhash import HashIDAdapter
from charm.schemes.encap_bchk05 import EncapBCHK
from charm.schemes.ibenc.ibenc_bb03 import... | JHUISI/charm | charm/test/schemes/pkenc_test.py | Python | lgpl-3.0 | 9,488 |
"""
C# inline shellcode injector using the VirtualAlloc()/CreateThread() pattern.
Adapated from code from: http://webstersprodigy.net/2012/08/31/av-evading-meterpreter-shell-from-a-net-service/
Module built by @the_grayhound
TODO: obfuscation!
"""
from modules.common import shellcode
class Stager:
def __init... | d3m3vilurr/Veil | modules/payloads/cs/csVirtualAlloc.py | Python | gpl-3.0 | 2,392 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pygame
import operator
import os
import sys
import math
import getopt
import time
from xml.parsers.expat import ExpatError
import loggingl
try:
import pygtk
pygtk.require('2.0')
except:
print 'Incorrect version of pyGTK or pyGTK not found.'
try:
import... | tshirtman/ultimate-smash-friends | utils/level_editor/usf-level-editor.py | Python | gpl-3.0 | 44,236 |
from flask import (Blueprint, redirect, request, flash, url_for,
render_template)
from sqlalchemy import text
from .forms import (SearchForm, BulkDeleteForm, PostForm)
from hoyt.blueprints.blog import Post, Category, Tag
dashboard = Blueprint(
'dashboard',
__name__,
template_folder='te... | hoytnix/hoyt.io | flask-server/hoyt/blueprints/dashboard/views.py | Python | gpl-3.0 | 3,177 |
# Copyright 2020 Makani Technologies 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... | google/makani | config/m600/monitor/landing_zone.py | Python | apache-2.0 | 3,447 |
'''
Copyright 2009, 2010 Anthony John Machin. All rights reserved.
Supplied subject to The GNU General Public License v3.0
Created on 28 Jan 2009
Last Updated on 10 July 2010
As test20 with tests of:
rules instantiation and query inference
Related:
single dict TS recursion rule plus generic rule + minimal da... | Semanticle/Semanticle | sm-mt-devel/src/metabulate/tests/test26case-031r_ge.py | Python | gpl-2.0 | 25,017 |
import unittest
import mock
from reports.tests.base import BaseBidsUtilityTest
from copy import copy
test_bids_invalid = [
[{
"owner": "test",
"date": "2016-03-17T13:32:25.774673+02:00",
"id": "44931d9653034837baff087cfc2fb5ac",
}],
[{
"status": "invalid",
"owner": ... | yshalenyk/reports | reports/tests/bids_tests.py | Python | apache-2.0 | 9,230 |
#
# Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
#
from gevent import monkey
monkey.patch_all()
import os
import sys
import socket
import subprocess
import json
import time
import datetime
import platform
import gevent
import ConfigParser
from nodemgr.common.event_manager import EventManager
from p... | tcpcloud/contrail-controller | src/nodemgr/analytics_nodemgr/analytics_event_manager.py | Python | apache-2.0 | 2,984 |
# -*- coding: utf-8 -*-
from functools import partial
import random
from navmazing import NavigateToSibling, NavigateToAttribute
from cfme.common import SummaryMixin, Taggable
from cfme.containers.provider import pol_btn, navigate_and_get_rows,\
ContainerObjectAllBaseView
from cfme.fixtures import pytest_selenium... | dajohnso/cfme_tests | cfme/containers/image_registry.py | Python | gpl-2.0 | 2,812 |
# -*- coding: utf-8 -*-
class HTTPError(Exception):
def __init__(self, message=None):
if message is not None:
self.message = message
class NotFound(HTTPError):
error_code = 404
message= 'Not Found'
| tokyo-jesus/aniracetam | aniracetam/errors/http.py | Python | apache-2.0 | 234 |
# Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import sys
## Convenience class to simplify OS checking and similar platform-specific handling.
class Platform:
class PlatformType:
Windows = 1
Linux = 2
OSX = 3
Other = 4
## Che... | thopiekar/Uranium | UM/Platform.py | Python | lgpl-3.0 | 1,203 |
"""Utility functions for unit test callbacks"""
import json
from typing import Callable, List, Tuple, Union
from urllib import parse
from requests import Request
MockResponse = Tuple[int, dict, dict]
def is_json(data: List[dict]):
"""Shorthand assertion for a json data structure"""
is_list = isinstance(da... | redcap-tools/PyCap | tests/unit/callback_utils.py | Python | mit | 15,660 |
# Advent of Code Day 16
import re
def rule1Check(aunt):
for comp,val in tickertape.items():
if comp in aunt:
if aunt[comp] != val:
print('Aunt',num,'does not match')
return False
return True
def rule2Check(aunt):
for comp,val in tickertape.items():
if comp in aunt:
if comp == 'cats' or comp == ... | Ynadroid/AdventOfCode | adventofcode_day16.py | Python | gpl-2.0 | 1,863 |
#!/usr/bin/env python
#Used: http://stackoverflow.com/questions/579687/how-do-i-copy-a-string-to-the-clipboard-on-windows-using-python
#Polina Morozova 10.11.2014
from random import randint
import pyperclip
def generate_ik(sex, year, month, day):
ik = str(getSex(sex,year))
ik += getYear(year)
ik += getMonth(month... | p0linka/AA_hmw | hmw_2/clipboard_pyperclip/clipboard_win.py | Python | mit | 2,103 |
"""
aspen.utils
+++++++++++
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import codecs
import datetime
import math
import re
import algorithm
# Register a 'repr' error strategy.
# ============================... | jaraco/aspen | aspen/utils.py | Python | mit | 11,815 |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... | bmi-forum/bmi-pyre | pythia-0.8/packages/pyre/pyre/odb/common/Codec.py | Python | gpl-2.0 | 754 |
"""Utilities for manipulating variant files in standard VCF format.
"""
from collections import namedtuple, defaultdict
import copy
import os
import pprint
import shutil
import subprocess
import toolz as tz
import six
from six.moves import zip
from bcbio import broad, utils
from bcbio.bam import ref
from bcbio.dist... | lbeltrame/bcbio-nextgen | bcbio/variation/vcfutils.py | Python | mit | 32,445 |
from copy import deepcopy
from pycqed.measurement.pulse_sequences.standard_elements import multi_pulse_elt
from ..waveform_control import sequence
import numpy as np
station = None
def Pulsed_spec_seq(RO_pars,
spec_marker_channels,
spec_pulse_length=1e-6,
m... | DiCarloLab-Delft/PycQED_py3 | deprecated/pycqed/measurement/pulse_sequences/spectroscopy_seqs.py | Python | mit | 1,463 |
# Copyright 2014 Piers Titus van der Torren <pierstitus@gmail.com>
# Copyright 2015 Miguel Angel Ajo <miguelangel@ajo.es>
#
# 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 ... | mangelajo/kicad-python | kicad/pcbnew/layer.py | Python | gpl-2.0 | 3,240 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim as slim
from config.parse_config import parse_config_file
from nets import nets_factory
from preprocessing i... | visipedia/tf_classification | test.py | Python | mit | 9,548 |
"""
auth.backends
~~~~~~~~~~~~~
"""
from .app_id import AppIDBackend
from .cert import CertBackend
from .github import GitHubBackend
from .ldap import LDAPBackend
from .userpass import UserPassBackend
from stevedore import DriverManager
__all__ = ['AppIDBackend', 'CertBackend', 'GitHubBackend',
'L... | johnnoone/aiovault | aiovault/v1/auth/backends/__init__.py | Python | bsd-3-clause | 699 |
# Schema for Roundup registration system for matholymp package.
# Copyright 2014-2022 Joseph Samuel Myers.
# 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
#... | jsm28/matholymp-py | matholymp/roundupreg/schema.py | Python | gpl-3.0 | 30,594 |
from django.views.generic import ListView, CreateView, UpdateView
from django.shortcuts import render, redirect
from models import User_Institution, Institution, Datatype, Transplant_Type, Alias_Identifier, Data_Cleansing_Template, Data_Cleansing_Template_Field, User
from django.core.urlresolvers import reverse
from ... | hizni/vod-systems | vod_systems/vod/institution_views.py | Python | mit | 3,793 |
#!/Users/coursehero/Repos/slack-christmas-bot/christmasbot/bin/python2.7
# $Id: rst2xml.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.
"""
A minimal front end to the Docutils Publisher, producing Docutils XML.
"""
try... | Mechdriver/slack-christmas-bot | christmasbot/bin/rst2xml.py | Python | mit | 656 |
from __future__ import absolute_import
import numpy as np
from pyti import catch_errors
from pyti.average_true_range import (
average_true_range as atr
)
def average_true_range_percent(close_data, period):
"""
Average True Range Percent.
Formula:
ATRP = (ATR / CLOSE) * 100
"""
catch_e... | kylejusticemagnuson/pyti | pyti/average_true_range_percent.py | Python | mit | 451 |
import rlcompleter
import readline
from parser import lispy_parser
from eval import global_scope, eval, eval_literal, print_lispy
import sys
if len(sys.argv) == 1:
readline.parse_and_bind("set editing-mode emacs")
lispy = lispy_parser()
while True:
try:
line = input('>>> ')
exc... | azy2/Lispy | src/lispy.py | Python | gpl-3.0 | 827 |
from spacepy import coordinates as coord
from spacepy.time import Ticktock
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
#df = pd.read_csv('simpleorbit.csv')
df = pd.read_csv('01_Jan_2019.csv')
# df = pd.read_csv('Jan65.txt')
print(df.tail())
# i THINK th... | fsbr/se3-path-planner | coordtransform/SO.py | Python | mit | 1,013 |
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that ... | apahim/avocado-misc-tests | io/disk/ssd/ezfiotest.py | Python | gpl-2.0 | 2,872 |
# Copyright 2009 Alex K (wtwf.com) All rights reserved.
__author__ = "wtwf.com (Alex K)"
import json
import logging
from google.appengine.api import users
from google.appengine.ext import ndb
from wtwf import wtwfhandler
import model
class ImportHandler(wtwfhandler.WtwfHandler):
@wtwfhandler.admin_required
... | arkarkark/snippy | app/import_snips.py | Python | mit | 1,607 |
# **WARNING**
#
# Naming this file `string.py` fucks something up:
#
# $ python2 plugins/filter_plugins/path.py
# Traceback (most recent call last):
# File "plugins/filter_plugins/path.py", line 17, in <module>
# from pathlib2 import Path
# File "/usr/local/lib/python2.7/site-pac... | nrser/qb | plugins/filter/string_filters.py | Python | mit | 3,183 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
"""
mark commits as "Landed" on pull
Config::
[pullcreatemarkers]
# Use graphql to query what diffs are landed, instead of scanning
# th... | facebookexperimental/eden | eden/scm/edenscm/hgext/pullcreatemarkers.py | Python | gpl-2.0 | 8,971 |
#/*##########################################################################
# Copyright (C) 2004-2012 European Synchrotron Radiation Facility
#
# This file is part of the PyMca X-ray Fluorescence Toolkit developed at
# the ESRF by the Software group.
#
# This toolkit is free software; you can redistribute it and/or m... | tonnrueter/pymca_devel | PyMca/CheckField.py | Python | gpl-2.0 | 2,361 |
import json
import six
from django.core.exceptions import ValidationError
from django.db import models
try:
from django.utils.encoding import smart_unicode as smart_text
smart_text # placate pyflakes
except ImportError:
from django.utils.encoding import smart_text
class JSONField(models.TextField):
... | webjunkie/python-social-auth | social/apps/django_app/default/fields.py | Python | bsd-3-clause | 2,577 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
class Note(Document... | gangadharkadam/office_erp | erpnext/utilities/doctype/note/note.py | Python | agpl-3.0 | 1,139 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
def _default_visible_expense_policy(self):
visibility = self.user_has_groups('hr_expense.group_hr_expense... | ddico/odoo | addons/sale_expense/models/product_template.py | Python | agpl-3.0 | 1,032 |
#!/usr/bin/env python
import os.path
import sys
from scapy.all import load_module, sniff, Dot11
USAGE = """
Usage: sudo python log.py [-c] [-i] <monitoring-interface>
Example: echo 'mac_address,rssi,time_stamp,packet_type,packet_subtype' > ../data/test.dat && sudo python log.py -c wlp1s0mon >> ../data/test.dat
Opt... | k323r/derwlanversteher | src/log.py | Python | mit | 4,505 |
# This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2014 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See LICENSE.txt in the main project ... | kgao/MediaDrop | mediadrop/model/settings.py | Python | gpl-3.0 | 4,208 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------
# Plugin for FILMAFFINITY support
# -----------------------------------------------------------------------
# $Id$
# Version: 080607_01
#
# Notes: FilmAffinity plugin. You can add FilmAffinity.com informations for video it... | freevo/freevo1 | src/video/plugins/filmaffinity.py | Python | gpl-2.0 | 23,935 |
def delete_content(filename):
""" This function deletes the history file's content """
try:
with open(filename, "w") as file:
file.seek(0)
file.truncate()
if lang == 'ca':
print('Fet')
else:
print('Done')
except PermissionError:
... | Worldev/UsefulShell | modules/delete/delete.py | Python | gpl-3.0 | 699 |
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
from django.urls import reverse
from django.utils.timesince import timesince as djtimesince
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
VERBS =... | embryonic/poetry | activity/models.py | Python | gpl-3.0 | 6,524 |
import numpy
import unittest
import floatpy.derivatives.explicit.second as second_der
class TestDerivativesSecond(unittest.TestCase):
def testFirstDirection(self):
"""
Test the second derivatives in the first direction.
"""
x = numpy.empty([1, 100])
x[0, :] = ... | FPAL-Stanford-University/FloATPy | floatpy/tests/test_derivatives_explicit_second.py | Python | lgpl-3.0 | 3,955 |
def extractWwwLunarlettersCom(item):
'''
Parser for 'www.lunarletters.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous',... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractWwwLunarlettersCom.py | Python | bsd-3-clause | 552 |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'plugindownloader.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
#########... | hsorby/mapclient | src/mapclient/view/managers/plugins/ui/ui_plugindownloader.py | Python | gpl-3.0 | 5,046 |
"""
Core components of Home Assistant.
Home Assistant is a Home Automation framework for observing the state
of entities and react to changes.
"""
import asyncio
import datetime
import enum
import functools
from ipaddress import ip_address
import logging
import os
import pathlib
import random
import re
import threadin... | mKeRix/home-assistant | homeassistant/core.py | Python | mit | 51,621 |
# 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... | hfp/tensorflow-xsmm | tensorflow/python/autograph/pyct/parser.py | Python | apache-2.0 | 4,309 |
import json
from factory import DjangoModelFactory, SubFactory
from student.tests.factories import UserFactory as StudentUserFactory
from instructor_task.models import InstructorTask
from celery.states import PENDING
class InstructorTaskFactory(DjangoModelFactory):
FACTORY_FOR = InstructorTask
task_type = '... | PepperPD/edx-pepper-platform | lms/djangoapps/instructor_task/tests/factories.py | Python | agpl-3.0 | 549 |
# Cumulus: Efficient Filesystem Backup to the Cloud
# Copyright (C) 2008-2009, 2012 The Cumulus Developers
# See the AUTHORS file for a list of contributors.
#
# 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... | h8liu/cumulus | python/cumulus/__init__.py | Python | gpl-2.0 | 38,157 |
# Copyright (c) 2013 Mirantis 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 writ... | shakamunyi/sahara | sahara/service/edp/api.py | Python | apache-2.0 | 8,394 |
from __future__ import absolute_import
__author__ = "ross"
import time
import unittest
from pychron.pyscripts.extraction_line_pyscript import ExtractionPyScript
# from pychron.core.helpers.logger_setup import logging_setup
# logging_setup('extraction_tests')
# class ExtractionTestCase(unittest.TestCase):
# d... | USGSDenverPychron/pychron | pychron/pyscripts/tests/extraction_script.py | Python | apache-2.0 | 2,411 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-10 01:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Topic'... | DoWhatILove/turtle | programming/python/web/learning_log/learning_logs/migrations/0001_initial.py | Python | mit | 623 |
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import Protocol, Factory
from twisted.internet import reactor, threads
from nx_parser import signature_parser
import syslog
#import threading
### Protocol Implementation
# This is just about... | tgbyte/nginx-passenger-debian | debian/modules/naxsi/contrib/rules_generator/naxsi-ui_v0.1/nx_intercept.py | Python | bsd-2-clause | 2,029 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import vim
import re
import os
import os.path
import fnmatch
import time
import locale
from functools import wraps
from .utils import *
from .explorer import *
from .manager import *
from .asyncExecutor import AsyncExecutor
from .devicons import (
webDevIconsGetFileTyp... | Yggdroot/LeaderF | autoload/leaderf/python/leaderf/fileExpl.py | Python | apache-2.0 | 36,906 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import time
fr... | Eksmo/calibre | src/calibre/ebooks/metadata/sources/identify.py | Python | gpl-3.0 | 20,660 |
import os
from os.path import join
from datetime import date
from pandas import HDFStore, DataFrame, Series
from pandas import concat
from numpy import datetime64
from .utils import Singleton, env
TABLE_RANGE = "_cache_range"
TABLE_NAME = "_symbol_name"
@Singleton
class Cache:
def __init__(self, cache_dir=".ca... | dyno/LMK | lmk/cache.py | Python | mit | 3,559 |
# This software is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# Description: Log support cases using AWS Support API based on Alarms from
# Amazon CloudWatch passed via Amazon SNS and Amazon SQS.
#
# Author: Mark Statham
import os
import logging
import ... | mjs2180/eb-cw-support-api | application.py | Python | apache-2.0 | 7,431 |
#
# Copyright (c) 2008 - 2013 10gen, Inc. <http://10gen.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 applicabl... | hemmerling/nosql-mongodb2013 | src/m101p/final/q4/blog.py | Python | apache-2.0 | 11,522 |
#Joe Young
#v.1
def value_finder(List):
value = 0
for i in List:
value += i
return value
def value_finder_r_single(List):
value = 0
if List == []:
return 0
else:
return (List[0] + value_finder_r_single(List[1:]))
def value_finder_r_multi(List):
... | joeyoung658/A-Level_2016-18 | Challenges/List Value Finder/List_Value_Finder.py | Python | gpl-3.0 | 892 |
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | resmo/ansible | test/units/modules/network/fortios/test_fortios_user_device_group.py | Python | gpl-3.0 | 7,603 |
from math import log10, floor
# N = 12
N = 101
# N = 1000001
def n_squares(n):
return [i**2 for i in range(2, n)]
# print(n_squares(11))
# print(n_squares(100))
##### This block from stackoverflow:
# https://stackoverflow.com/questions/37023774/all-ways-to-partition-a-string
import itertools
memo = {}
def mu... | kylebegovich/ProjectEuler | Python/Progress/Problem719.py | Python | gpl-3.0 | 1,757 |
# encoding: utf-8
"""
WSGI config for news 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... | kapsiry/Torvi | news/wsgi.py | Python | mit | 1,148 |
import doctest
import unittest
import catalogue.models.book
def load_tests(loader, tests, ignore):
tests.addTests(doctest.DocTestSuite(catalogue.models.book))
return tests
| fnp/wolnelektury | src/catalogue/tests/test_doctests.py | Python | agpl-3.0 | 182 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Item',
fields=[
('id', models.AutoField(seriali... | maxolasersquad/orthosie | inventory/migrations/0001_initial.py | Python | gpl-3.0 | 2,446 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""""""
import tkinter as tk
__title__ = "MenuEntity"
__author__ = "DeflatedPickle"
__version__ = "1.0.0"
class MenuEntity(tk.Menu):
def __init__(self, parent, **kwagrs):
tk.Menu.__init__(self, parent, **kwagrs)
self.parent = parent
| DeflatedPickle/Colony | menus/menuentity.py | Python | mit | 303 |
# (c) Copyright [2016] Hewlett Packard Enterprise Development LP
#
# 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 r... | hpe-storage/python-hpedockerplugin | source/hpedockerplugin/hpe/hpe_3par_iscsi.py | Python | apache-2.0 | 23,765 |
# Copyright 2021 The Cirq 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | quantumlib/Cirq | dev_tools/notebooks/__init__.py | Python | apache-2.0 | 695 |
"""
Tests for the KISSinsights template tags and filters.
"""
import pytest
from django.contrib.auth.models import AnonymousUser, User
from django.template import Context
from django.test.utils import override_settings
from utils import TagTestCase
from analytical.templatetags.kiss_insights import KissInsightsNode
fr... | jcassee/django-analytical | tests/unit/test_tag_kiss_insights.py | Python | mit | 2,163 |
#/usr/bin/python
# -*- coding: utf-8
import json
from osgeo import ogr,gdal
import threading
import os
import subprocess
import time
import numpy
import urllib
import shapely.wkt
import shapely.geometry
import sys
import shutil
class CompoShp:
def __init__(self, path_shp):
self.shp = ogr.Open(path_shp)
self.laye... | picardie-nature/composite | composite.py | Python | gpl-2.0 | 7,055 |
#!/usr/bin/python3
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--verbosity", help='increase output verbosity.')
args = parser.parse_args()
if args.verbosity:
print("verbosity turned on") | Og192/Python | pythonLearning/argparse/optionalArguments.py | Python | gpl-2.0 | 219 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.