text stringlengths 17 737k |
|---|
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Recipe module to ensure a checkout is consistant on a bot."""
from slave import recipe_api
# To allow us to enable masters/builders/slaves independen... |
# coding=utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
"""Allows the funfuzz harness to run continuously.
"""
from __future__ import absolute_import, print_... |
# Copyright 2012 Anton Beloglazov
#
# 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... |
from tests import BaseAppTestCase
from nose.tools import assert_equals, assert_not_equals
class MongoAlchemyDocumentTestCase(BaseAppTestCase):
"MongoAlchemy documents tests"
def should_be_able_to_save_a_document_on_database_by_calling_its_save_method(self):
"A document should be able to save itself in... |
# -*- coding: utf-8 -*-
import pytest
from elephant import memorize
from elephant.exceptions import CacheKeyFunctionNotDefined
from django.core.cache import cache as default_cache
@memorize()
def fake_function():
return 'dumbo'
class TestElephant(object):
def test_should_raise_exception_when_cache_key_fun... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_examples
--------------
Tests for the Cookiecutter example repos.
"""
from __future__ import unicode_literals
import errno
import os
import shutil
import subprocess
import sys
PY3 = sys.version > '3'
if PY3:
from unittest.mock import patch
input_str = '... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import os
from rasa_core.channels.file import FileInputChannel
from rasa_core.interpreter import RegexInterpreter
def test_moodbot_example():
from rasa... |
import datetime as dt
from sqlalchemy import (
Column,
Unicode,
UnicodeText,
CHAR,
String,
Text,
Integer,
ForeignKey,
Date,
DateTime,
Enum,
Boolean,
UniqueConstraint
)
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy.orm import r... |
#########################################################################
# The MIT License (MIT)
#
# Copyright (c) 2014~2015 CIVA LIN (林雪凡)
#
# 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 Soft... |
from parcels import FieldSet, ParticleSet, ScipyParticle, JITParticle, Variable, AdvectionRK4, AdvectionRK4_3D, RectilinearZGrid, ErrorCode
from parcels.field import Field, VectorField
from parcels.tools.converters import TimeConverter, _get_cftime_calendars, _get_cftime_datetimes, UnitConverter, GeographicPolar
import... |
VERSION = '2.3.0'
|
#####################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2020.07 #
##############################################################################
# NATS-Bench: Benchmarking NAS Algorithms for Architecture Topology and Size #
######################################################... |
import pytest
import numpy as np
from scipy.integrate import trapz
from newdust.grainpop import *
from newdust import graindist
from newdust import scatmodels
from . import percent_diff
MD = 1.e-5 # g cm^-2
RHO = 3.0 # g c^-3
ALLOWED_SCATM = ['RG','Mie']
MRN_SIL = graindist.GrainDist('Powerlaw','Silicate')
MRN_D... |
from __future__ import absolute_import, print_function
import logging
import six
import yaml
import subprocess
import contextlib
import os
import s
import random
import string
import time
import argh
import types
# TODO use https://pypi.python.org/pypi/subprocess32/ on python2.7
_state = {}
def _set_state(key):
... |
import inspect
import sys
from fields import Fields
from hunter.actions import CodePrinter, VarsDumper, Action, Debugger
__version__ = "0.1.0"
class Tracer(Fields.predicate):
def __init__(self):
self.predicate = self.not_started
def not_started(self, _):
raise RuntimeError("Tracer is not ... |
import numpy as np
import mne
from mne.preprocessing import ICA
from mne.preprocessing import create_eog_epochs, create_ecg_epochs
import matplotlib.pylab as plt
plt.ion()
from keras.models import load_model
from jumeg.jumeg_noise_reducer import noise_reducer
from jumeg.jumeg_preprocessing import get_ics_cardiac, get_i... |
#!/usr/bin/env python3
#
# Copyright (C) 2020 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
# published by the Free Software Foundation.
#
# This program is distributed in the hope t... |
import calendar
import json
import time
import logging
import feedparser
import requests
from constants import *
from feed import Feed
from feedManager import FeedManager
import htmlProcessor as hp
from minerJobManager import MinerJobManager
from link import Link
from linkManager import LinkManager
from workerJob imp... |
# -*- coding: utf-8 -*-
""" \file identity/models.py
\brief Implements the core models for django-identity.
\author Erich Healy (cactuscommander) ErichRHealy@gmail.com
\author Ryan Leckey (mehcode) leckey.ryan@gmail.com
\copyright Copyright 2012 © Concordus Applications, Inc.
All Rights Reserved.
"""
from ... |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
from indiclient import IndiClient
import time, sys
from datetime import datetime, timedelta
import ephem as eph
from PIL import Image, ImageFont, ImageDraw
from astropy.io import fits
import numpy
from shutil import copyfile
import time
FILENAME_FITS = 'latest.fits'
FILENAME_PNG = 'latest.png'
NIGHT_EXP = 90
DAY_EXP ... |
import re
from corehq.apps.api.domainapi import DomainAPI
from corehq.apps.api.resources import v0_1, v0_2, v0_3, v0_4
from corehq.apps.commtrack.resources.v0_1 import ProductResource,\
StockStatusResource, StockReportResource, FullStockTransactionResource
from corehq.apps.fixtures.resources.v0_1 import FixtureRes... |
import jucipp, os, gi, traceback
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gio
from os import path
def add_menu(position, label, items) :
plugin_menu = jucipp.get_gio_plugin_menu()
sub_menu = Gio.Menu.new()
i = 0
app = Gio.Application.get_default()
for item in items :
su... |
import unittest
from docido_sdk.core import Component, implements
from docido_sdk.env import Environment
from docido_sdk.index.api import (
IndexAPIConfigurationProvider,
IndexAPIProcessor,
IndexAPIProvider,
IndexPipelineConfig,
)
from docido_sdk.index.pipeline import IndexPipelineProvider
from utils i... |
# Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# -*- coding: utf-8 -*-
"""Shot related tools
from anima.env import blackmagic
resolve = blackmagic.get_resolve()
project_manager = resolve.GetProjectManager()
resolve_project = project_manager.GetCurrentProject()
timeline = resolve_project.GetCurrentTimeline()
clip = timeline.GetCurrentVideoItem()
"""
from anima im... |
#!/usr/bin/env python
# mxdatareduction.py
#
# Copyright (C) 2014 Diamond Light Source, Karl Levik
#
# 2014-09-24
#
# Methods to store data from MX reduction pipelines
#
import string
import logging
import time
import os
import sys
import datetime
from logging.handlers import RotatingFileHandler
from collectio... |
"""Sniff the network for our Dash Button's ARP request and then start a yoga video"""
from __future__ import unicode_literals
import os
import psutil
import time
import youtube_dl
from scapy.all import *
def playing():
"""Check if the video player is currently running"""
print "Checking for currently-playin... |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2Billing S.L.
#
# The Initia... |
"""hunter.py --- An alternative to WOTC's "Gatherer" """
import re
from re import search, match
import sqlite3
from sqlite3 import connect
from sys import argv
def card_color(mana, cardname, text):
'''Determines a card's color by its casting cost and by checking card
text (for special cases like colored zer... |
import os
from mpl_toolkits.basemap import Basemap
import numpy as np
import ephem
import matplotlib.pyplot as plt
import matplotlib
import time
import logging
import maglites.utils.projector
import maglites.utils.constants as constants
from maglites.field import FieldArray
plt.ion()
###############################... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Donors: Hasa Sàrl, Open Net Sàrl and Prisme Solutions Informatique SA
#
# This program is free software: you can redistribute it and/or modify
# it unde... |
""" terminal reporting of the full testing process.
This is a good source for looking at the various reporting hooks.
"""
from __future__ import absolute_import, division, print_function
import itertools
import platform
import sys
import time
import pluggy
import py
import six
import pytest
from _pytest import node... |
"""
To do:
Looking at Neil's data, subtracting isn't as important as adding, because it's
easier to miss particles than to overfeature.
Also, for add-subtract, it might be better to do 1 loop of subtraction, or
every other loop of subtraction, rather than spend time every loop subtracting.
Adding / subtracting : rath... |
import os
import sys
import json
import collections
def main():
fn=sys.argv[1]
fm=sys.argv[2]
branches=sys.argv[3]
branchmatrix=sys.argv[4]
print "Annotating %s with header from %s"%(os.path.abspath(fn),os.path.abspath(fm))
fo=open(fn)
data=json.load(fo)
fo.close()
fo... |
#!/usr/bin/env python
# coding: utf-8
# Copyright (c) 2013-2014 Abram Hindle
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
# Natural Language Toolkit: Corpus Readers
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
# [xx] this docstring isnt' up-to-date!
"""
NLTK corpus readers. The modules in this package provide func... |
from math import lcm
from itertools import combinations
# https://math.stackexchange.com/questions/2218763/how-to-find-lcm-of-two-numbers-when-one-starts-with-an-offset
def combine_phased_rotations(a_period, a_phase, b_period, b_phase):
"""Combine two phased rotations into a single phased rotation
Returns: co... |
# -*- coding: utf-8 -*-
'''
The EC2 Cloud Module
====================
The EC2 cloud module is used to interact with the Amazon Elastic Cloud
Computing. This driver is highly experimental! Use at your own risk!
To use the EC2 cloud module, set up the cloud configuration at
``/etc/salt/cloud.providers`` or ``/etc/salt... |
import json
import logging
import requests
from django.utils import timezone
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.authentication import BasicAuthentication
from rest_framework.parsers import JSONParser
from rest_framework.permissions import BasePermi... |
# -*- coding: UTF-8 -*-
# Copyright 2016-2019 Rumma & Ko Ltd
# License: BSD, see LICENSE for more details.
"""Defines the :class:`DashboardItem` class.
"""
from __future__ import unicode_literals
from builtins import str
from lino.api import _
from lino.core.permissions import Permittable
from etgen.html import E, to... |
__version__ = '2.5.2'
|
import sys
TestDir = r'..\..\Bin Collector'
sys.path.append( TestDir )
sys.path.append(r'..\..\Diff Inspector')
import os
import PatchDatabaseWrapper
import PatchTimeline
import DarunGrimSessions
import DarunGrimDatabaseWrapper
import DarunGrimAnalyzers
import DownloadMSPatches
import FileStore
import temp... |
import sys
TestDir = r'..\..\Bin Collector'
sys.path.append( TestDir )
sys.path.append(r'..\..\Diff Inspector')
import os
import PatchDatabaseWrapper
import PatchTimeline
import DarunGrimSessions
import DarunGrimDatabaseWrapper
import DarunGrimAnalyzers
from mako.template import Template
HeadText = """
... |
###########################################################
#
# Copyright (c) 2009, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... |
# -*- coding: utf-8 -*-
'''
Support for iptables
'''
# Import python libs
import os
import re
import sys
import shlex
# Import salt libs
import salt.utils
from salt.state import STATE_INTERNAL_KEYWORDS as _STATE_INTERNAL_KEYWORDS
from salt.exceptions import SaltException
import salt.modules.cmdmod as salt_cmd
def _... |
#ipc_lista1.8
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que pergunte quanto você ganha pro
|
#!/usr/bin/env python3
import time
import logging
import tweepy
from models import twitter_access_token, twitter_access_secret, twitter_consumer_secret, twitter_consumer_key, tweet_queue
def get_api():
auth = tweepy.OAuthHandler(twitter_consumer_key.get(), twitter_consumer_secret.get())
auth.set_access_tok... |
# test_tifffile.py
# Copyright (c) 2008-2022, Christoph Gohlke
# 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 notice,
# t... |
import glob
import six
import pytest
from twisted import version as twisted_version
def _py_files(folder):
return glob.glob(folder + "/*.py") + glob.glob(folder + "/*/*.py")
collect_ignore = [
# deprecated or moved modules
"scrapy/conf.py",
"scrapy/stats.py",
"scrapy/project.py",
"scrapy/uti... |
# -*- coding: utf-8 -*-
import unittest
from pythainlp.tokenize import (
DEFAULT_WORD_DICT_TRIE,
Tokenizer,
attacut,
crfcls,
deepcut,
etcc,
longest,
multi_cut,
nercut,
newmm,
pyicu,
sent_tokenize,
ssg,
subword_tokenize,
syllable_tokenize,
tcc,
word_t... |
import os
import pytest as pytest
from common.serializers.serialization import node_status_db_serializer
from plenum.test.helper import MockTimestamp
from plenum.common.messages.node_messages import InstanceChange
from plenum.server.suspicion_codes import Suspicions
from plenum.server.view_change.instance_change_provi... |
#!flask/bin/python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
from app.models import User
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.create(SQLALCHEMY_MIGRATE_REPO, 'database rep... |
# -*- coding: utf-8 -*-
'''
Manage information about files on the minion, set/read user, group
data
:depends: - win32api
- win32file
- win32security
'''
# Import python libs
import os
import stat
import os.path
import logging
import struct
# pylint: disable=W0611
import tempfile # do not re... |
# Author: Suyog Dutt Jain <suyog.jain@aero.iitb.ac.in>
# Prabhu Ramachandran
# Copyright (c) 2009, Enthought, Inc.
# License: BSD Style.
# Standard library imports.
import unittest
from numpy import random, allclose, arange
# Local imports.
from enthought.mayavi.core.engine import Engine
from enthought.mayav... |
# -*- coding: utf-8 -*-
'''
Manage Local Policy on Windows
This module allows configuring local group policy (i.e. ``gpedit.msc``) on a
Windows server.
.. versionadded:: 2016.11.0
Administrative Templates
========================
Administrative template policies are dynamically read from ADMX/ADML files on
the serv... |
# Copyright 2017 The Forseti Security 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 ap... |
# -*- coding: utf-8 -*-
import json
import numpy as np
from numpy import pi
import qutip as qu
from maxwellbloch import ob_base, field, t_funcs, sigma
class OBAtom(ob_base.OBBase):
def __init__(self, label=None, num_states=1, energies=[], decays=[],
initial_state=[], fields=[]):
""" Initialis... |
import unittest
from datetime import datetime
from dateutil.tz import tzutc, tzlocal
from t77_date.tz import to_local
class ToLocalTestCase(unittest.TestCase):
def test_datetime_in_utc(self):
value_in = datetime.now(tz=tzutc())
value_out = to_local(value_in)
self.assertIsInstance(value_o... |
import re
from typing import Callable
import pytest
from celery import states as task_states
from clearly.utils import worker_states
@pytest.fixture(params=sorted(task_states.ALL_STATES))
def task_state_type(request):
yield request.param
@pytest.fixture(params=sorted(task_states.ALL_STATES.union(set('TRUNCATE... |
'''
Helpful decorators module writing
'''
# Import python libs
import inspect
import logging
from functools import wraps
from collections import defaultdict
# Import salt libs
import salt.utils
from salt.exceptions import CommandNotFoundError
log = logging.getLogger(__name__)
class Depends(object):
'''
Thi... |
import contextlib
import json
import logging
import os
from cStringIO import StringIO
from ..orchestra import run
from teuthology import misc as teuthology
from teuthology import contextutil
from teuthology.task_util.rgw import rgwadmin
from teuthology.task_util.rados import rados
log = logging.getLogger(__name__)
... |
from app import app, db, oauth
from app.models import User, Client, Grant
from datetime import datetime, timedelta
def get_current_user():
# Change impelementation to get the verified user
return User.query.all()[0]
@oauth.clientgetter
def load_client(client_id):
return Client.query.get(client_id)
@oaut... |
"""
.. module:: frames
:synopsys: Define all the custom frames
.. moduleauthor:: Benjamin Audren <benjamin.audren@gmail.com>
"""
from __future__ import unicode_literals
import os
from collections import OrderedDict as od
import pypandoc as pa
import six # Used to replace the od iteritems from py2
import io
from ... |
"""
Busine-me API
Universidade de Brasilia - FGA
Tecnicas de Programacao, 2/2015
@file test_models.py
Testing models busline.
"""
from django.test import TestCase
from ..models import Busline
from ..models import Terminal
from ..models import Favorite
from ..models import Company
from ..models import Post
from authenti... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import hashlib
impor... |
#!/usr/bin/env python3
"""
Watch files and then run commands
TODO:
- Stop on external program error
- Reload on .spotter changes
- A ~/.spotter-presets/ folder?
"""
import argparse
import collections
import fnmatch
import re
import subprocess
import os
import pyinotify
def merge(*dictionaries):
"""Merge any num... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... |
from __future__ import absolute_import, print_function
from datetime import timedelta
from django.utils import timezone
from rest_framework import serializers
from rest_framework.response import Response
from sentry.app import tsdb
from sentry.api.base import DocSection
from sentry.api.bases.group import GroupEndpoin... |
# coding=utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
import octoprint.plugin
fro... |
"""
sentry.templatetags.sentry_helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
# XXX: Import django-paging's template tags so we don't have to worry about
# INSTALLED_APPS
import datetime
from... |
""" This module provides the unsafe things for targets/numbers.py
"""
from .. import types
from ..extending import intrinsic
from llvmlite import ir
@intrinsic
def viewer(tyctx, val, viewty):
""" Bitcast a scalar 'val' to the given type 'viewty'. """
bits = val.bitwidth
if isinstance(viewty.dtype, types.... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# Copyright (c) 2013 Jesse Griffin
# http://creativecommons.org/licenses/MIT/
#
# 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 restr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Full license can be found in License.md
# ----------------------------------------------------------------------------
"""Routines to cycle through the OCboundary class records."""
import datetime as dt
from ocbpy import logger
def retrieve_all_good_indices(ocb):
... |
from __future__ import absolute_import, division, print_function
import os
import subprocess
import uuid
import mmap
from contextlib import closing
from functools import partial
from distutils.spawn import find_executable
import sqlalchemy as sa
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.sql.elemen... |
import logging; _L = logging.getLogger('openaddr.ci')
from .. import jobs, render, util, __version__
from .webcommon import nice_domain
from .objects import (
add_job, write_job, read_job, complete_set, update_set_renders,
set_run, RunState, get_completed_run, read_completed_set_runs
)
from . import obje... |
import subprocess
from .repository import Repository
class GitRepository(Repository):
type = 'git'
def pushables(self, remote):
return self.list_cmd("git --no-pager log --oneline %s..HEAD" % remote)
def get_new_commits(self):
return self.list_cmd("git --no-pager log --oneline HEAD..origi... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 01 20:22:25 2015
@author: matsumi
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
def sigmoid(s):
y = 1 / (1 + np.exp(-s))
return y
# main文
if __name__ == '__main__':
digits = load_digits(2)
images = dig... |
from flask import abort, flash, redirect, render_template, url_for, request
from flask_login import current_user, login_required
from .forms import (
AddTestScoreForm, AddRecommendationLetterForm, AddEssayForm,
EditStudentProfile, AddCollegeForm, AddMajorForm)
from ..models import TestScore, RecommendationLette... |
import boto
import json
import logging
import re
import shutil
import tldextract
from collections import defaultdict, Counter
from gzip import GzipFile
from hyperloglog import HyperLogLog
from io import TextIOWrapper
from tempfile import TemporaryFile
from urllib.parse import urlparse
from mrjob.job import MRJob, MRS... |
import six.moves.cPickle as pickle
from chainer.dataset import dataset_mixin
class PickleDatasetWriter(object):
"""Writer class which makes PickleDataset.
To make :class:`PickleDataset`, a user need to prepare data using
:class:`PickleDatasetWriter`.
Args:
writer: File like object that sup... |
from django.core.urlresolvers import reverse, reverse_lazy
from django.contrib import messages
from django.views.generic import *
from django.shortcuts import render, render_to_response
from django.template.context import RequestContext
from django.http import HttpResponseRedirect
from django.shortcuts import render, r... |
import dictdiffer
import gzip
import json
from cerberus import Validator
import virtool.otus
ISOLATE_KEYS = [
"id",
"source_type",
"source_name",
"default"
]
OTU_KEYS = [
"name",
"abbreviation"
]
RIGHTS = [
"build",
"modify",
"modify_otu",
"remove"
]
SEQUENCE_KEYS = [
"a... |
import os, re, sys
import json
import urllib
class VKFriendsCleaner:
USERS_API = 'https://api.vk.com/method/users.get?uids={0}'
FRIENDS_API = 'https://api.vk.com/method/friends.get?uid={0}&fields=uid,firstname,lastname'
def __init__(self):
"""
Read data.
"""
self.short_na... |
from django.contrib import admin
from import_export.admin import ExportMixin
from import_export.resources import ModelResource
from import_export import fields
from models import (Activity, Assignment, Attribute, Campaign, Duty, Event,
Family, Location, Message, TriggerByDate, Volunteer,
... |
#!/usr/bin/python
"""
shocker.py v0.72
A tool to find and exploit webservers vulnerable to Shellshock
##############################################################################
# Released as open source by NCC Group Plc - http://www.nccgroup.com/ #
# ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
"""
NRM backends which just logs actions performed.
Author: Henrik Thostrup Jensen <htj@nordu.net>
Copyright: NORDUnet (2011)
"""
import uuid
import datetime
from twisted.python import log
from twisted.internet import defer
from zope.interface import implements
from opennsa import interface as nsainterface
from op... |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError, ObjectDoesNotExist
from django.conf import settings
from mptt.models import MPTTModel, TreeForeignKey
from mptt.managers import TreeManager
from opps.core.mo... |
import os
import re
from . import core
@core.rule
def executable(
name, sources=None, include=None, define=None, flags=None, links=None,
compiler=None, warnings_are_errors=False, scan=True, debug=True,
objects=None
):
if compiler is None:
compiler, toolchain = _get_default_compiler()
else... |
from sqlite3 import connect
from cPickle import loads, dumps
from os.path import expanduser
import sys
def make_sql_table(kv_list, db_name, key_format="String", value_format="BLOB"):
try:
conn = connect(db_name)
except Exception, e:
sys.exit(e)
c = conn.cursor()
c.execute('''CREATE TABL... |
import os
import glob
import csv
import argparse
from xlsxwriter.workbook import Workbook
def arguments():
parser = argparse.ArgumentParser()
parser.add_argument('--path', default = os.getcwd(), help = "Path to CSV files")
parser.add_argument('--outname', default = None, help = "Name of output XLSX file")... |
# import python libraries
import os, sys, imp
# import os-dependant libs
import kivy
kivy.require('1.9.1')
from kivy.app import App
from kivy.core.window import Window
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.scrollview import ScrollView
from core.gui.mapwidge... |
# Copyright 2015 UnitedStack, 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 require... |
#!/usr/bin/env python
# Based on previous work by
# Charles Menguy (see: http://stackoverflow.com/questions/10217067/implementing-a-full-python-unix-style-daemon-process)
# and Sander Marechal (see: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/)
# Adapted by M.Hendrix [2015]
# daemon18.... |
#!/usr/bin/env python
# Based on previous work by
# Charles Menguy (see: http://stackoverflow.com/questions/10217067/implementing-a-full-python-unix-style-daemon-process)
# and Sander Marechal (see: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/)
# Adapted by M.Hendrix [2015]
# daemon99.... |
"""vt_graph_api.graph.
This modules provides the Python object wrapper for
virustotal graph representation.
Documentation:
https://developers.virustotal.com/v3.0/docs/api-documentation
Examples:
https://developers.virustotal.com/v3.0/docs/simple-tutorials
https://developers.virustotal.com/v3.0/docs/advanced-tu... |
import os
import sys
from io import StringIO
from .cli import CLI
from .runner import Runner
class ElixirCLI(CLI):
def __init__(self, compiler=None):
super(ElixirCLI, self).__init__('Elixir', compiler, False, False)
class ElixirMixRunner(Runner):
def make_code(self, file, filepath, filename):
... |
# Copyright (c) 2021, Manfred Moitzi
# License: MIT License
#
# Purpose:
# Flips an inverted OCS defined by extrusion vector (0, 0, -1) into a WCS
# aligned OCS defined by extrusion vector (0, 0, 1).
#
# This simplifies 2D entity processing for ezdxf users and creates DXF
# output for 3rd party DXF libraries which igno... |
#!/usr/bin/python
import MySQLdb
import socket # for getting hostname/node_id
import time
import os
import logging
import subprocess
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
handler = logging.FileHandler('/var/log/nfc.log')
handler.setLevel(logging.INFO)
formatter = logging.Formatter('(%(lev... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.