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 a10sdk.common.A10BaseClass import A10BaseClass
class Stats(A10BaseClass):
"""This class does not support CRUD Operations please use parent.
:param sync_tx_create_ext_bit_counter: {"description": "Conn Sync Create with Ext Sent counter", "format": "counter", "type": "number", "oid": "29", "optional"... | amwelch/a10sdk-python | a10sdk/core/vrrp/vrrp_a_state_stats.py | Python | apache-2.0 | 19,224 |
"""
Unit tests for the part model database migrations
"""
from django_test_migrations.contrib.unittest_case import MigratorTestCase
from InvenTree import helpers
class TestForwardMigrations(MigratorTestCase):
"""
Test entire schema migration sequence for the part app
"""
migrate_from = ('part', hel... | inventree/InvenTree | InvenTree/part/test_migrations.py | Python | mit | 1,487 |
"""Copyright 2014 Cyrus Dasadia
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
distr... | CitoEngine/cito_engine | app/appauth/models.py | Python | apache-2.0 | 1,044 |
import itertools
import subprocess
from collections import OrderedDict
from datetime import timedelta
import django_filters
from django.http.response import StreamingHttpResponse, JsonResponse
from django.utils.html import escape
from django.views import View
from django_filters.rest_framework import DjangoFilterBacke... | den1den/web-inf-ret-ml | frontend/api/views.py | Python | mit | 4,945 |
# This file is part of HDL Checker.
#
# Copyright (c) 2015 - 2019 suoto (Andre Souto)
#
# HDL Checker 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 ... | suoto/hdlcc | hdl_checker/path.py | Python | gpl-3.0 | 4,517 |
#!/usr/bin/env python
#
# A filesystem that maps a Python namespace to directories and files.
#
# Copyright (c) 2014 Murat Knecht
# License: MIT
#
from __future__ import print_function
from __future__ import absolute_import
import __builtin__
import errno
from itertools import chain, count
import os
import logging
im... | mknecht/pyfs | pyfs/filesystem.py | Python | mit | 5,377 |
import json, sys, glob, datetime, math, random, pickle, gzip
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import chainer
from chainer import computational_graph as c
from chainer import cuda
import chainer.functions as F
from chainer import optimizers
class AutoEncoder:
def __init... | miyamotok0105/deeplearning-sample | src/chainer1.7/ae/train.py | Python | mit | 2,598 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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 So... | Alignak-monitoring/alignak | tests/test_end_parsing_types.py | Python | agpl-3.0 | 10,949 |
import unittest
import numpy
import six
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
if cuda.available:
cuda.init()
class TestMaxPooling2D(unittest.Tes... | bayerj/chainer | tests/functions_tests/test_pooling_2d.py | Python | mit | 6,112 |
print '... Importing simuvex/storage/memory.py ...'
from angr.storage.memory import *
| angr/simuvex | simuvex/storage/memory.py | Python | bsd-2-clause | 86 |
import autoflake
from coalib.bears.LocalBear import LocalBear
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.results.Diff import Diff
from coalib.results.Result import Result
class PyUnusedCodeBear(LocalBear):
LANGUAGES = {'Python', 'Python 2', 'Python 3'}
REQUIREMEN... | horczech/coala-bears | bears/python/PyUnusedCodeBear.py | Python | agpl-3.0 | 1,681 |
import time
class Solution(object):
def maxProduct(self, words):
"""
:type words: List[str]
:rtype: int
"""
'''
ls=[]
for i in xrange(len(words)):
for j in xrange(i,len(words)):
if set(words[i])&set(words[j])==set([]):
s=len(words... | HalShaw/Leetcode | py/Maximum Product of Word Lengths.py | Python | mit | 1,035 |
from __future__ import division
import numpy as np
def net_input(xi, weights):
return np.dot(xi, weights[1:]) + weights[0]
def predict(xi, weights):
return np.where(net_input(xi, weights) >= 0, 1, -1)
def fit(X, y, learning_rate=0.01, iterations=10):
number_of_features = X.shape[1]
weights = np.zeros... | fernandezpablo85/jupyterml | python-ml-book/code/perceptron.py | Python | mit | 801 |
from django.shortcuts import redirect
from random import choice
paises = ['Colombia','Mexico','Canada']
def de_donde_vengo(request):
return choice(paises)
#return 'Colombia'
class PaisMiddleware():
def process_request(self,request):
pass
#pais = de_donde_vengo(request)
#if pais == 'Mexico':
# return re... | debian789/suescunet | middleware.py | Python | gpl-2.0 | 357 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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': ['preview'],
... | hryamzik/ansible | lib/ansible/modules/network/aci/aci_epg_to_domain.py | Python | gpl-3.0 | 12,442 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2010 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... | OpenClovis/SAFplus-Availability-Scalability-Platform | src/ide/genshi/genshi/template/tests/eval.py | Python | gpl-2.0 | 31,909 |
from documents.models import Document
from categories.models import Category
import os
def move_doc(doc_id, cat_id):
doc = Document.objects.get(pk=int(doc_id))
old_cat = doc.refer_category
new_cat = Category.objects.get(pk=int(cat_id))
for p in doc.pages.all():
cmd = "mv " + p.get_absolute_pat... | Foxugly/MyTaxAccountant | scripts/move_document.py | Python | agpl-3.0 | 504 |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret the config file for Python... | smeggingsmegger/impression | alembic/env.py | Python | bsd-3-clause | 2,627 |
"""
WSGI config for ecit 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_APPLICATION`` set... | mdavidsaver/inventory | inventory/wsgi.py | Python | agpl-3.0 | 1,342 |
"""This module contains helper code used by :mod:`tests.foreman` module.
This module is subservient to :mod:`tests.foreman`, and exists solely for the
sake of helping that module get its work done. For example,
:mod:`tests.foreman.cli` relies upon :mod:`robottelo.cli`. More generally:
code in :mod:`tests` calls code ... | rplevka/robottelo | robottelo/__init__.py | Python | gpl-3.0 | 376 |
from django import forms
from restaurants.models import RestaurantLocation
from .models import Item
class ItemForm(forms.ModelForm):
class Meta:
model = Item
fields = [
'restaurant',
'name',
'contents',
'excludes',
'public'
]
... | madebydaniz/django1-11 | src/menus/forms.py | Python | mit | 517 |
# Generated by Django 1.9 on 2016-01-05 20:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('explorer', '0004_querylog_duration'),
]
operations = [
migrations.AlterField(
model_name='query',
name='snapshot',
... | groveco/django-sql-explorer | explorer/migrations/0005_auto_20160105_2052.py | Python | mit | 439 |
from unittest import TestCase
from sitemap import sitemap
class TestSiteMap(TestCase):
def setUp(self):
self.url = 'https://konstantinfarrell.github.io'
self.bigger_site = 'https://raspberrypi.org'
self.biggest_site = 'https://learnxinyminutes.com'
def test_sitemap(self):
resu... | konstantinfarrell/sitemap3 | tests/test_sitemap.py | Python | mit | 620 |
# -*- coding: utf-8 -*-
"""
Maak eens een koelkast van die diepvriezer.
Hang node N06 in de diepvriezer, en plug de jeelink op de pi.
Zet ook de energenie module op de py en sluit de diepvriezer aan
op stopcontact "1" van energenie.
Start dit python script, en start ook de flask website
koelvriezer_flask.py in folder ... | saroele/serres | code/koelvriezer.py | Python | gpl-3.0 | 1,623 |
# https://oj.leetcode.com/problems/valid-sudoku/
# Note that the problem is to find whether the sudoku is valid, not whether it is solvable.
# Validate the sudoku in a dumb way (brute-force). Nothing fancy here.
class Solution:
# @param board, a 9x9 2D array
# @return a boolean
def isValidSudoku(self, bo... | lijunxyz/leetcode_practice | valid_sudoku_easy/Solution1.py | Python | mit | 2,226 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | panmari/tensorflow | tensorflow/python/summary/event_multiplexer_test.py | Python | apache-2.0 | 8,908 |
"""Tests clock timing between frames and estimations
of frames per second.
"""
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import time
import unittest
from pyglet import clock
class ClockTimingTestCase(unittest.TestCase):
def setUp(self):
# since clock is global,
# we initialize a... | nicememory/pie | pyglet/tests/unit/test_clock_fps.py | Python | apache-2.0 | 2,933 |
#!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return "Hello, World!"
if __name__ == "__main__":
app.run(debug=True) # listen on localhost ONLY
# app.run(debug=True, host='0.0.0.0') # listen on all public IPs
| jabbalaci/PrimCom | data/flask/hello.py | Python | gpl-2.0 | 285 |
# Simulation script for Nessi: ARQ protocols
#
# Copyright (c) 2003-2007 Juergen Ehrensberger
#
# 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 op... | jehrensb/Nessi | Examples/liaison-arq.py | Python | gpl-2.0 | 4,945 |
from config.server import IDLE_CONNECTION_TIMEOUT
from core import FM
class ReadImages(FM.BaseAction):
def __init__(self, request, paths, **kwargs):
super(ReadImages, self).__init__(request=request, **kwargs)
self.paths = paths
def run(self):
request = self.get_rpc_request()
... | LTD-Beget/sprutio | app/modules/home/actions/files/read_images.py | Python | gpl-3.0 | 621 |
#!/usr/bin/env python
# Copyright (c) 2012, Vasilis Pappas <vpappas@cs.columbia.edu>
# This file is part of Orp http://nsl.cs.columbia.edu/projects/orp
import time
import pickle
import optparse
import itertools
import sys
import inp
import func
import gadget
import swap
import preserv
import equiv
import reorder
de... | kevinkoo001/ropf | eval.py | Python | bsd-3-clause | 19,617 |
from .analyticord import *
from .errors import *
__version__ = '0.3.0'
| Analyticord/module-python | analyticord/__init__.py | Python | mit | 72 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
if db.backend_name == 'mysql':
db.execute('SET storage_engine=INNODB')
def forwards(self, orm):
# Adding field 'Host.host_repo... | VPAC/patchman | patchman/hosts/migrations/0003_auto__add_field_host_host_repos_only.py | Python | gpl-3.0 | 7,271 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (C) 2011 Joe Simpson headangerkenny@googlemail.com
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Fre... | kennydude/One-Click-Installer | one_click_installer_lib/helpers.py | Python | gpl-3.0 | 3,803 |
"""
WSGI config for openshift project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
if os.envi... | harryface/__1255548754516tftffvvgcgvgvg | wsgi.py | Python | gpl-3.0 | 868 |
# -*- coding: utf-8 -*-
import web
class BasePresenter:
def POST(self, *args, **kwargs):
self.method = 'POST'
return self.request(*args, **kwargs)
def GET(self, *args, **kwargs):
self.method = 'GET'
return self.request(*args, **kwargs)
def request(self):
raise Exce... | murdej/mcms | presenters.py | Python | gpl-2.0 | 580 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of Sick Beard.
#
# Sick Beard 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 Lice... | rleadbetter/Sick-Beard | sickbeard/providers/generic.py | Python | gpl-3.0 | 14,545 |
#!/usr/bin/env python3
#
# Copyright (c) 2017 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
import sys
from enum import Enum
class Retval(Enum):
VOID = 0
U32 = 1
U64 = 2
def gen_macro(ret, argc):
if ret == Retval.VOID:
suffix = "_VOID"
elif ret == Retval.U64:
suffix ... | kraj/zephyr | scripts/gen_syscall_header.py | Python | apache-2.0 | 5,026 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from __future__ import unicode_literals, absolute_import
from os.path... | abaldwin1/thumbor | tests/engines/test_pil.py | Python | mit | 4,419 |
# Copyright 2017 Become Corp. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | becomejapan/yahooads-python-lib | examples/CampaignTargetService/CampaignTargetService_mutate_SET.py | Python | apache-2.0 | 3,993 |
import logging
import re
import types
import warnings
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.mixins import AccessMixin
from django.contrib.auth.models import Group
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from dja... | tejoesperanto/pasportaservo | core/auth.py | Python | agpl-3.0 | 12,693 |
#!/usr/bin/python
import connectVSD
import importlib
import sys
import argparse
import logging
import requests
from pathlib import Path
import glob
import time
import dicom #pip install pydicom
#importlib.reload(connectVSD)
def UploadFiles(filenames, con, retry):
uploadedObjects= {}
filesInError = []
nfi... | livia-b/vsdConnect | examples/uploadFileSeries.py | Python | bsd-2-clause | 8,068 |
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pub... | ingadhoc/stock | stock_batch_picking_ux/__manifest__.py | Python | agpl-3.0 | 1,677 |
# -*- coding: UTF-8 -*-
getPrivateBlockDeviceTemplateGroups = [{
'accountId': 1234,
'blockDevices': [],
'createDate': '2013-12-05T21:53:03-06:00',
'globalIdentifier': 'E6DBD73B-1651-4B28-BCBA-A11DF7C9D79E',
'id': 200,
'name': 'test_image',
'parentId': '',
'publicFlag': False,
}, {
'... | nanjj/softlayer-python | SoftLayer/fixtures/SoftLayer_Account.py | Python | mit | 15,408 |
import os
import shutil
import pytest
from base64 import b64encode
from passlib.apps import custom_app_context
from werkzeug.datastructures import FileStorage
from extrapypi.app import create_app
from extrapypi.extensions import db as _db
from extrapypi.models import Package, User, Release
@pytest.fixture(scope='ses... | karec/extrapypi | tests/conftest.py | Python | mit | 6,730 |
#
# 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... | mrkm4ntr/incubator-airflow | airflow/sensors/time_delta_sensor.py | Python | apache-2.0 | 1,807 |
from future import standard_library
standard_library.install_aliases()
from builtins import object
try:
import pickle as pickle
except ImportError:
import pickle
class Base(object):
'''
Queue/Stack base class
'''
def __init__(self, server, key, encoding=pickle):
'''Initialize the redi... | istresearch/scrapy-cluster | utils/scutils/redis_queue.py | Python | mit | 4,196 |
#!/usr/bin/env python
##
## See COPYING file distributed along with the ncanda-data-integration package
## for the copyright and license terms
##
"""
Generate a plot of the SNR across NCANDA sites.
"""
import os
import glob
import dateutil
import pandas as pd
import lxml.etree as etree
import matplotlib.pyplot as ... | sibis-platform/ncanda-datacore | scripts/reporting/generate_adni_phantom_plots.py | Python | bsd-3-clause | 2,017 |
import _plotly_utils.basevalidators
class SizesrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="sizesrc", parent_name="surface.hoverlabel.font", **kwargs
):
super(SizesrcValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/python-api | packages/python/plotly/plotly/validators/surface/hoverlabel/font/_sizesrc.py | Python | mit | 468 |
__author__ = 'Viktor Kerkez <alefnula@gmail.com>'
__date__ = '19 January 2013'
__copyright__ = 'Copyright (c) 2013 Viktor Kerkez'
from .token import *
from .style import *
from .lexer import *
from .formatter import *
__all__ = ['Token', 'Lexer', 'RegexLexer', 'Formatter', 'ConsoleFormatter',
'Style', 'Sty... | alefnula/samovar | src/samovar/parsing/__init__.py | Python | bsd-3-clause | 355 |
import ocl
import camvtk
import time
import vtk
import datetime
import math
import random
import gc
def drawVertex(myscreen, p, vertexColor, rad=1):
myscreen.addActor( camvtk.Sphere( center=(p.x,p.y,p.z), radius=rad, color=vertexColor ) )
def drawEdge(myscreen, e, edgeColor=camvtk.yellow):
p1 = e[0]
p2 = ... | AlanZatarain/opencamlib | scripts/voronoi/voronoi_6_dt.py | Python | gpl-3.0 | 7,782 |
from chapter06.exercise6_5_8 import merge_sorted_lists
from chapter10.exercise10_2_1 import singly_linked_list_insert, singly_linked_list_delete
from chapter11.textbook_problem11_5 import perfect_hashing_search, perfect_hashing_init
from datastructures.array import Array
from datastructures.list import List, SNode
de... | wojtask/CormenPy | src/chapter10/problem10_2.py | Python | gpl-3.0 | 3,416 |
# -*- coding: utf-8 -*-
# Memoria virtual
from memory import *
from semantics import *
from math import *
# Función de la memoria virtual encargada de resolver los cuádruplos generados
def solve():
# Cuádruplo inicial
current_quadruple = 0
# Inicializar memoria global
global_memory = Memory('global', global_di... | mbenitezm/ViLe | vm.py | Python | mit | 22,694 |
'''Forced Choice
=================
Experiment that asks the subject to choose between two sides in response to
a trained stimulus in order to get rewarded.
'''
__version__ = '0.1-dev'
| matham/forced_choice | forced_choice/__init__.py | Python | mit | 187 |
#!/usr/bin/env python
# coding=utf8
import os
import json
import time, datetime
from model.setting import withBase, basecfg
from flask import Blueprint, request, Response, render_template, g
from rest import api
from model.base import Article
from . import exepath, allowed
@api.route('/article', methods=['POST'])
@api... | listen-lavender/pholcus | gds/blueprint/api/article.py | Python | mit | 2,139 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010, 2011, 2012, 2013 Sebastian Wiesner <lunaryorn@gmail.com>
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2.1 of the License, ... | mbusb/multibootusb | scripts/pyudev/pyside.py | Python | gpl-2.0 | 1,976 |
#!/usr/bin/python
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright n... | tnadeau/pybvc | samples/samplenetconf/demos/vr_demo5.py | Python | bsd-3-clause | 6,585 |
#!/usr/bin/env python
from __future__ import print_function
import sys
import string
import pmagpy.pmag as pmag
def main():
"""
NAME
mk_redo.py
DESCRIPTION
Makes thellier_redo and zeq_redo files from existing pmag_specimens format file
SYNTAX
mk_redo.py [-h] [command line opt... | Caoimhinmg/PmagPy | programs/mk_redo.py | Python | bsd-3-clause | 3,328 |
try: paraview.simple
except: from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()
ImageMathematics()
| jeromevelut/Peavip | Testing/ImageMathematics.py | Python | gpl-3.0 | 129 |
from web.web_application import WebApplication
def main():
webapp = WebApplication()
webapp.run()
if __name__=='__main__':
main()
| cs207-project/TimeSeries | go_web.py | Python | mit | 144 |
"""
matrix-api v0.1
@author Ben Hansen
@created on 04/11/2016
binaryop.py
JSON Schema for endpoints that perform binary
matrix operations. Specifies the structure
and types required in order for the request body to
be considered valid.
"""
binaryop = {
'operands': {
'lvalue': list,
'rvalue': list
... | ben-hunter-hansen/matrix-api | app/schema/binaryop.py | Python | mit | 328 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking corpus I/O formats (the corpora package).
"""
import logging
import os.path
import unittest
import tem... | krishna11888/ai | third_party/gensim/gensim/test/test_corpora.py | Python | gpl-2.0 | 11,354 |
"""
The following script creates a geotiff of vessel density for a given calendar date
usage:
! python daily_raster_fishing_effort.py yyyymmdd
The code for downloading a table from BigQuery was written by Tim Hochberg:
https://github.com/GlobalFishingWatch/nn-vessel-classification/blob/master/tah-proto/get-data/gcto... | GlobalFishingWatch/psychic-guide-squirrel | raster_development/daily_raster_fishing_effort.py | Python | apache-2.0 | 8,359 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2016-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free S... | V155/qutebrowser | qutebrowser/browser/webengine/webenginequtescheme.py | Python | gpl-3.0 | 5,027 |
import datetime
from django.conf import settings
from haystack import indexes
from .models import JobsData
class JobsDataIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
added_on = indexes.DateTimeField(model_attr='added_on')
def get_model(self... | timkofu/jobhuntr | search/search_indexes.py | Python | mit | 590 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | boedy1996/SPARC | geonode/geoserver/helpers.py | Python | gpl-3.0 | 54,697 |
import logging
from django.core.mail import EmailMessage
from django.http import JsonResponse
from django.middleware import csrf
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import redirect
from rest_framework.decorators import api_view
from .models import Mail
@csrf_exempt
@api_view(['... | Connexions/openstax-cms | mail/views.py | Python | agpl-3.0 | 1,912 |
#!/usr/bin/python -d
#
# Copyright (C) 2016 Reinhard Fleissner
#
# 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.
#
# Th... | rfleissner/ChEsher | py/py/profileWriter.py | Python | gpl-2.0 | 27,568 |
#
# (c) 2016, Sumit Kumar <sumit4@netapp.com>
# (c) 2016, Michael Price <michael.price@netapp.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 ... | alexanderturner/ansible | lib/ansible/module_utils/netapp.py | Python | gpl-3.0 | 4,882 |
#!/usr/bin/python3
import re
import sys
######## Global Variables
# Stacks
dictionary = []
execution = []
operand = []
# Sept 21, 2011 -- fixed the handling of }{ -- each brace should be a separate token
# A regular expression that matches postscript each different kind of postscript token
pattern = '/?[a-zA-Z][a-zA-... | vonderborch/CS355 | sps - working/sps.py | Python | mit | 9,305 |
# -*- coding: utf-8 -*-
# Stalker a Production Asset Management System
# Copyright (C) 2009-2014 Erkan Ozgur Yilmaz
#
# This file is part of Stalker.
#
# 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... | iyyed/stalker-pyramid | stalker_pyramid/views/entity.py | Python | gpl-3.0 | 24,213 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
class modify(object):
def __init__(self, target, save=False,... | suutari/shoop | shuup_tests/core/utils.py | Python | agpl-3.0 | 922 |
#
# MLDB-1594-aggregator-empty-row.py
# mldb.ai inc, 2016
# this file is part of mldb. copyright 2016 mldb.ai inc. all rights reserved.
#
import unittest
from mldb import mldb, MldbUnitTest, ResponseException
class Mldb1594(MldbUnitTest):
def test_simple(self):
res1 = mldb.query("select {}")
r... | mldbai/mldb | testing/MLDB-1594-aggregator-empty-row.py | Python | apache-2.0 | 1,755 |
# $Id$
#
# pjsua2 Setup script.
#
# Copyright (C)2012 Teluu Inc. (http://www.teluu.com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) a... | xiejianying/pjsip | pjsip-apps/src/swig/python/setup.py | Python | gpl-2.0 | 3,420 |
# 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_11_01/aio/operations/_service_tags_operations.py | Python | mit | 4,506 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests haystack.basicmodel ."""
import logging
import sys
import unittest
from haystack import cliwin
from test.haystack import SrcTests
class TestCLI(SrcTests):
def test_find_heap(self):
# haystack-find-heap
args = ['haystack-find-heap', '-v', '... | trolldbois/python-haystack | test/haystack/test_cliwin.py | Python | gpl-3.0 | 617 |
#!/usr/bin/env python
#------------------------------------------------------------------------------
# Copyright 2016 Esri
# 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... | Esri/ops-server-config | Utilities/BuildSceneCache.py | Python | apache-2.0 | 17,164 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-25 11:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('consent', '0013_auto_20170217_1606'),
]
operations = [
migrations.AlterFiel... | aakashrana1995/svnit-tnp | tnp/consent/migrations/0014_auto_20170325_1723.py | Python | mit | 523 |
#
# 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 | tests/sensors/test_sql_sensor.py | Python | apache-2.0 | 9,390 |
import time
from nive.definitions import *
from nive.security import User
from nive.tests import db_app
level1 = 5
level2 = 30
level3_1 = 9
level3_2 = 10
def test1():
print "1) Testing objects create / delete, 3 level, no files"
t = time.time()
a=db_app.app_db()
print time.time() - t, "Creating... | nive-cms/nive | nive/tests/appPy_batch.py | Python | gpl-3.0 | 8,067 |
# -*- coding=utf-8 -*-
LANGUAGES = [
["0", u"Anglais"],
["1", u"Arabe"],
["2", u"Chinois"],
["3", u"Espagnol"],
["4", u"Français"],
["5", u"Russe"],
["6", u"Albanais"],
["7", u"Allemand"],
["8", u"Arménien"],
["9", u"Aymara"],
["10", u"Bengalî"],
["11", u"Catalan"],
... | huguesmayolle/famille | famille/data.py | Python | apache-2.0 | 2,148 |
# 1/29/2018 jchoy v0.173 all sdcard
#-*-coding:utf8;-*-
#qpy:3
"""
qpython webapp all sdcard
"""
from bottle import run, route, template, static_file
import socket
cfgData = {'port':8081, 'path':'/sdcard/'}
def cfg(k):
return cfgData[k]
def pyPath(s):
return cfg('path')+s
def getIp():
s= socket.socket( ... | YatneEigenCode/dentre-ortega | baolte-g/python-projects/WebAppSdcard/main.py | Python | gpl-2.0 | 961 |
"""pytest_needle.driver
.. codeauthor:: John Lane <jlane@fanthreesixty.com>
"""
import base64
from errno import EEXIST
import math
import os
import re
import sys
import pytest
from needle.cases import import_from_string
from needle.engines.pil_engine import ImageDiff
from PIL import Image, ImageDraw, ImageColor
from... | jlane9/pytest-needle | pytest_needle/driver.py | Python | mit | 13,087 |
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import os
from math import sqrt
from os.path import expanduser
def extract_patches(path, filename, out_path, patch_size, stride, visualize):
img = mpimg.imread(path+filename)
nRows, nCols, nColor = img.shape
psx, psy = p... | shengshuyang/StanfordCNNClass | shadow_project/extract_patches.py | Python | gpl-3.0 | 1,314 |
#!/usr/bin/env python
# Copyright (C) 2008 Sebastian Silva Fundacion FuenteLibre sebastian@fuentelibre.org
#
# HablarConSara.activity 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 Li... | walterbender/speak | bot/gen_brains.py | Python | gpl-3.0 | 1,331 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2009 Atommica. 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.... | Reflejo/pyrant | setup.py | Python | apache-2.0 | 1,772 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from contextlib import contextmanager
@contextmanager
def log(name):
print('[%s] start...' % name)
yield
print('[%s] end.' % name)
with log('DEBUG'):
print('Hello, world!')
print('Hello, Python!')
| whyDK37/py_bootstrap | samples/context/do_with.py | Python | apache-2.0 | 269 |
import os
import sys
import subprocess
import string
import random
bashfile=''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
bashfile='/tmp/'+bashfile+'.sh'
f = open(bashfile, 'w')
s = """#! /usr/bin/env bash
if [ "$#" != "1" ]; then
echo 'convert a bash file to python file'
echo 'e... | syuanca/bash2python | bash2python.sh.py | Python | apache-2.0 | 1,626 |
# -*- coding: utf-8 -*-
from contextlib import closing
from pyramid import testing
import pytest
import datetime
import os
from psycopg2 import IntegrityError
from webtest.app import AppError
from cryptacular.bcrypt import BCRYPTPasswordManager
from journal import connect_db
from journal import DB_SCHEMA
from journal ... | Jakeand3rson/learning_journal | test_journal.py | Python | mit | 9,025 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='pyspeedtin',
version='0.1.0',
description = 'Tool to upload performance data to SpeedTin',
author='Fabio Zadrozny',
url='https://www.speedtin.com',
packages=['pyspeedtin'],
)
... | fabioz/pyspeedtin | setup.py | Python | mit | 524 |
""" Mapping of URLs to methods for this app
"""
# Copyright 2010,2011 Good Energy Research Inc. <graham@goodenergy.ca>, <jeremy@goodenergy.ca>
#
# This file is part of Good Energy.
#
# Good Energy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General... | grahamking/goodenergy | action/urls.py | Python | agpl-3.0 | 1,707 |
import sys, os
import StringIO
#Makes sh scripts find modules.
sys.path.append(os.path.abspath("./"))
from printing import print_section
from storage import ParamStorage
from model import ConvModel
from aerial import Visualizer
from printing import print_action
import tools.util as Image
from interface.server import ... | olavvatne/CNN | tools/visualize/run.py | Python | mit | 2,644 |
# Copyright 2012 Nebula, 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 agree... | FNST-OpenStack/horizon | openstack_dashboard/dashboards/project/volumes/volumes/views.py | Python | apache-2.0 | 20,471 |
import pytest
from ckan_api_client.utils import freeze, FrozenDict, FrozenList
def test_frozendict():
my_dict = {
'key': 'DEFAULT',
}
my_frozen_dict = freeze(my_dict)
assert my_dict == my_frozen_dict
assert isinstance(my_frozen_dict, FrozenDict)
# -----------------------------------... | opendatatrentino/ckan-api-client | ckan_api_client/tests/unit/test_frozen_objects.py | Python | bsd-2-clause | 2,163 |
import json
import pytest
from mock.mock import Mock
from insights.core import filters
from insights.core.dr import SkipComponent
from insights.core.spec_factory import DatasourceProvider
from insights.specs import Specs
from insights.specs.datasources.cloud_init import cloud_cfg, LocalSpecs
CLOUD_CFG = """
users:
... | RedHatInsights/insights-core | insights/tests/datasources/test_cloud_init.py | Python | apache-2.0 | 3,823 |
"""Identify program versions used for analysis, reporting in structured table.
Catalogs the full list of programs used in analysis, enabling reproduction of
results and tracking of provenance in output files.
"""
from __future__ import print_function
import os
import contextlib
import subprocess
import sys
import yaml... | lbeltrame/bcbio-nextgen | bcbio/provenance/programs.py | Python | mit | 11,876 |
"""
Package resource API
--------------------
A resource is a logical file contained within a package, or a logical
subdirectory thereof. The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is. Do not use os.path operations to manipul... | blackbliss/medity-expo-2014 | remote-api/flask/lib/python2.7/site-packages/pkg_resources.py | Python | mit | 99,605 |
from __future__ import absolute_import, unicode_literals
import jinja2
from jinja2.ext import Extension
from .templatetags.wagtailcore_tags import pageurl, richtext, slugurl, wagtail_version
class WagtailCoreExtension(Extension):
def __init__(self, environment):
super(WagtailCoreExtension, self).__init_... | hamsterbacke23/wagtail | wagtail/wagtailcore/jinja2tags.py | Python | bsd-3-clause | 687 |
"""Tests for the utils module."""
from soco.utils import deprecated
# Deprecation decorator
def test_deprecation(recwarn):
@deprecated("0.7")
def dummy(args):
"""My docs."""
pass
@deprecated("0.8", "better_function", "0.12")
def dummy2(args):
"""My docs."""
pass
... | petteraas/SoCo | tests/test_utils.py | Python | mit | 912 |
#!/usr/bin/python
## AUTHOR: Eric Fontanillas
## LAST VERSION: 14.04.2011
## DESCRIPTION: merge read1.fastq and read2.fastq files (from illumina 1.5 outputs with different numbers of read1 and read2)and remove sequences with low quality Phred score (if too much B at the end of a reads)
import string, os, sys
#N=2... | abice-sbr/adaptsearch | 01_merge_paired_fastq_v4.0.py | Python | gpl-3.0 | 7,990 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.