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 rest_framework.permissions import BasePermission
class IsOwnerOrReadOnly(BasePermission):
def has_object_permission(self, request, view, obj):
return obj.user == request.user | videetssinghai/Blog-Rest-Api | posts/api/permissions.py | Python | mit | 196 |
from Bio import SeqIO
import os,subprocess
def change_ncbi_annotation_name(outputfile,inputfile,inter):
"""
this function changes the reference name of fasta file to accession number
eg: change '>gi|614415508|ref|NW_006834731.1| Cricetulus griseus unplaced genomic scaffold,
alternate assembly C_griseus... | shl198/Pipeline | DetectVirusPipeline/p02_ParseFasta.py | Python | mit | 4,637 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('datareturn', '0008_siteconfig_invite_email_postscript'),
]
operations = [
migrations.AddField(
model_name='sitec... | PersonalGenomesOrg/datareturn | datareturn/migrations/0009_siteconfig_home_page_summary.py | Python | mit | 444 |
#-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... | crwilcox/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/__init__.py | Python | apache-2.0 | 865 |
default_app_config = 'voxel_globe.meta.apps.MetaConfig' | ngageoint/voxel-globe | voxel_globe/meta/__init__.py | Python | mit | 55 |
#!/usr/bin/env python
import os
import re
from setuptools import find_packages, setup
def text_of(relpath):
"""
Return string containing the contents of the file at *relpath* relative to
this file.
"""
thisdir = os.path.dirname(__file__)
file_path = os.path.join(thisdir, os.path.normpath(rel... | python-openxml/python-docx | setup.py | Python | mit | 2,381 |
class Image:
def __init__(self, json_image):
self.id = json_image["id"]
self.name = json_image.get("name", "")
self.map_gamma = json_image.get("map_gamma", 0)
self.map_url = None
map = json_image.get("map", None)
if map and len(map) > 0:
self.map_url = map... | rykerp/bds-tools | types/image.py | Python | gpl-3.0 | 331 |
#!/usr/bin/env python
from setuptools import setup
setup(
name='DefectDojo',
version='1.5.4',
author='Greg Anderson',
description="Tool for managing vulnerability engagements",
install_requires=[
'defusedxml',
'Django==2.2.4',
'django-auditlog==0.4.0',
'django-custo... | OWASP/django-DefectDojo | setup.py | Python | bsd-3-clause | 2,072 |
"""This module defines classes for parsing BLAST output."""
import multiprocessing
import time
import sys
import os
import re
import math
from os import sys
import re, traceback
from glob import glob
try:
from libs.python_modules.utils.metapathways_utils import parse_command_line_parameters, fprintf, printf, epr... | kishori82/MetaPathways_Python.3.0 | libs/python_modules/parsers/blast.py | Python | mit | 14,857 |
import itertools
"""Implementation of the state pattern"""
class State(object):
"""Base state. This is to share functionality"""
def scan(self):
"""Scan the dial to the next station"""
print "Scanning... Station is", self.stations.next(), self.name
class AmState(State):
def __init__(se... | mabotech/maboss.py | libs/mabolab/mabolab/pattern/state01.py | Python | mit | 1,497 |
__author__ = 'Tianyu Dai (dtysky)'
from PIL import Image
import os, json
from ctypes import *
user32 = windll.LoadLibrary('user32.dll')
MessageBox = lambda x:user32.MessageBoxA(0, x, 'Error', 0)
FileFormat = ['.jpg', '.bmp']
Conf = json.load(open('../ImageForTest/conf.json', 'r'))['conf']
def show_error(e):
Messag... | wamgoo/FPGA-Imaging-Library | Geometry/Mirror/HDLSimDataGen/create.py | Python | lgpl-2.1 | 2,500 |
# 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 ... | annatisch/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/Http/autoresthttpinfrastructuretestservice/operations/http_client_failure_operations.py | Python | mit | 40,861 |
import unittest
from time import time
from emend import stubs
from emend.twitter import tweet, untweet
class TestTwitter(unittest.TestCase):
def setUp(self):
stubs.all()
def test_tweet_untweet(self):
status = "test %s" % int(time())
status_id = tweet(status=status)
self.assertTrue(status_id > 0,... | tantalor/emend | app/test/twitter_test.py | Python | mit | 567 |
#!/usr/bin/env python
from vtk import *
csv_source = vtkDelimitedTextReader()
csv_source.SetFieldDelimiterCharacters(",")
csv_source.SetHaveHeaders(True)
csv_source.SetDetectNumericColumns(True)
csv_source.SetFileName("authors.csv")
csv_source.Update()
T = csv_source.GetOutput()
print "Table loaded from ... | timkrentz/SunTracker | IMU/VTK-6.2.0/Examples/Infovis/Python/delimited_text_reader1.py | Python | mit | 344 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/steps/package/rpm/rpmbuild.py | Python | gpl-3.0 | 5,495 |
from typing import List, Optional
from fastapi import FastAPI
from fastapi.testclient import TestClient
from pydantic.dataclasses import dataclass
app = FastAPI()
@dataclass
class Item:
name: str
price: Optional[float] = None
owner_ids: Optional[List[int]] = None
@app.get("/items/valid", response_mode... | tiangolo/fastapi | tests/test_serialize_response_dataclass.py | Python | mit | 3,234 |
from CSL_Status_Codes import *
#from construct import *
from CSL_Structures import *
def connect_dec(func):
"""
"""
def func_wrapper(self, ip, port, ep_id):
"""
"""
# Call original function
func(self, ip, port, ep_id)
# Let NT layer handle conne... | anon38190/tcp_connector | CSL_Layers.py | Python | mit | 2,123 |
# Copyright 2015 datawire. 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 agr... | datawire/quark | quarkc/python.py | Python | apache-2.0 | 11,158 |
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks Inc.
# 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
import os
import sys
from ansible.module_utils.urls import open_url, fet... | KohlsTechnology/ansible | lib/ansible/module_utils/network/f5/icontrol.py | Python | gpl-3.0 | 12,393 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-09-26 16:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cerimonial', '0039_auto_20180926_1345'),
]
operations = [
migrations.AlterF... | interlegis/saap | saap/cerimonial/migrations/0040_auto_20180926_1350.py | Python | gpl-3.0 | 708 |
# -*- coding: utf-8 -*-
import flask
import functools
import logging
import requests
from .. import storage
from .. import toolkit
from . import cache
from . import config
DEFAULT_CACHE_TAGS_TTL = 48 * 3600
logger = logging.getLogger(__name__)
def is_mirror():
cfg = config.load()
return bool(cfg.get('mirr... | glenux/contrib-docker-registry | docker_registry/lib/mirroring.py | Python | apache-2.0 | 7,154 |
#!/usr/bin/env python3
import os
import sys
import random
import time
from random import seed, randint
import argparse
import platform
from datetime import datetime
import imp
import numpy as np
from myPersonalFunctions import *
# import matplotlib.pyplot as plt
# Useful codes
# os.system("awk '{print $NF}' all_wham.d... | luwei0917/awsemmd_script | quick.py | Python | mit | 5,448 |
#!/usr/bin/env python
"""
Show the size of a data structure in python
We can see that the size of the first array is about 4Mb
which makes sense if each int is 4 bytes.
"""
import sys
l = [x for x in range(1000000)]
print('getsizeof is [{0}]'.format(sys.getsizeof(l)))
| veltzer/demos-python | src/examples/short/memory/profiling.py | Python | gpl-3.0 | 273 |
#!/usr/bin/python
# (c) 2010 Luca Falavigna <dktrkranz@debian.org>
# Free software licensed under the GPL version 2 or later
import os
import sys
import fnmatch
from glob import glob
sys.path.append('../dak')
from daklib.dbconn import *
from daklib import utils
from daklib.queue import Upload
i = 0
t = 0
pattern = '*... | abhi11/dak | tools/import_changelogs.py | Python | gpl-2.0 | 1,098 |
from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "The Oatmeal"
language = "en"
url = "http://theoatmeal.com/"
rights = "Matthew Inman"
class Crawler(CrawlerBase):
history_capable_days = 90
... | jodal/comics | comics/comics/oatmeal.py | Python | agpl-3.0 | 799 |
# -*- coding: utf-8 -*-
'''
Use a git repository as a Pillar source
---------------------------------------
.. note::
This external pillar has been rewritten for the :doc:`2015.8.0
</topics/releases/2015.8.0>` release. The old method of configuring this
external pillar will be maintained for a couple relea... | smallyear/linuxLearn | salt/salt/pillar/git_pillar.py | Python | apache-2.0 | 16,836 |
"""
Adobe DNG SDK Conversion Process
================================
Defines various objects implementing raw conversion based on *Adobe DNG SDK*
and *dcraw*:
- :func:`colour_hdri.convert_raw_files_to_dng_files`
- :func:`colour_hdri.convert_dng_files_to_intermediate_files`
- :func:`colour_hdri.read_dng_files_e... | colour-science/colour-hdri | colour_hdri/process/dng.py | Python | bsd-3-clause | 12,294 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | ClearCorp-dev/odoo-costa-rica | l10n_cr_account_banking_cr_bcr/bcr_format.py | Python | agpl-3.0 | 6,347 |
# -*- coding: utf-8 -*-
# © 2016 Comunitea - Javier Colmenero <javier@comunitea.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
import res_partner
import account | Comunitea/CMNT_00098_2017_JIM_addons | partner_consolidate/models/__init__.py | Python | agpl-3.0 | 184 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
AlgorithmDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***********************... | asiersarasua/QGIS | python/plugins/processing/gui/AlgorithmDialog.py | Python | gpl-2.0 | 15,349 |
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can redistribute it and/or mo... | gam-phon/taiga-back | taiga/auth/tokens.py | Python | agpl-3.0 | 2,045 |
#!/usr/bin/env python
# encoding: utf-8
'''
This module is used to convert diction to xml and convert xml to diction
usage:
import simplexml
simplexml.dumps(dict) # output xml string
simplexml.loads(xml) # output python dict
changelist:
0.2: add unicode support.
'''
__version__ = 0.2
__author__ = ... | countrymarmot/simplexml | simplexml.py | Python | mit | 4,804 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Fekete Mihai <mihai.fekete@forbiom.eu>
# Copyright (C) 2014 FOREST AND BIOMASS SERVICES ROMANIA SA
# (http://www.forbiom.eu).
#
# This program is free software: you can redistribute it and/or... | yoyo2k/l10n-romania | l10n_ro_siruta/res_partner.py | Python | agpl-3.0 | 1,820 |
#!/usr/bin/env python
import os, sys, xmlrpclib, socket
print "KestrelHPC RPC debugging util"
try:
s = xmlrpclib.ServerProxy("http://localhost:8000")
if not os.path.exists("output"):
print "Output file not found: Start kestrel_rpc.py"
sys.exit(1)
# Clear output's contents
f = op... | KestrelCluster/KestrelCluster | rpc/client.py | Python | gpl-2.0 | 1,252 |
"""FastEMD - python wrapper of the FastEMD algorithm
CellProfiler is distributed under the GNU General Public License,
but this file is licensed under the more permissive BSD license.
See the accompanying file LICENSE for details.
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2015 B... | LeeKamentsky/CellProfiler | cellprofiler/cpmath/fastemd.py | Python | gpl-2.0 | 1,354 |
# -*- coding: utf-8 -*-
"""Component controller module"""
# turbogears imports
from tgext.crud import CrudRestController
from tg import expose, tmpl_context
#from tg import redirect, validate, flash
# third party imports
from sprox.formbase import AddRecordForm, EditableForm
from sprox.tablebase import TableBase
from... | jokajak/itweb | libs/itweb/itweb/controllers/component.py | Python | gpl-3.0 | 2,997 |
# -*- coding: utf-8 -*-
#
# Copyright 2014 - Intel
#
# 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 app... | sjcazzol/python-healingclient | healingclient/commands/handlers.py | Python | apache-2.0 | 1,469 |
# -*- coding: utf-8 -*-
import sys
PY3 = False
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
if PY3:
import urllib.parse as urlparse # Es muy lento en PY2. En PY3 es nativo
else:
import urlparse ... | alfa-addon/addon | plugin.video.alfa/channels/pelisxporno.py | Python | gpl-3.0 | 2,824 |
#!/usr/bin/python -B
################################################################################
# Copyright (c) 2014 Phil Smith
#
# 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... | civissmith/WeMo | client.py | Python | mit | 3,178 |
#!/usr/bin/env python
import jhtalib as jhta
import matplotlib.pyplot as plt
def main():
df = jhta.CSV2DF('data.csv')
x = df['datetime']
plt.figure(1)
plt.subplot(211)
plt.title('Time / Price / Ratio')
plt.xlabel('Time')
plt.ylabel('Price')
plt.grid(True)
plt.plot(x, df['Close'... | joosthoeks/jhTAlib | example/example-3-plot.py | Python | gpl-3.0 | 644 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'dialog.ui'
#
# Created: Wed Apr 16 16:28:01 2014
# by: PyQt5 UI code generator 5.2.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MathDoku(object):
def setupUi(self, ... | g-goessel/mathdoku_solve | t.py | Python | mpl-2.0 | 2,509 |
import argparse
import multiprocessing
import os
import sys
from configparser import ConfigParser
from configparser import ExtendedInterpolation
from pathlib import Path
from typing import Any
from typing import AnyStr
from maps_generator.utils.md5 import md5_ext
from maps_generator.utils.system import total_virtual_m... | matsprea/omim | tools/python/maps_generator/generator/settings.py | Python | apache-2.0 | 9,344 |
import os
from flask import Flask, render_template, abort, request, redirect, \
send_from_directory
import weather
import kites
import noaa
import utils
app = Flask(__name__)
DEBUG = False if os.environ['CIFMK_DEBUG'].upper() == 'FALSE' else True
# these break Wunderground if in the query to the A... | joelwilson/caniflymykite | cifmk.py | Python | gpl-3.0 | 2,917 |
import logging, logging.handlers
import sys
logging.handlers.HTTPHandler('','',method='GET')
logger = logging.getLogger('simple_example')
# http_handler = logging.handlers.HTTPHandler('127.0.0.1:9022', '/event', method='GET')
http_handler = logging.handlers.HTTPHandler('127.0.0.1:9999', '/httpevent', method='GET')
... | edx/edxanalytics | src/util/playback.py | Python | agpl-3.0 | 1,385 |
#!/usr/bin/env python
from __future__ import print_function
import multiprocessing
import gunicorn.app.base
from gunicorn.six import iteritems
import os, sys
import re
import shutil
import tempfile
import pyferret
from paste.request import parse_formvars
import subprocess
from jinja2 import Template
import itertoo... | KatiRG/wms-pyferret | pyferretWMS_flask.py | Python | mit | 14,186 |
import sys
import os
import pandas as pd
from collections import defaultdict
import numpy as np
dirname = sys.argv[1]
path = os.path.join(dirname, "weights.tsv")
with open(path ,"r") as f:
df = pd.read_csv(f, sep="\t")
df = df[df["iter"] == 5]
fc2r = defaultdict(list)
features = set()
for event, event_df in df.... | kedz/cuttsum | trec2015/sbin/cross-validation/best-feats.py | Python | apache-2.0 | 1,444 |
"""
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorder it to {1,4,2,3}.
Key idea:
Use fast and slow pointer to find the mid of the link list
reverse the right hand side
combine the t... | urashima9616/Leetcode_Python | Leet143.ReorderedList.py | Python | gpl-3.0 | 2,158 |
# -*- coding: utf-8 -*-
r"""This file is part of SkyLab
Skylab 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... | kkrings/skylab | skylab/utils.py | Python | gpl-3.0 | 18,124 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Category'
db.create_table('stories_category', (
('id', self.gf('django.db.mode... | hawkerpl/k2 | stories/migrations/0001_initial.py | Python | gpl-2.0 | 21,006 |
ADDRESS_COMPONENT_TYPES = (
'street_address', # indicates a precise street address.
'route', # indicates a named route (such as "US 101").
'intersection', # indicates a major intersection, usually of two major roads.
'political',
# indicates a political entity.
# Usually, this type indicates ... | zapcoop/vertex | vertex_api/places/constants.py | Python | agpl-3.0 | 3,853 |
import unittest
import mod
class Tests(unittest.TestCase):
def test_func(self):
self.assertEqual(mod.func(), 1234) | sixty-north/cosmic-ray | docs/source/tutorials/intro/test_mod.1.py | Python | mit | 128 |
# -*- coding: utf-8 -*-
import llbc
def pyllbcEnum(*sequential, **named):
"""
The enum helper function.
"""
enums = dict(zip(sequential, range(len(sequential))), **named)
return type('Enum', (), enums)
llbc.Enum = pyllbcEnum
| lailongwei/llbc | wrap/pyllbc/script/common/Enum.py | Python | mit | 249 |
# (c) 2016, Bill Wang <ozbillwang(at)gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | BWITS/ssm_parameter_store | lookup/ssm.py | Python | gpl-3.0 | 3,430 |
#
# httpdownloader.py
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
# Deluge is free software.
#
# You may 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 late... | Tydus/deluge | deluge/httpdownloader.py | Python | gpl-3.0 | 8,521 |
# Use the file name mbox-short.txt as the file name
fname = raw_input("Enter file name: ")
try:
fh = open(fname)
numberOfMatches = 0
totalConfidence = 0
for line in fh:
if not line.startswith("X-DSPAM-Confidence:"):
continue
#increase sum of confidence
totalConfidenc... | peasfrog/coursera | Python/DataStructs 6-10/7/7.2.py | Python | mit | 636 |
# -*- coding: utf-8 -*-
#!/usr/bin/python3
import re
import urllib.request
from bs4 import BeautifulSoup
from collections import OrderedDict
page = urllib.request.urlopen('http://oracle-web.zfn.uni-bremen.de/essen/mensa').read()
soup = BeautifulSoup(page, "html.parser")
soup.prettify()
menuItems = soup.findAll('font... | vvps/Uni-Bremen-Mensa | essen.py | Python | mit | 1,133 |
from chaosc.transcoders import *
transcoders = [
#AddressRegExChanger("/client(\d+)/(\d+)", "/massive%d/osc%d/freq"),
#DampValue("/massive(\d+)/osc(\d+)/freq", 0.5),
MidiChanger(
"/1/fader(\d+)",
"/midi/cc",
[
["member", "channel", "osc_arg", 0, "int"],
["reg... | DerLiveCode/chaosc | examples/configuration/transcoding/transcoding_config.py | Python | gpl-3.0 | 431 |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import sys
import csv
import shutil
import pickle
from indra import reach
from indra.util import read_unicode_csv
from indra.literature import pmc_client, get_full_text, id_lookup
from assembly_eval import ... | jmuhlich/indra | indra/benchmarks/assembly_eval/batch4/run_reach_eval.py | Python | bsd-2-clause | 1,171 |
# -*- coding: utf-8 -*-
import logging
from django.contrib.auth.models import User
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from .signals import order_status_changed
logger = logging.getLogger(__name__)
cl... | kmike/django-mailru-money | mailru_money/models.py | Python | mit | 3,783 |
import pytest
from fontbakery.parse import _style_parse, instance_parse
def test_name():
style = _style_parse("Extra-Bold")
assert style.name == "ExtraBold"
style = _style_parse("Extra Bold")
assert style.name == "ExtraBold"
style = _style_parse("Extra Bold Italic")
assert style.name == "Ext... | moyogo/fontbakery | tests/test_parse.py | Python | apache-2.0 | 1,511 |
from __future__ import division
import warnings
import numpy as np
from skimage.util.dtype import dtype_range
from skimage import draw
from skimage import measure
from .plotplugin import PlotPlugin
from ..canvastools import ThickLineTool
__all__ = ['LineProfile']
class LineProfile(PlotPlugin):
"""Plugin to co... | chintak/scikit-image | skimage/viewer/plugins/lineprofile.py | Python | bsd-3-clause | 6,153 |
import logging
logging.getLogger('boto').setLevel(logging.CRITICAL)
from .autoscaling import mock_autoscaling
from .cloudformation import mock_cloudformation
from .dynamodb import mock_dynamodb
from .dynamodb2 import mock_dynamodb2
from .ec2 import mock_ec2
from .elb import mock_elb
from .emr import mock_emr
from .iam... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/moto/__init__.py | Python | agpl-3.0 | 545 |
# Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | changsimon/trove | trove/conductor/manager.py | Python | apache-2.0 | 4,987 |
''' Track finding and fitting functions are listed here.'''
from __future__ import division
import logging
from multiprocessing import Pool, cpu_count
from math import sqrt
import progressbar
import os
from collections import Iterable
import functools
import tables as tb
import numpy as np
from numba import njit
from... | SiLab-Bonn/testbeam_analysis | testbeam_analysis/track_analysis.py | Python | mit | 83,266 |
import os
from time import localtime, strftime
import re
import sys
from fabric.api import local, lcd, settings, task
from fabric.utils import puts
from blog_config import INPUT_PATH, OUTPUT_PATH
SETTINGS_FILE = 'blog_config'
# Load paths
ABS_DIR_PATH = os.path.dirname(os.path.abspath(__file__))
ABS_SETTINGS_FILE = ... | Gastove/blogric | new_post.py | Python | epl-1.0 | 3,746 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
import weblate.trans.fields
class Migration(migrations.Migration):
dependencies = [
('trans', '0039_remove_project_owner'),
]
operations = [
migrations.AddField(
model_name='subp... | jitka/weblate | weblate/trans/migrations/0040_auto_20150818_1643.py | Python | gpl-3.0 | 597 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.5 on Sun Oct 20 16:11:10 2013
import wx
import pyex
import login_frame # for login menubar window
import check_delete # for deleting objects
import os
# begin wxGlade: extracode
# end wxGlade
'''
Will hold menubar information for the class
''... | aperture321/hipbit | src/Bitblocks.py | Python | mit | 6,517 |
# -*- coding: utf-8 -*-
# Copyright 2011 Jaap Karssenberg <jaap.karssenberg@gmail.com>
import tests
from zim.fs import File, Dir
from zim.notebook import Path
from zim.gui.widgets import *
class TestFunctions(tests.TestCase):
def runTest(self):
self.assertEqual(encode_markup_text('<foo> &bar'), '<foo> &... | gdw2/zim | tests/widgets.py | Python | gpl-2.0 | 8,858 |
# -*- coding: utf8 -*-
import spanish
import string
import numpy as np
class Measurement:
def __init__(self, f):
handle = open(f)
lines = handle.readlines()
x = 0
for line in lines:
x = x + 1
line = line.split()
if line[0] == 'Fecha:':
... | mitchellduffy/pa_analysis | code/measurement.py | Python | mit | 3,304 |
from flask import Flask, url_for, request, make_response
from flask import render_template
from module.dbhelper import DBhelper
import json
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/tracker')
def tracker():
helper = DBhelper()
try:
exerciseLkupTable = ... | mjohnson025/whatthefit | startup.py | Python | mit | 1,266 |
# -*- coding: utf-8 -*-
"""Adds all of the commands that are used for the menus of the CadQuery module"""
# (c) 2014-2018 Jeremy Wright Apache 2.0 License
import imp, os, sys, tempfile
import FreeCAD, FreeCADGui
from PySide import QtGui, QtCore
try:
import ExportCQ
except:
from . import ExportCQ
try:
import... | jmwright/cadquery-freecad-module | CQGui/Command.py | Python | lgpl-3.0 | 18,516 |
# Copyright(C) 2011,2012,2013,2014 by Abe developers.
# DataStore.py: back end database access for Abe.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License... | Serya05/bitcoin-abe | Abe/DataStore.py | Python | agpl-3.0 | 124,183 |
# -*- coding: utf-8 -*-
from django.core.management.base import NoArgsCommand, CommandError
from optparse import make_option
import os, cStringIO, gzip, mimetypes
class Command(NoArgsCommand):
help = 'Uploads your _generated_media folder to Amazon S3.'
option_list = NoArgsCommand.option_list + (
make_o... | wooyek/nuntio | web/common/appenginepatch/mediautils/management/commands/s3uploadmedia.py | Python | mit | 2,908 |
#!/usr/bin/env python3
# Copyright (c) 2021 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
# A script to diff between two ram or rom reports generated by
# size_report. When you call call the ram_report or rom_report targets you
# end up with a json file in the build directory that can be used as input
# fo... | zephyrproject-rtos/zephyr | scripts/footprint/fpdiff.py | Python | apache-2.0 | 2,294 |
# Copyright (C) 2003-2005 Vincent Hanquez <tab AT snarc.org>
# Copyright (C) 2003-2014 Yann Leboulanger <asterix AT lagaule.org>
# Copyright (C) 2005-2006 Dimitur Kirov <dkirov AT gmail.com>
# Nikos Kouremenos <kourem AT gmail.com>
# Copyright (C) 2006-2008 Jean-Marie Traissard <jim AT lapin.org... | gajim/gajim | gajim/common/optparser.py | Python | gpl-3.0 | 9,012 |
# MIT licensed
# Copyright (c) 2020 Ypsilik <tt2laurent.maud@gmail.com>, et al.
# Copyright (c) 2013-2020 lilydjwg <lilydjwg@gmail.com>, et al.
from lxml import html, etree
from nvchecker.api import session, GetVersionError
async def get_version(name, conf, *, cache, **kwargs):
key = tuple(sorted(conf.items()))
... | lilydjwg/nvchecker | nvchecker_source/htmlparser.py | Python | mit | 1,111 |
import requests
import zlib
from requests.packages.urllib3.exceptions import LocationParseError
from socket import error as SocketError
from mongoengine.queryset import NotUniqueError
from vendor.readability import readability
from lxml.etree import ParserError
from utils import log as logging
from utils.feed_functions... | mihaip/NewsBlur | apps/rss_feeds/text_importer.py | Python | mit | 8,127 |
import asyncio
import os
import sys
sys.path.insert(0, "lib")
import logging
import logging.handlers
import traceback
import datetime
import subprocess
try:
from discord.ext import commands
import discord
except ImportError:
print("Discord.py is not installed.\n"
"Consult the guide for your opera... | dylandecaro/Discord-Bot | red.py | Python | gpl-3.0 | 22,830 |
#!/usr/bin/env python3
import os
import subprocess
from wsgiref.handlers import CGIHandler
import json
from philologic.DB import DB
from philologic.Query import grep_exact, grep_word, split_terms
from philologic.QuerySyntax import group_terms, parse_query
import sys
sys.path.append("..")
import custom_functions
try:... | ARTFL-Project/PhiloLogic5 | www/scripts/autocomplete_term.py | Python | gpl-3.0 | 2,940 |
# q is a list of queens. the element index is the column, the number is the row
# i is the index (column) we are trying to solve
def queens(q, i):
if i >= len(q):
return True
for j in range(len(q)):
# check rows and diagonals
valid = valid_queens(q,i,j)
if not valid:
... | icemanblues/InterviewCodeTests | n-queens/queens.py | Python | gpl-2.0 | 1,134 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011 CERN.
##
## Invenio 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... | AlbertoPeon/invenio | modules/bibencode/lib/bibencode_config.py | Python | gpl-2.0 | 9,613 |
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
import json
def store(data):
with open('store.db', 'w') as json_file:
json_file.write(json.dumps(data))
def load(filepath):
with open(filepath, 'r') as json_file:
data = json.load(json_file)
return data
if __name__ == '__main__':
file... | louistin/fullstack | Python/read_file/read_json/read_json_file.py | Python | mit | 398 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | aimas/TuniErp-8.0 | addons/base_setup/res_config.py | Python | agpl-3.0 | 5,092 |
# 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 u... | airbnb/superset | superset/migrations/versions/b347b202819b_.py | Python | apache-2.0 | 1,086 |
import twins.kdb
from twins.twins import Twins
| coins13/twins | twins/__init__.py | Python | gpl-2.0 | 47 |
#!/usr/bin/env python2.5
#
# Copyright 2009 the Melange authors.
#
# 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 applic... | adviti/melange | app/soc/modules/gsoc/models/timeline.py | Python | apache-2.0 | 1,288 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2015 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... | Kingdread/qutebrowser | tests/unit/browser/test_webelem.py | Python | gpl-3.0 | 30,409 |
import random, sys, math
# The inputs have to be in the form, Ratio, Right = 1, Wrong = 0, in ascending order
# 3 inputs, fileinput, fileoutput, bin size
filename = sys.argv[1]
outputname = sys.argv[2]
bin = sys.argv[3]
f = open(filename, encoding='utf-8')
output = open(outputname, 'w', encoding='utf-8')
inputarray... | kapelner/HouseTurker | Batch_1_Results/barplot_revised.py | Python | mit | 1,011 |
import threading
import multiprocessing
import time
import tarfile
import os
from bones import log
logger = log.get_logger(__name__)
class TarProcessor(object):
class TarThread(threading.Thread):
def __init__(self, mode='r', pipes=None, *args, **kw):
self.pipes = pipes
self._tarfil... | vishnubob/bones | bones/aws/s3/tar.py | Python | mit | 5,334 |
__author__ = 'Progressive Company'
__version__ = (0, 1, 1)
from mongoengine_relational.relationalmixin import RelationManagerMixin, RelationalError, ReferenceField, GenericReferenceField, ListField
from mongoengine_relational.cache import DocumentCache
| ProgressivePlanning/mongoengine-relational | mongoengine_relational/__init__.py | Python | mit | 255 |
def justreplace(inputstring, repdict):
template = inputstring
for key, value in repdict.iteritems():
template = template.replace(key, value)
return template
def justread(inputfilename):
import sys
import os
infile = open(inputfilename, 'r')
content = infile.read()
infile.close()
return content
#Tr... | COSMOGRAIL/COSMOULINE | pipe/modules/readandreplace_fct.py | Python | gpl-3.0 | 2,009 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# RecSQL -- a simple mash-up of sqlite and numpy.recsql
# Copyright (C) 2007-2016 Oliver Beckstein <orbeckst@gmail.com>
# Released under the GNU Public License, version 3 or higher (your choi... | orbeckst/RecSQL | recsql/sqlarray.py | Python | gpl-3.0 | 32,219 |
"""
Copyright EMC Corporation 2015.
Distributed under the MIT License.
(See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)
"""
""" Class to store parsed WADL and XSD data. """
class CLIInputs:
wadl_context = dict()
xsd_elements_dict = dict()
unknown_xsd_elements_dict = dict()
... | santidltp/viprcommand | ViPRCommand/bin/CLIInputs.py | Python | mit | 1,681 |
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, KubeVirt Team <@kubevirt>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
class ModuleDocFragment(object):
# Standard oVirt documentation fragment
DOCUMENTATION = r'''
options:
disks:
description:
... | EvanK/ansible | lib/ansible/plugins/doc_fragments/kubevirt_vm_options.py | Python | gpl-3.0 | 2,604 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-2013 Red Hat, Inc.
#
# Authors:
# Thomas Woerner <twoerner@redhat.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 Li... | divereigh/firewalld | src/firewall/core/io/lockdown_whitelist.py | Python | gpl-2.0 | 12,159 |
#!/usr/bin/python
# copyright 2014 Huawei Technologies Co. Ltd
#
# 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 applic... | baigk/compass-core | compass/apiclient/example.py | Python | apache-2.0 | 14,074 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 5, transform = "Quantization", sigma = 0.0, exog_count = 0, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Quantization/trend_MovingMedian/cycle_5/ar_12/test_artificial_1024_Quantization_MovingMedian_5_12_0.py | Python | bsd-3-clause | 271 |
# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
# Copyright (c) 2011, 2012 Open Networking Foundation
# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
# See the file LICENSE.pyloxi which should have been included in the source distribution
# Automatically generated by LOXI from ... | gzamboni/sdnResilience | loxi/of13/const.py | Python | gpl-2.0 | 31,369 |
import gtk
import gobject
from gui.input_dialog import InputDialog, PasswordDialog
try:
import gnomekeyring as keyring
except:
keyring = None
class EntryType:
NO_TYPE = 0
GENERIC = 1
NETWORK = 2
NOTE = 3
class KeyringCreateError(Exception): pass
class PasswordStoreError(Exception): pass
class InvalidKeyrin... | Alwnikrotikz/sunflower-fm | application/keyring.py | Python | gpl-3.0 | 8,575 |
import random
import helpers
import instances
import palette
import registry
import utils
from entities import animation
from entities import creature
from statuses import status
from ai import action
from ai.actions import moveaction
from ai.actions import wanderaction
class CowardlyStatus(status.Status):
def... | JoshuaSkelly/lunch-break-rl | statuses/cowardlystatus.py | Python | mit | 3,741 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.