repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 | prefix stringlengths 0 8.16k | middle stringlengths 3 512 | suffix stringlengths 0 8.17k |
|---|---|---|---|---|---|---|---|---|
fredg02/crazyflie-clients-python | examples/read-eeprom.py | Python | gpl-2.0 | 5,190 | 0 | # -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2014 Bitcraze AB
#
# Crazyflie Nano Quadcopter Client
#
# This program is free software; you can redistribute it and/or
# modify it un... | nse
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ... |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/lepl/matchers/combine.py | Python | agpl-3.0 | 16,464 | 0.003158 |
# The contents of this file are subject to the Mozilla Public License
# (MPL) Version 1.1 (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.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
# b... | cient search when all matchers are functions (so no need to
trampoline). Depth fir | st (greedy).
'''
def matcher(support, stream):
stack = deque()
try:
stack.append((0, [], stream, first._untagged_match(stream)))
stream = None
while stack:
(count1, acc1, stream1, generator) = stack[-1]
extended = False
... |
Mangopay/mangopay2-python-sdk | tests/test_rate_limit.py | Python | mit | 411 | 0.002433 | from tests.test_base import BaseTest, BaseTestLive
from mangopay.api import APIRequest as api
cl | ass RateLimit(BaseTest):
def test_rate_limits_update(self):
apis = api()
self.assertIsNone(apis.get_rate_limits())
BaseTestLive.get_ubo_declaration()
rate_limits = apis.get_rate_limits()
self.assertIsNotNone(rate_limits)
self.assertTrue(len(rate_lim | its) == 4) |
zhangtianyi1234/django-haystack | haystack/utils/loading.py | Python | bsd-3-clause | 11,267 | 0.002041 | from __future__ import unicode_literals
import copy
import inspect
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.datastructures import SortedDict
from django.utils import importlib
from django.utils.module_loading import module_has_submodule
from haystack.con... | example::
``myapp.search_backends.CustomSolrEngine``
"""
path_bits = full_bac | kend_path.split('.')
if len(path_bits) < 2:
raise ImproperlyConfigured("The provided backend '%s' is not a complete Python path to a BaseEngine subclass." % full_backend_path)
return import_class(full_backend_path)
def load_router(full_router_path):
"""
Loads a router for choosing which conn... |
sysr-q/pysqlw | pysqlw/sqltype.py | Python | mit | 1,490 | 0.002013 | # -*- coding: utf-8 -*-
# The base for SQL wrappers to implement.
class sqltype:
""" pysqlw.sqltype is a parent class to the meta-wrappers
provided by pysqlw. This allows for simple integration
into the pysqlw meta-wrapper family.
"""
def __init__(self, **kwargs):
""" Check that a... | """
return []
def connect(self):
""" Connect | to the database and perform any required actions to setup.
:return: a (database, cursor) tuple, or False if something went wrong
:rtype: tuple or False
"""
return False
def format(self, item):
""" In a prepared statement, what does this database use for param bindi... |
slipguru/ignet | icing/plotting/__init__.py | Python | bsd-2-clause | 152 | 0 | """init.py for plotting module.
Author: Federico Tomas | i
Copyright (c) 2016, Federico Tomasi.
Licensed under the FreeBSD license (see LICENSE.tx | t).
"""
|
AxXxel001/commentCreator_v2 | old/CommentCreator/main.py | Python | gpl-3.0 | 229 | 0.021834 | impor | t sys
from os import sep
from PyQt4.QtGui import QApplication
from src import mainwindow
if __name__ == "__main__":
print "los gehts"
app = QApplication(sys.argv)
window = mainwindow.CCMainWindow()
sys.e | xit(app.exec_()) |
krfkeith/enough | livec/runner/pybuiltins.py | Python | gpl-3.0 | 2,112 | 0.008523 |
class PyType(object):
last_address = [0]
address = 0
def __init__(self, size):
self.address = self.AllocateAddress(size)
self.size = size
@staticmethod
def AllocateAddress(size):
addr = last_address[0]
last_address[0] += size
return addr
d... | self.elems = None
def init_elems(self):
if self.elems is None:
self.elems = [elem_type.get_default_value() for i in xrange(num_elems)]
def check_index(self, index):
if index > self.num_elems or index < 0:
raise OutOfBoundsError(self, index)
def set_elem(se... | elems()
self.check_index(index)
self.elems[index] = value
def get_elem(self, index):
self.init_elems()
self.check_index(index)
return self.elems[index]
|
alxgu/ansible | lib/ansible/plugins/action/netconf.py | Python | gpl-3.0 | 3,577 | 0.004753 | #
# Copyright 2018 Red Hat Inc.
#
# 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 version.
#
# Ansibl... | nnection, self._task.action)}
if self._play_context.connection == 'local' and self._task.action == 'netconf_config':
args = self._task.args
pc = copy.deepcopy(self._play_context)
pc.connection = 'netconf'
pc.port = int(args.get('port') or self._play_cont | ext.port or 830)
pc.remote_user = args.get('username') or self._play_context.connection_user
pc.password = args.get('password') or self._play_context.password
pc.private_key_file = args.get('ssh_keyfile') or self._play_context.private_key_file
display.vvv('using connect... |
ICT4H/dcs-mangrove | mangrove/utils/spreadsheets/__init__.py | Python | bsd-3-clause | 36 | 0 |
from csv_wrapper im | port CsvRe | ader
|
foosel/OctoPrint | src/octoprint/server/api/printer.py | Python | agpl-3.0 | 15,729 | 0.023717 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms... | ttings import settings, valid_boolean_trues
from octoprint.server import printer, printerProfileManager, NO_CONTENT
from octoprint.server.api import api
from octoprint.server.util.flask import no_firstrun_access, get_json_command_from_request
from octoprint.printer import UnknownScript
from octoprint.access.permissio... | Printer
@api.route("/printer", methods=["GET"])
@Permissions.STATUS.require(403)
def printerState():
if not printer.is_operational():
return make_response("Printer is not operational", 409)
# process excludes
excludes = []
if "exclude" in request.values:
excludeStr = request.values["exclude"]
if len(exclud... |
tianyang-li/bi-misc | flux_fastas.py | Python | gpl-3.0 | 1,017 | 0.00295 | #!/usr/bin/env python
# Copyright (C) 2012 Tianyang Li
# tmy1018@gmail.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 3 of the License, or
# (at your option) any lat... | seful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
import sys
from Bio import SeqIO
def main():
if not sys.... | ta'):
with open("%s.fasta" % rec.id, 'w') as fout:
fout.write(rec.format('fasta'))
if __name__ == '__main__':
main()
|
SpaceWars/spacewars | src/engine/gunfire.py | Python | gpl-3.0 | 3,382 | 0.000296 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Copyright (C) 2015 Luiz Fernando Oliveira, Carlos Oliveira, Matheus Fernandes
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of th... | qnt):
cls.ammo['enemies'].append(RoheniansBullet())
@classmethod
def delivery_bullets(cls, bullet_type, qnt=50, target=None):
"" | " Returns a list of a specific bullet type. The bullet type is a
mandatory parameter and can be 'spaceship like' or 'rohenian like'"""
if len(cls.ammo[bullet_type]) < qnt:
cls.create_bullets(
bullet_type, int(qnt) - len(cls.ammo[bullet_type]))
if bullet_type in hero... |
homme/ansible | lib/ansible/playbook/base.py | Python | gpl-3.0 | 16,539 | 0.002358 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@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) an... | re which do
not map to attributes for this object.
| '''
valid_attrs = frozenset(name for name in self._get_base_attributes())
for key in ds:
if key not in valid_attrs:
raise AnsibleParserError("'%s' is not a valid attribute for a %s" % (key, self.__class__.__name__), obj=ds)
def validate(self, all_vars=dict()):
... |
leiforion/t1-python | terminalone/models/strategyconcept.py | Python | bsd-3-clause | 1,211 | 0 | # -*- coding: utf-8 -*-
"""Provides strategy concept object."""
from __future__ import absolute_import
from ..entity import Entity
from ..utils import PATHS
class StrategyConcept(Entity):
"""docstring for StrategyConcept."""
collection = 'strategy_concepts'
resource = 'strategy_concept'
_relations = ... | strpt,
'version': int,
}
_push = _pull.copy()
_push.update({
'status': int,
})
_readonly = Entity._readonly | {'name', }
def __init__(self, session, properties=None, **kwargs):
super(StrategyConcept, self).__init__(session, pr | operties, **kwargs)
def remove(self):
"""Unassign the concept from the strategy."""
url = '/'.join([self.collection,
str(self.id),
'delete'])
self._post(PATHS['mgmt'], rest=url, data={'version': self.version})
for item in list(self.pro... |
matthiasdiener/spack | var/spack/repos/builtin/packages/parallel-netcdf/package.py | Python | lgpl-2.1 | 3,279 | 0.000915 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | b07')
version('1.7.0', '267eab7b6f9dc78c4d0e6def2def3aea4bc7c9f0')
version('1.6.1', '62a094eb952f9d1e15f07d56e535052604f1ac34')
variant('cxx', default=True, description='Build the C++ Interface')
variant('fortran', default=True, description='Build the Fortran Interface')
variant('pic', default=True... | t code (for shared libs)')
depends_on('mpi')
depends_on('m4', type='build')
# See:
# https://trac.mcs.anl.gov/projects/parallel-netcdf/browser/trunk/INSTALL
def configure_args(self):
spec = self.spec
args = ['--with-mpi={0}'.format(spec['mpi'].prefix)]
args.append('MPICC=... |
chipx86/reviewboard | reviewboard/cmdline/utils/console.py | Python | mit | 20,318 | 0 | """Console functionality for command line tools."""
from __future__ import print_function, unicode_literals
import codecs
import getpass
import shutil
import sys
import textwrap
from django.core.exceptions import ValidationError
from django.core.management.color import color_style, no_style
from django.utils import ... | term_width = term_width
self.header_sep = '\u2014' * self.term_width
self._restyle_console()
@property
def allow_color(self):
"""Whether to use co | lor for output.
Type:
bool
"""
return self._allow_color
@allow_color.setter
def allow_color(self, allow_color):
if self._allow_color is not allow_color:
self._allow_color = allow_color
self._restyle_console()
def make_text_wrapper(self, ... |
DecoraterBot-devs/DecoraterBot-cogs | moderation.py | Python | mit | 12,660 | 0.000395 | # coding=utf-8
"""
moderation plugin for DecoraterBot.
"""
import regex
import discord
from discord.ext import commands
from DecoraterBotUtils import utils
# This module's warn, and mute commands do not work for now.
# I would like it if someone would help me fix them and pull
# request the fixtures to this file to ... | # num = 1
# if opt:
# try:
# num = int(opt)
# except:
# return
# reply_data = await self. | prune_command_iterater_helper(ctx, num)
# else:
if role2 in ctx.message.author.roles:
opt = ctx.message.content[
len(ctx.prefix + "prune "):].strip()
num = 1
if opt:
try:
num = int(o... |
ARMmbed/yotta | yotta/lib/git_access.py | Python | apache-2.0 | 4,662 | 0.001502 | # Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
import logging
# version, , represent versions and specifications, internal
from yotta.lib import version
# access_common, , things shared between different component access ... | on in the working_copy, but should be a
# version that exists as a tag in the working_copy)
class GitCloneVersion(version.Version):
def __init__(self, semver, tag, working_copy): |
self.working_copy = working_copy
self.tag = tag
super(GitCloneVersion, self).__init__(semver)
def unpackInto(self, directory):
# vcs, , represent version controlled directories, internal
from yotta.lib import vcs
# fsutils, , misc filesystem utils, internal
... |
sdh11/gnuradio | gr-digital/python/digital/qa_burst_shaper.py | Python | gpl-3.0 | 15,116 | 0.000463 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest
from gnuradio import blocks, digital
import pmt
import numpy as np
import sys
def make_length_tag(... | post_padding=postpad,
insert_phasing=True)
sink = b | locks.vector_sink_c()
self.tb.connect(source, shaper, sink)
self.tb.run()
# checks
self.assertComplexTuplesAlmostEqual(sink.data(), expected, 6)
self.assertTrue(compare_tags(sink.tags()[0], etag))
def test_odd_window(self):
'''
test_odd_window: test with odd... |
tzoiker/gensim | gensim/test/test_similarities.py | Python | lgpl-2.1 | 21,672 | 0.003553 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for similarity algorithms (the similarities package).
"""
import logging
import unittest
import os
import tempfile... | lat), sorted(index.index.flat)))
index.num_best = num_best
query = corpus[0]
sims = index[query]
expected = [(0, 0.99999994), (2, 0.28867513), (3, 0.23570226), (1, 0.23570226)][ : num_best]
# convert sims to full numpy | arrays, so we can use allclose() and ignore
# ordering of items with the same similarity value
expected = matutils.sparse2full(expected, len(index))
if num_best is not None: # when num_best is None, sims is already a numpy array
sims = matutils.sparse2full(sims, len(index))
s... |
Robpol86/sphinxcontrib-imgur | tests/unit_tests/test_rendered_figure.py | Python | mit | 1,528 | 0.001309 | """Tests."""
from typing import List
import pytest
from bs4 import element
@pytest.mark.sphinx("html", testroot="figure")
def test_figure(img_tags: List[element.Tag]):
"""Test."""
image = img_tags[0]
assert image.get("src") == "https://i.imgur.com/611EovQh.jpg"
assert image.get("al | t") == "https://i.imgur.com/611EovQh.jpg"
target = image.parent
assert target.name != "a"
image = img_tags[1]
assert image.get("src") == "https://i.imgur.com/611EovQh.jpg"
assert image.get("alt") == "https://i.imgur.com/611EovQh.jpg"
targe | t = image.parent
assert target.name == "a"
assert target.get("href") == "https://imgur.com/611EovQ"
@pytest.mark.sphinx("html", testroot="figure-opengraph")
def test_figure_opengraph(meta_tags: List[element.Tag]):
"""Test."""
og_image = [t for t in meta_tags if t.get("property", "") == "og:image"][0]
... |
tlakshman26/cinder-https-changes | cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_base.py | Python | apache-2.0 | 36,142 | 0 | # Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2014 Andrew Kerr. All rights reserved.
# Copyright (c) 2015 Tom Barron. All rights reserved.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); y... | (fake.VOLUME)
self.library._create_lun.assert_called_once_with(
fake.POOL_NAME, fake.LUN_NAME, volume_size_in_bytes,
fake.LUN_METADATA, None)
self.assertEqual(0, self.library.
_mark_qos_policy_group_for_deletion.call_count)
self.assertEqual(0, bl... | self.mock_object(volume_utils, 'extract_host', mock.Mock(
return_value=None))
self.assertRaises(exception.InvalidHost, self.library.create_volume,
fake.VOLUME)
def test_create_volume_exception_path(self):
self.mock_object(block_base, 'LOG')
self... |
zarboz/XBMC-PVR-mac | tools/darwin/depends/samba/samba-3.6.6/lib/subunit/python/subunit/tests/test_subunit_filter.py | Python | gpl-2.0 | 5,087 | 0.004128 | #
# subunit: extensions to python unittest to get test results from subprocesses.
# Copyright (C) 2005 Robert Collins <robertc@robertcollins.net>
#
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
# license at the users choice. A copy of both licenses are available in the
# project sour... | t
from subunit.test_results import TestResultFilter
class TestTestResultFilter(unittest.TestCase):
"""Test for TestResultFilter, a TestResult object which filters tests."""
def _setUp(self):
self.output = StringIO()
def test_default(self):
"""The default is to exclude suc | cess and include everything else."""
self.filtered_result = unittest.TestResult()
self.filter = TestResultFilter(self.filtered_result)
self.run_tests()
# skips are seen as success by default python TestResult.
self.assertEqual(['error'],
[error[0].id() for error in se... |
mjjank/mks_rga | RGA.py | Python | gpl-2.0 | 4,840 | 0.027479 | import time
import numpy
from rga_telnet import *
# Connecting to RGA - RGA(HOST,PORT)
class RGA:
scan = True # This is used for stop of peak scan - if set to False
status = [0 for col in range(4)] # Status of the device, look in rga_status method
showReadout = True # This one is responsible for the text outpu... | write("ScanStart 1\n")
self.status[3] = 1
while self.scan:
# Processing output string
# out = self.rga_id03.read_until("\r\r", 1)
out = self.rga_readout(1, True)
out = out.split(' ')
out[:] = (i for i in out if i != '')
# If the list length is 3, it corresponds to one of measured masses
if... | mass_read = numpy.vstack([mass_read, new_row]) # Adding measured value to array
if float(out[1]) == mass_selected[-1]: # When last mass value of scan is read , restart scan
self.rga_id03.write("ScanResume 1\n")
# Stop scan
self.rga_id03.write("ScanStop\n")
print(self.rga_id03.read("never", 1)) # Coll... |
phyng/zuobiao | zuobiao/zuobiao/urls.py | Python | mit | 402 | 0.012438 | from django.conf.urls import patterns, include, url
from django.contrib import admin
from dashboard.views import QuestionApi
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'zuobia | o.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin | /', include(admin.site.urls)),
url(r'^api/question/(?P<pk>\d+)/$', QuestionApi.as_view(), name='question_api'),
)
|
pombredanne/drf-cached-instances | drf_cached_instances/mixins.py | Python | mpl-2.0 | 2,480 | 0 | """Mixins to add caching to Django REST Framework viewsets."""
from django.http import Http404
from rest_framework.generics import get_object_or_404
from .models import CachedQueryset
class CachedViewMixin(object):
"""Mixin to add caching to a DRF viewset.
A user should either define cache_class or overrid... | None):
"""
Return the object the view is displaying.
Same as rest_framework.generics.GenericAPIView, but:
- Failed assertions instead of deprecations
"""
# Determine the base queryset to use.
assert queryset is None, "Passing a queryset is disabled"
query | set = self.filter_queryset(self.get_queryset())
# Perform the lookup filtering.
lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
lookup = self.kwargs.get(lookup_url_kwarg, None)
assert lookup is not None, "Other lookup methods are disabled"
filter_kwargs = {self.loo... |
kengz/Unity-Lab | test/env/test_vec_env.py | Python | mit | 3,861 | 0.002072 | from slm_lab.env.vec_env import make_gym_venv
import numpy as np
import pytest
@pytest.mark.parametrize('name,state_shape,reward_scale', [
('PongNoFrameskip-v4', (1, 84, 84), 'sign'),
('LunarLander-v2', (8,), None),
('CartPole-v0', (4,), None),
])
@pytest.mark.parametrize('num_envs', (1, 4))
def test_make... | ('PongNoFrameskip-v4', (1, 84, 84), (84, 84)),
('PongNoFrameskip-v4', (1, 64, 64), (64, 64)),
])
@pytest.mark.parametrize('num_envs', (1, 4))
def test_make_gym_venv_downsize(name, num_envs, state_shape, image_downsize):
seed = 0
frame_op = None
frame_op_len = None
venv = make_gym_venv(name, num_envs... | n, image_downsize=image_downsize)
venv.reset()
for i in range(5):
state, reward, done, info = venv.step([venv.action_space.sample()] * num_envs)
assert isinstance(state, np.ndarray)
assert state.shape == (num_envs,) + state_shape
assert isinstance(reward, np.ndarray)
assert reward.shape... |
Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/buildtools/checkdeps/builddeps.py | Python | mit | 15,226 | 0.004269 | #!/usr/bin/env python
# Copyright 2013 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.
"""Traverses the source tree, parses all found DEPS files, and constructs
a dependency rule table to be used by subclasses.
The format... | nd "!", even in the presubmit step.
include_rules = [
# Code should be able to use base (it's specified in the module-level
# deps above), but nothing in "base/evil" because it's evil.
"-base/evil",
# But this one subdirectory of evil is OK.
"+base/evil/not",
# And it can include files from... | it,
# so you shouldn't add further dependencies on it.
"!base/evil/ok_for_now.h",
]
If you have certain include rules that should only be applied for some
files within this directory and subdirectories, you can write a
section named specific_include_rules that is a hash map of regular
expressions to the list... |
YeoLab/gscripts | gscripts/rnaseq/submit_rnaseqc.py | Python | mit | 5,648 | 0.000708 | #!/usr/bin/env python
# Parse command line arguments
import argparse
# Submit jobs to the TSCC cluster
from gscripts.qtools import _Submitter
'''
Author: olga
Date created: 7/13/13 10:16 AM
The purpose of this program is to ...
Example run:
python /home/obotvinnik/gscripts/gscripts/rnaseq/submit_rnaseqc.py --base-... | name = 'rnaseqc_%s' % base_dir
submit_sh = '%srnaseqc.sh' % base_dir
command = 'java -jar %s -o %s -r %s -s %s -t %s %s' \
% (rnaseqc_bin, output_dir, genome_fasta, sample_file, gtf,
additional_argument | s)
commands = [command]
submit_out = submit_sh + '.out'
submit_err = submit_sh + '.err'
sub = _Submitter(queue_type='PBS', sh_file=submit_sh,
command_list=commands, job_name=job_name)
# sub.add_resource('-o', submit_out)
# sub.add_resource('-e', ... |
jlazear/cp | gui/mainframe.py | Python | gpl-2.0 | 6,003 | 0.0005 | import sys
import inspect
import time
import os
import wx
import wx.lib.scrolledpanel as scrolled
class NoDefault(object):
def __str__(self):
return 'NoDefault'
class MainFrame(wx.Frame):
"""
The main frame that holds all of the others. Really just an
expandable container for the notebook.
... | e the main sizer with the commands specified in the
contro | ller.
"""
methodslist = inspect.getmembers(self.controller, inspect.ismethod)
for name, method in methodslist:
try:
if method.command:
# Create the command button
bCmd = wx.Button(self.panel, wx.ID_ANY, name, size=(150,
... |
knightliao/pfrock | setup.py | Python | apache-2.0 | 2,454 | 0.000407 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
import re
try: # for pip >= 10
from pip._internal.req import parse_requirements
except ImportError: # for pip <= 9.0.3
from pip.req import parse_requirements
from setuptools import setup, find_packages
f = open(os.path.join(os.path.dirname(__... | '))
readme = f.read()
f.close()
# parse_requirements() returns generator of pip.req.InstallRequirement objects
install_reqs = parse_requirements(' | requirements.txt', session=False)
# reqs is a list of requirement
# e.g. ['django==1.5.1', 'mezzanine==1.4.6']
reqs = [str(ir.req) for ir in install_reqs]
def read(*names, **kwargs):
return io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
).read... |
CanalTP/navitia | source/jormungandr/tests/instant_system_new_default_routing_tests.py | Python | agpl-3.0 | 19,389 | 0.001547 | # -*- coding: utf-8 -*-
# Copyright (c) 2001-2017, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mob... | TICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Stay tuned using
# twitter @navitia
# channel `#navitia` on riot https://riot.im/app/#/ro... | port, print_function, unicode_literals, division
import pytest
from jormungandr.tests.utils_test import MockResponse
from tests.check_utils import get_not_null, s_coord, r_coord, journey_basic_query
from tests.tests_mechanism import dataset, NewDefaultScenarioAbstractTestFixture
DUMMY_INSTANT_SYSTEM_FEED_PUBLISHER = ... |
memsql/memsql-loader | memsql_loader/cli/clear_loader_db.py | Python | apache-2.0 | 1,240 | 0.003226 | """ Deletes the loader's database. """
import sys
from memsql_loader.util import cli_utils, servers
from memsql_loader.util.command import | Command
from memsql_loader.loader_db.storage import LoaderStorage
class ClearLoaderDb(Command):
@staticmethod
def configure(parser, subparsers):
subparser = subparsers.add_parser('clear-loader-db', help="Deletes the database containing MemSQL Loader's queued, running, and finished jobs.")
sub... | e loader database even if the MemSQL Loader server is running', action='store_true')
def run(self):
if not self.options.force:
if servers.is_server_running():
print 'Please stop any currently-running servers with stop-server before deleting the MemSQL Loader database.'
... |
Luthien123/aleph | aleph/migrate/env.py | Python | mit | 1,083 | 0.001847 | from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from aleph.core import app
from aleph.model import db
config = context.config
config.set_main_option('sqlalchemy.url', app.config['SQLALCHEMY_DATABASE | _URI'])
target_metadata = db.metadata
def run_migrations_offline():
url = config.get_main_option("sqlalchemy.url")
context.configure(url=url)
with context.begin_transaction():
context.run_migrations()
def run_migrations_online():
engine = engine_from_config(
config. | get_section(config.config_ini_section),
prefix='sqlalchemy.',
poolclass=pool.NullPool)
connection = engine.connect()
context.configure(
connection=connection,
target_metadata=target_metadata
)
try:
with context.begin_t... |
kavu/okeetee | gunicorn.config.py | Python | mit | 275 | 0.003636 | # coding=utf-8
import multiprocessing
workers = multiprocessing.cpu_count() * 2 + 1
# worker_class = "gaiohttp"
max_re | quests = 1000
max_requests_jitter = 100
preload = True
sen | dfile = True
pidfile = "pid/app.pid"
accesslog = "log/access.log"
errorlog = "log/error.log"
|
Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/PIL/XbmImagePlugin.py | Python | gpl-3.0 | 48 | 0.020833 | ../../../../share/pyshared/PIL | /XbmImagePlugin.p | y |
sharkySharks/PythonForDevs | Labs-Worked/Day3/lab21.py | Python | mit | 469 | 0.006397 | def gen(start, stop):
for x in xran | ge(start, stop):
if x % 2 == 0:
result = x
else:
result = 'odd'
yield result
for y in gen(4,7):
print y
print 'Generator Finished.'
next_gen = gen(4, 7) # this one you run manually in the python shell
while True: # can this even run on its own??
tr... | StopIteration:
print 'Generator Finished.'
break
|
mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/rust/tests/test_tvm_basic/src/build_test_lib.py | Python | apache-2.0 | 551 | 0.005445 | #!/usr/bin/env python3
"""Prepares a simple TVM library for testing."""
from os import path as osp
import sys
import tvm
def main():
n = tvm.var('n')
A = tvm.placeholder((n,), name='A')
B = tvm.placeholder( | (n,), name='B')
C = tvm.compute(A.shape, lambda *i: A(*i) + B(*i), name='C')
s = tvm.create_schedule(C.op)
s[C].parallel(s[C].op.axis[0])
print(tvm.lower(s, [A, B, C], simple_mode=True))
tvm.build(s, [A, B, C], 'llvm --system-lib').save(osp.join(sys.argv[1], 'test.o'))
if __na | me__ == '__main__':
main()
|
indictranstech/focal-erpnext | selling/doctype/raw_material_specs_details/raw_material_specs_details.py | Python | agpl-3.0 | 285 | 0.010526 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contrib | utors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.doc | ument import Document
class RawMaterialSpecsDetails(Document):
pass
|
dantebarba/docker-media-server | plex/Sub-Zero.bundle/Contents/Libraries/Shared/subliminal_patch/utils.py | Python | gpl-3.0 | 1,901 | 0.00263 | # coding=utf-8
import re
def sanitize(string, ignore_characters=None, default_characters={'-', ':', '(', ')', '.'}):
"""Sanitize a string to strip special characters.
:param str string: the string to sanitize.
:param set ignore_characters: characters to ignore.
:return: the sanitized string.
:rt... | :
"""Fix titles with inconsistent naming using dictionary and sanitize them.
:param str title: original title.
:param dict inconsistent_titles_dict: dictionary of titles with inconsistent naming.
:param boo | l no_sanitize: indication to not sanitize title.
:return: new title.
:rtype: str
"""
# only deal with strings
if title is None:
return
# fix titles with inconsistent naming using dictionary
inconsistent_titles_dict = inconsistent_titles_dict or {}
if inconsistent_titles_dict:
... |
chriszs/redash | tests/models/test_alerts.py | Python | bsd-2-clause | 2,513 | 0.001592 | from tests import BaseTestCase
from redash.models import Alert, db
from redash.utils import json_dumps
class TestAlertAll(BaseTestCase):
def test_returns_all_alerts_for_given_groups(self):
ds1 = self.factory.data_source
group = self.factory.create_group()
ds2 = self.factory.create_data_sou... | ry_rel=query, options={'op': 'equals', 'column': column, 'value': 1})
return alert
def test_evaluate_triggers_alert_when_equal(self):
alert = self.create_alert(get_results(1))
self.assertEqual(alert.evaluate(), Alert.TRIGGERED_STATE)
def test_evaluate_return_unknown_when_missing_column... | e_return_unknown_when_empty_results(self):
results = json_dumps({'rows': [], 'columns': [{'name': 'foo', 'type': 'STRING'}]})
alert = self.create_alert(results)
self.assertEqual(alert.evaluate(), Alert.UNKNOWN_STATE) |
scieloorg/articles_meta | processing/load_licenses.py | Python | bsd-2-clause | 6,277 | 0.001912 | # coding: utf-8
"""
This scripts scrapy the use licenses of the scielo documents from the website
and load them into the Articlemeta, this process is necessary because the
legacy databases does not have the licenses persisted for each document.
"""
import re
import os
import sys
import argparse
import logging
import lo... | ntroller.get_d | bconn(db_dsn)
except:
print('Fail to connect to:', db_dsn)
sys.exit(1)
parser = argparse.ArgumentParser(
description="Load Languages from SciELO static files available in the file system"
)
_collections_acronyms = collections_acronym(articlemeta_db)
parser = argparse.Argum... |
access-missouri/am-django-project | am/modelbills/apps.py | Python | bsd-2-clause | 160 | 0 | # -*- coding: ut | f-8 -*-
from __future__ import unicode_liter | als
from django.apps import AppConfig
class ModelbillsConfig(AppConfig):
name = 'modelbills'
|
underdogio/typeform | setup.py | Python | mit | 1,168 | 0 | from setuptools import setup, find_packages
with open('README.md') as fp:
long_description = fp.read()
setup(
name='typeform',
version='1.1.0',
description='Python Client wrapper for Typeform API',
long_descrip | tion=long_description,
long_description_content_type='text/markdown',
keywords=[
'type',
'form',
'typeform',
'api',
],
author='Typeform',
author_email='michael.solati@typeform.com',
url='https://github.com/MichaelSolati/typeform- | python-sdk',
packages=find_packages(),
install_requires=['requests'],
test_suite='typeform.test.suite.test_suite',
license='MIT',
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'... |
wileeam/airflow | tests/providers/google/cloud/operators/test_kubernetes_engine_system.py | Python | apache-2.0 | 1,271 | 0.000787 | #
# 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... | _system_helpers import CLOUD_DAG_FOLDER, provide_gcp_context, skip_gcp_system
from tests.test_utils.system_tests_class import SystemTest
@skip_gcp_system(GCP_GKE_KEY, require_local_executor=True)
class KubernetesEngineExampleDagTest(SystemTest):
@provide_gcp_context(GCP_GKE_KEY)
def test_run_example_dag(self)... | self.run_dag('example_gcp_gke', CLOUD_DAG_FOLDER)
|
spookey/ffflash | tests/inc/nodelist/test_nodelist_count.py | Python | bsd-3-clause | 1,001 | 0 | from random import choice
from ffflash.inc.nodelist import _nodelist_count
def test_nodelist_count_no_nodes_in_nodelist(tmpdir, fffake, capsys):
ff = fffake(tmpdir.join('api_file.json'), dry=True)
assert _nodelist_count(ff, {}) == (0, 0)
| out, err = capsys.readouterr()
assert 'empty' in out
assert 'ERROR' in out
assert err == ''
|
assert _nodelist_count(ff, {'what': 'ever'}) == (0, 0)
assert tmpdir.remove() is None
def test_nodelist_count(tmpdir, fffake):
ff = fffake(tmpdir.join('api_file.json'), dry=True)
def _n(c, o):
return {'status': {'clients': c, 'online': o}}
assert _nodelist_count(ff, {'nodes': [
... |
obi-two/Rebelion | data/scripts/templates/object/tangible/component/armor/shared_armor_segment_chitin.py | Python | mit | 489 | 0.04499 | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE | LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/component/armor/shared_armor_segment_chitin.iff"
result.attribute_template_id = -1
result.stfName("craft_clothing_ingredients_n","a... | esult |
miltonsarria/dsp-python | pygame/Globo2.py | Python | mit | 2,861 | 0.026215 | import pygame
import sys, os, random
import numpy as np
import cv2
sys.path.append('/usr/local/lib/python2.7/dist-packages/')
import freenect
import imutils
NEGRO = (0, 0, 0)
BLANCO = (255, 255, 255)
ROJO = (255, 0, 0)
class Bloque(pygame.sprite.Sprite):
def __init__(self, nombre_de_archivo):
pyga... | et_rect()
def reset_pos(self):
self.rect.y = random.randrange(-300, -20)
self.rect.x = random.randrange(700-20)
def update(self):
self.rect.y += 1
if self.rect.y > 410:
self.reset_pos()
class Protagonista(pygame.sprite.Sprite):
def __init__(self, color, width, ... | rect = self.image.get_rect()
def update(self):
pos = pygame.mouse.get_pos()
self.rect.x = pos[0]
self.rect.y = pos[1]
pygame.init()
WIDTH = 2*640
HEIGHT =2*480
pantalla = pygame.display.set_mode([WIDTH, HEIGHT])
bloque_lista = pygame.sprite.Group()
listade_todoslos_sprites= pygame... |
openstack/freezer-api | freezer_api/api/v2/jobs.py | Python | apache-2.0 | 11,296 | 0 | """
Copyright 2015 Hewlett-Packard
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, softwar... | ys = ['_version', 'user_id']
lh = self.doc.get('free | zer_action', None)
rh = other.doc.get('freezer_action', None)
diffkeys = [k for k in lh if lh[k] != rh.get(k)]
diffkeys += [k for k in rh if rh[k] != lh.get(k)]
for k in diffkeys:
if k not in dont_care_keys:
return False
return True
def __ne__(sel... |
nonZero/demos-python | src/examples/short/dbm/gdbm_insert.py | Python | gpl-3.0 | 431 | 0.00232 | #!/usr/bin/python3
'''
This is a simple example of how to use the dbm.gnu module of the
standard | python library
NOTES:
- the attempt to insert None as value throws an exception.
so only strings and bytes are allowed.
'''
import dbm.gnu # for open
# the 'c' in the next row means open rw and create if it doesn't exist
d = dbm.gnu.open('/tmp/foo.gdbm', 'c')
d['one'] = 'ehad'
d['t | wo'] = 'shtaim'
d['three'] = None
d.close()
|
ranjeet867/google-play-crawler | crawl_play_store.py | Python | mit | 3,421 | 0.006435 |
# coding: utf-8
# In[2]:
import time
from bs4 import BeautifulSoup
import sys, io
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.proxy import *
# @author Ranje | et Singh <ranjeetsingh867@gmail.com>
# Modify it according to your requirements
no_of_reviews = 1000
non_bmp_map = dict.fromkeys(range(0x10000, sys.maxunicode + 1), 0xfffd)
driver = webdriver.Chrome(r"C:\User | s\user\Anaconda3\Scripts\chromedriver.exe")
wait = WebDriverWait( driver, 10 )
# Append your app store urls here
urls = ["https://play.google.com/store/apps/details?id=com.flipkart.android&hl=en"]
for url in urls:
driver.get(url)
page = driver.page_source
soup_expatistan = BeautifulSoup(page, "html.p... |
OCA/e-commerce | product_template_multi_link/models/product_template_link_type.py | Python | agpl-3.0 | 3,627 | 0.000276 | # Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ProductTemplateLinkType(models.Model):
_name = "product.template.link.type"
_description = "Product Template Link Type"
name = fields.Char(required=True, translate=Tr... | n meaning is the same from each side of the relation",
default=True,
)
code = fields.Char(
"Technical code",
help="This code allows to provide a technical code to external"
"systems identifying this link type",
)
i | nverse_code = fields.Char(
"Technical code (inverse)",
compute="_compute_inverse_code",
inverse="_inverse_inverse_code",
readonly=False,
store=True,
help="This code allows to provide a technical code to external"
"systems identifying this link type",
)
man... |
nixonpjoshua/JNixonHelloContigsFilter | lib/KBaseReport/KBaseReportClient.py | Python | mit | 10,437 | 0.000958 | # -*- coding: utf-8 -*-
############################################################
#
# Autogenerated by the KBase type compiler -
# any changes made here will be overwritten
#
############################################################
from __future__ import print_function
# the following is a hack to get the basec... | ort_submit( | self, params, context=None):
return self._client._submit_job(
'KBaseReport.create_extended_report', [params],
self._service_ver, context)
def create_extended_report(self, params, context=None):
"""
A more complex function to create a report that enables the user to... |
public-ink/public-ink | server/appengine-staging/lib/promise/__init__.py | Python | gpl-3.0 | 994 | 0 | from .pyutils.version import get_version
try:
# This variable is injected in the __builtins__ by the build
# process. It used to enable importing subpackages when
# the required packages are | not installed
__SETUP__ # type: ignore
except NameError:
__SETUP__ = False
VERSION = (2, 0, 2, 'final', 0)
__version__ = get_version(VERSION)
if not __SETUP__:
from .promise import (
Promise,
promise_for_dict,
promisify,
is_thenable,
| async_instance,
get_default_scheduler,
set_default_scheduler
)
from .scheduler import SyncScheduler
try:
from .thread_sheduler import ThreadScheduler
except ImportError:
ThreadScheduler = None
__all__ = [
'Promise',
'promise_for_dict',
'prom... |
Sistemas-Multimedia/Icecast-tracker | Django/rocio333/IcecastTracker333/IcecastTracker333app/urls.py | Python | gpl-2.0 | 179 | 0.022346 | f | rom django.conf.urls import include, url
from . import v | iews
urlpatterns = [
url(r'^$', views.channel_list),
url(r'^play', views.play_channel),
url(r'^hello', views.hello),
] |
mjames-upc/python-awips | dynamicserialize/dstypes/com/raytheon/uf/common/site/notify/SiteActivationNotification.py | Python | bsd-3-clause | 1,716 | 0.000583 | ##
##
#
# SOFTWARE HISTORY
#
# | Date Ticket# Engineer Descriptio | n
# ------------ ---------- ----------- --------------------------
# 09/10/14 #3623 randerso Manually created, do not regenerate
#
##
class SiteActivationNotification(object):
def __init__(self):
self.type = None
self.status = None
self.primarySite = Non... |
brython-dev/brython | www/src/Lib/test/test_generators.py | Python | bsd-3-clause | 64,982 | 0.000508 | import copy
import gc
import pickle
import sys
import unittest
import weakref
import inspect
from test import support
try:
import _testcapi
except ImportError:
_testcapi = None
# This tests to make sure that if a SIGINT arrives just before we send into a
# yield from chain, the KeyboardInterrupt is raised i... | ept ValueError:
# we are called from "except ValueError:"
self.assertEqual(sys.exc_info()[0], ValueError)
raise TypeError()
except Exception as exc:
self.assertEqual(sys.exc_info()[0], TypeError)
| self.assertEqual(type(exc.__context__), ValueError)
# we are still called from "except ValueError:"
self.assertEqual(sys.exc_info()[0], ValueError)
yield
self.assertIsNone(sys.exc_info()[0])
yield "done"
g = gen()
next(g)
... |
rmotr/whooshercises | assignments/camel_case_string.py | Python | mit | 310 | 0.003226 | '''
title = "C | amel Case String"
level = "intro"
dificulty = "easy"
tags = ["strings", "functions", "camel-case"]
description = """
Write a function that receives a string and returns a camel case version of it.
Example:
camel_case('hello world') # Hello World
"""
'''
def camel_case(a_strin | g):
pass
|
mitre-cyber-academy/2013-grabbag-200 | src/images2gif.py | Python | apache-2.0 | 36,961 | 0.011553 | # -*- coding: utf-8 -*-
# Copyright (C) 2012, Almar Klein, Ant1, Marius van Voorden
#
# This code is subject to the (new) BSD license:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of s... | eturn bb
def | getImageDescriptor(self, im, xy=None):
""" getImageDescriptor(im, xy=None)
Used for the local color table properties per image.
Otherwise global color table applies to all frames irrespective of
whether additional colors comes in play that require a redefined
palette. St... |
pschmitt/home-assistant | tests/components/deconz/test_gateway.py | Python | apache-2.0 | 5,831 | 0.001543 | """Test deCONZ gateway."""
from copy import deepcopy
import pydeconz
import pytest
from homeassistant import config_entries
from homeassistant.components import deconz, ssdp
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from tests.async_mock import Mock, patch
from tests.common import MockCon... | RL: deconz.config_flow.DECONZ_MANUFACTURERURL,
s | sdp.ATTR_UPNP_SERIAL: BRIDGEID,
ssdp.ATTR_UPNP_UDN: "uuid:456DEF",
},
context={"source": "ssdp"},
)
await hass.async_block_till_done()
assert gateway.api.host == "2.3.4.5"
async def test_reset_after_successful_setup(hass):
"""Make sure that connection status triggers a dis... |
kawamon/hue | desktop/core/ext-py/openpyxl-2.6.4/openpyxl/styles/stylesheet.py | Python | apache-2.0 | 7,976 | 0.001254 | # Copyright (c) 2010-2019 openpyxl
from warnings import warn
from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
Typed,
)
from openpyxl.descriptors.sequence import NestedSequence
from openpyxl.descriptors.excel import ExtensionList
from openpyxl.utils.indexed_list import ... | n("Workbook contains no default style, apply openpyxl's default")
if stylesheet.colors is not None:
wb._colors = stylesheet.colors.index
def write_stylesheet(wb):
stylesheet = Stylesheet()
stylesheet.fonts = wb._fonts
stylesheet.fills = wb._fills
stylesheet.borders = wb._borders
style... | s.styles
from .numbers import NumberFormat
fmts = []
for idx, code in enumerate(wb._number_formats, BUILTIN_FORMATS_MAX_SIZE):
fmt = NumberFormat(idx, code)
fmts.append(fmt)
stylesheet.numFmts.numFmt = fmts
xfs = []
for style in wb._cell_styles:
xf = CellStyle.from_arr... |
NotSqrt/django-python3-ldap | django_python3_ldap/__init__.py | Python | bsd-3-clause | 88 | 0 | """
Django LDAP user authentication bac | kend for Python 3.
"""
__version__ = | (0, 9, 6)
|
pez2001/sVimPy | test_scripts/prng_single.py | Python | gpl-2.0 | 296 | 0.057432 | rnd_seed = 121294348
def rnd():
global rnd_seed
a = 214013
b = 2531011
m = | pow(2,32)
x = (rnd_seed * a + b) % m
rnd_seed = x
return x
def rnd_r(range):
return rnd() % (range + 1)
| def rnd_mr(min,max):
return min + rnd() % (max + 1 - min)
rm = 5
ra = 10
r = rnd_mr(rm,ra)
print("r:",r)
|
navaneethrameshan/PMU-burst | compareintervalplot.py | Python | gpl-2.0 | 16,603 | 0.011986 | #!/usr/bin/python
# plot interval CSV output from perf/toplev
# perf stat -I1000 -x, -o file ...
# toplev -I1000 -x, -o file ...
# intervalplotcompare.py file (or stdin)
# delimeter must be ,
# this is for data that is not normalized
# TODO: move legend somewhere else where it doesn't overlap?
from __future__ import di... | n(op_diff) > 0:
for key, components in op_diff.items():
print components
#print [(value[component] | ) for component in components]
#print [len(value[component]) for component in components]
diff_value={}
if key =='contention' :
print "KEY: ", key
ax1 = plt.subplot(2,1,1)
ax2 = plt.subplot(2,1,2)
else:
... |
bit2pixel/quickformat | src/code/quickformat.py | Python | gpl-2.0 | 14,607 | 0.003971 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 TUBITAK/BILGEM
# Renan Çakırerk <renan at pardus.org.tr>
#
# 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 ... |
print "WARNING: get_device_type (no parent?) -> %s" % self.path
def get_device_bus(self):
""" returns t | he bus of the device """
try:
return self.volume.parent().asDeviceInterface(Solid.StorageDrive.StorageDrive).bus()
except:
print "WARNING: get_device_bus (no parent?) -> %s" % self.path
def get_device_path(self):
try:
return str(self.volume.parent().asDev... |
argybarg/readbacks | readbacks/wsgi.py | Python | mit | 393 | 0.002545 | """
WSGI config for readbacks project.
I | t 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
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "readbacks.settings")
from django.core.wsgi import get_wsgi_application
appli... | = get_wsgi_application()
|
DouglasOrr/Snippets | hover/hover/render.py | Python | mit | 1,552 | 0.001289 | from dataclasses import dataclass
import io
import typing as T
import numpy as np
@dataclass(frozen=True)
class PolygonShape:
vertices: T.Tuple[T.Tuple[float]]
color: T.Text
@dataclass(frozen=True)
class Body:
x: float
y: float
angle: float
shapes: T.Tuple[PolygonShape]
@dataclass(frozen=... | bodies: T.Tuple[Body]
bounds: T.Tuple[float] # left, right, top, bottom
width: int
def draw_shape(shape, out):
out.write('<path fill="{fill}" d="'.format(fill=shape.color))
dx, dy = shape.vertices[0]
out.write('M {} {}'.format(dx, dy))
for (dx, dy) in shape.vertices[1:]:
out.write(... | e('"/>')
def draw_body(body, out):
out.write('<g transform="translate({x},{y}) rotate({angle})">'.format(
x=body.x, y=body.y, angle=body.angle * 180/np.pi,
))
for shape in body.shapes:
draw_shape(shape, out)
out.write('</g>')
def draw_scene(scene, out):
xmin, xmax, ymin, ymax = s... |
aelbouchti/Implot | implib/motor.py | Python | mit | 2,904 | 0.009298 | from tools import tools_decrypt
#from gpio import *
from point import point
class motor():
#Motor Class : input pins
#Methods :
# _move : input steps
# _move_steps : input steps
# _set_pins : input steps
""" this section still need some work
changing gpio controll to class in gpiotools "... | : input step
#_pin_status
#_move_one_step : intput sens
#_is_home
#_home
def __init__(self, name, pins, step, sensorpin):
| self.Motor = motor(pins)
self.Name = name
self.Sensor_Pin = sensor(sensorpin)
self.Home = False
self.Pos = 0
self.Adjusted_Step = step
def _set_motor_pins(self, pins):
self.Motor.Pins = pins
def _set_sensor_pin(self, pin):
self.Sensor_Pin._set_pin(p... |
jpzhangvincent/MobileAppMarketAnalysis | data/webscraping/appcrawl/pipelines.py | Python | mit | 1,109 | 0.003607 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
#from scrapy.conf import settings
from scrapy.exceptions import DropItem
import logging
class AppcrawlPipeline(o... | :
collection_name = 'appitems'
def __init__(self, mongo_uri, mongo_db):
self.mongo_uri = mongo_uri
self.mongo_db = mongo_db
@classmethod
def from_crawler(cls, crawler):
return cls(
mongo_uri=crawler.settings.get('MONGO_URI'),
mongo_db=crawler.settings.ge... | nt[self.mongo_db]
def close_spider(self, spider):
self.client.close()
def process_item(self, item, spider):
self.db[self.collection_name].update({'url': item['url']}, dict(item), upsert=True)
logging.info("App %s added to MongoDB database!" % item['name'])
return item
|
jeffchao/xen-3.3-tcg | tools/python/xen/util/vscsi_util.py | Python | gpl-2.0 | 4,265 | 0.001641 | #!/usr/bin/env python
# -*- mode: python; -*-
#============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation... | en('/sbin/scsi_id -gu -s /class/scsi_generic/' + sg).read().split()
if len(lines) == 0:
scsi_id = '-'
else:
scsi_id = lines[0]
devices.append([hctl, block, sg, scsi_id])
retur | n devices
def vscsi_search_hctl_and_block(device):
scsi_devices = vscsi_get_scsidevices()
tmp = device.split(':')
if len(tmp) == 4:
(hctl, block) = _vscsi_hctl_block(device, scsi_devices)
else:
(hctl, block) = _vscsi_block_scsiid_to_hctl(device, scsi_devices)
return (hctl, block... |
wilkerwma/codeschool | src/wagtailmarkdown/utils.py | Python | gpl-3.0 | 2,352 | 0.012755 | # vim:sw=4 ts=4 et:
# Copyright (c) 2015 Torchbox Ltd.
# felicity@torchbox.com 2015-09-14
#
# Permission is grante | d to anyone to use this software for any purpose,
# including commercial applications, and to alter it and redistribute it
# freely. This software is provided 'as-is', without any e | xpress or implied
# warranty.
#
from django.utils.safestring import mark_safe
import markdown
import bleach
import wagtailmarkdown.mdx.tables
import wagtailmarkdown.mdx.linker
def render(text):
return mark_safe(bleach.clean(markdown.markdown(text,
extensions=[ 'extra',
'codeh... |
mgasystem/giraumon | giraumon/tests/test_initialize.py | Python | gpl-3.0 | 924 | 0 | # -*- coding: utf-8 -*-
# License GPL-3.0 or later (http://www.gnu.org/licenses/gpl).
from click.testing import CliRunner
from giraumon.initialize import init
def test_init_without_git_repo(): |
"""Test init on folder with no git root """
runner = CliRunner()
result = runner.invoke(init, ['/tmp'])
assert result.exit_code == 1
assert 'Not a valid repository' in result.output
def test_init_wit | hout_git_force_repo():
"""Test init on folder with no git root and force option"""
runner = CliRunner()
result = runner.invoke(init, ['/tmp', '--force'])
assert result.exit_code == 0
assert 'Initialise Hosting Configuration in' in result.output
def test_init_with_git_repo():
"""Test init on fo... |
cloudspaces/interop-protocol | csinterop/csinterop/serializers.py | Python | gpl-2.0 | 1,718 | 0.001746 | from rest_framework import serializers
from csinterop.models import SharingProposal, Folder, User
class SharingProposalSerializer(serializers.ModelSerializer):
share_id = serializers.RelatedField(source='key')
permission = serializers.CharField(source='get_permission', read_only=True)
folder_name = serial... | A['permission'].lower() is 'read-write' else False
proposal.write_access = write_access
proposal.status = 'PENDING'
return proposal
class Meta:
model = SharingProposal
fields = (
'share_id', 'recipient', 'resource_url', 'owner_name', 'owner_email', 'folder_name',... | ed_at') |
DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/py_compile.py | Python | unlicense | 6,128 | 0.00359 | # uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: py_compile.py
"""Routine to "compile" a .py file to a .pyc (or .pyo) file.
This module has intimate knowledge of the format of .pyc files.
"""
impor... | mpile several so | urce files.
The files named in 'args' (or on the command line, if 'args' is
not specified) are compiled and the resulting bytecode is cached
in the normal manner. This function does not search a directory
structure to locate source files; it only compiles files named
explicitly. If '-' is the... |
MuckRock/muckrock | muckrock/crowdsource/migrations/0026_crowdsource_ask_public.py | Python | agpl-3.0 | 587 | 0.003407 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2020-03-04 21:13
# Django
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crowdsource', '0025_auto_20191209_1647'),
| ]
operations = [
migrations.AddField(
model_name='crowdsource',
name='ask_public',
| field=models.BooleanField(
default=True,
help_text=
'Add a field asking users if we can publically credit them for their response'
),
),
]
|
armoredsoftware/protocol | measurer/gdb-7.9/gdb/testsuite/gdb.perf/backtrace.py | Python | bsd-3-clause | 1,825 | 0.004932 | # Copyright (C) 2013-2015 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This progr... | __init__ ("backtrace")
self.depth = depth
def warm_up(self):
# Warm up.
gdb.execute ("bt", False, True)
gdb.execute ("bt", False, True)
def _do_test(self):
"""Do backtrace mul | tiple times."""
do_test_command = "bt %d" % self.depth
for _ in range(1, 15):
gdb.execute (do_test_command, False, True)
def execute_test(self):
line_size = 2
for _ in range(1, 12):
# Keep the total size of dcache unchanged, and increase the
# li... |
twonds/healthmonger | integration/features/environment.py | Python | mit | 110 | 0.009091 | from c | ollections import defaultdict
def before_scenario(context, _):
context.results = defa | ultdict(list)
|
examachine/bitdrill | perf/util.py | Python | agpl-3.0 | 953 | 0.011542 |
import sys
import string
import shelve
import os
import subprocess
def unzip(seq):
return zip(*seq)
def concat(a,b):
c = a[:]
c.extend(b)
return c
# pretty print a list
def strlist(l):
return string.join(map(lambda x: str(x) + ' ', l))
# transpose list of lists, slow
def transpose_lol(lol) :
... | 0])
t = []
for i in range(0,r):
l = []
for j in range(0,c):
l.append(lol[c][r])
t.append(l)
return t
def run(cmd, debug=False):
"""Run command and get the return value."""
if debug:
print | 'running ' + cmd
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
out, err = p.communicate()
if debug:
print 'return value for "%s" is %s' % (cmd, p.returncode)
if out:
print out
if err:
print 'error messages follow:'
print err
ret... |
edx/edx-platform | cms/djangoapps/contentstore/rules.py | Python | agpl-3.0 | 115 | 0 | """
Authorization rules related to content management.
"""
import user_tasks.rules
user_tasks.rules.add_rules( | )
| |
bassio/omicexperiment | omicexperiment/plotting/plot_bokeh.py | Python | bsd-3-clause | 2,474 | 0.014551 | from bokeh.plotting import figure
from bokeh.models import Legend, LegendItem, HoverTool, ColumnDataSource
from bokeh.core.properties import value
def plot_interactive(dataframe):
observations = list(dataframe.index)
samples_or_groups = list(dataframe.columns)
transposed_df = dataframe.T
... | else:
x_label = transposed_df.index.name
source=ColumnDataSource(transposed_df)
from bokeh.plotting import figure
p = figure(x_range=samples_or_groups,
y_range=(0,transposed_df.sum(axis=1).max())
)
from bokeh.palettes import Category20
import i... | colours = palette[len(observations)]
else:
colours = []
for i, c in enumerate(itertools.cycle(palette[max_color_palette])):
colours.append(c)
if i + 1 == len(observations): break
vbars = p.vbar_stack(observations,
... |
marcsowen/homematicip-rest-api | homematicip/_version.py | Python | gpl-3.0 | 18,466 | 0.000487 | # This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains th... | ter".
tags = set([r for r in refs if re.search(r"\d", r)])
if verbose:
print("discarding '%s', no digits" % ",".join(refs - tags))
if verbose:
| print("likely tags: %s" % ",".join(sorted(tags)))
for ref in sorted(tags):
# sorting will prefer e.g. "2.0" over "2.0rc1"
if ref.startswith(tag_prefix):
r = ref[len(tag_prefix) :]
if verbose:
print("picking %s" % r)
return {
"versi... |
kostya9/KPI.RelationalDatabases | Lab3/flights/core/views.py | Python | mit | 176 | 0.011364 | from django.shortcuts import render_to_response
from | django.http import HttpResponse
# Create your views here.
d | ef index(request):
return render_to_response('index.html') |
kwailamchan/programming-languages | python/django/elf/todo/todosite/todosite/urls.py | Python | mit | 319 | 0.012539 | from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'todosite.views.home', name= | 'home'),
# url(r'^blog/', include('blog.urls')),
url(r'^todo/', include('todo.urls')),
url(r'^admin/', include(admin.site.urls)),
| )
|
robintw/Py6S | trialparallel.py | Python | lgpl-3.0 | 973 | 0.001028 | import time
from random import random
import numpy as np
from IPython.parallel import Client, depend, dependent, require
import Py6S
@require("random", "Py6S")
def run(azimuth, zenith):
s = Py6S.SixS()
s.ground_reflectance = Py6S.GroundReflectance.HomogeneousRoujean(0.037, 0.0, 0.133)
s.geometry.view_a ... | sk.get() for task in tasks]
pend = time.time()
print(result)
sstart = time.time()
res = []
for azimuth in azimuths:
for zenith in z | eniths:
res.append(run(azimuth, zenith))
send = time.time()
print("Parallel %f" % (pend - pstart))
print("Serial %f" % (send - sstart))
|
Micronaet/micronaet-bots | edifact2fixed_orders-desadv-invoic-aperak/usersys/grammars/edifact/INVOICD96AUNEAN008.py | Python | gpl-3.0 | 6,663 | 0.0003 | #Generated by bots open source edi translator from UN-docs.
from bots.botsconfig import *
from edifact import syntax
from recordsD96AUN import recorddefs
structure = [
{ID: 'UNH', MIN: 1, MAX: 1, LEVEL: [
{ID: 'BGM', MIN: 1, MAX: 1},
{ID: 'DTM', MIN: 1, MAX: 35},
{ID: 'PAI', MIN: 0, MAX: 1},
{ID: 'ALI... | N: 0, MAX: 25, LEVEL: [
{ID: 'APR', MIN: 0, MAX: 1},
| {ID: 'RNG', MIN: 0, MAX: 1},
{ID: 'DTM', MIN: 0, MAX: 5},
]},
{ID: 'RFF', MIN: 0, MAX: 10, LEVEL: [
{ID: 'DTM', MIN: 0, MAX: 5},
]},
{ID: 'PAC', MIN: 0, MAX: 10, LEVEL: [
{ID: 'MEA', MIN: 0, MAX: 10},
{ID: 'PCI', MIN: 0, MAX: 10, LEVEL: [
... |
jwodder/permutation | test/test_eq.py | Python | mit | 2,573 | 0.000777 | from typing import Any
import pytest
from permutation import Permutation
EQUIV_CLASSES = [
[
Permutation(),
Permutation(1),
Permutation(1, 2),
Permutation(1, 2, 3, 4, 5),
Permutation.cycle(),
Permutation.from_cycles(),
Permutation.from_cycles(()),
],
... | [
(p, q)
for i, ps in enumerate(EQUIV_CLASSES)
for qs in EQUIV_CLASSES[:i] + EQUIV_CLASSES | [i + 1 :]
for p in ps
for q in qs
],
)
def test_neq(p: Permutation, q: Permutation) -> None:
assert p != q
assert not (p == q)
@pytest.mark.parametrize("p", [p for eqcls in EQUIV_CLASSES for p in eqcls])
@pytest.mark.parametrize("x", [None, 0, 1, True, False, "(1 2)", (1, 2), [1, 2]])
def ... |
amalakar/dd-agent | checks/network_checks.py | Python | bsd-3-clause | 8,122 | 0.002586 | # stdlib
from collections import defaultdict
from Queue import Empty, Queue
import threading
import time
# project
from checks import AgentCheck
from checks.libs.thread_pool import Pool
from config import _is_affirmative
TIMEOUT = 180
DEFAULT_SIZE_POOL = 6
MAX_LOOP_ITERATIONS = 1000
FAILURE = "FAILURE"
class Status... | .WARNING : AgentCheck.WARNING,
Status.CRITICAL : AgentCheck.CRITICAL,
Status.DOWN : AgentCheck.CRITICAL,
}
"""
Services checks inherits from this class.
| This class should never be directly instanciated.
Work flow:
The main agent loop will call the check function for each instance for
each iteration of the loop.
The check method will make an asynchronous call to the _process method in
one of the thread initiated in the thread pool ... |
JamesMackerel/PPTP_VPN_Sniffer | src/sniffer.py | Python | gpl-3.0 | 10,094 | 0.001882 | from datetime import datetime
from multiprocessing import Process, Queue, Manager, Value
import pyshark
from database import *
import logging
import threading
from typing import List, Dict, Tuple
from typing import *
class LogInUser:
def __init__(self, call_id, identifier, name, ip):
self.name = name
... | rror:
logging.info('skip ftp data packets')
return
class UserSniffer(threading.Thread):
def __init__(self, user: LogInUser, data_queue: Queue, data: Dict):
super().__init__()
self.user = user
with db_session:
self.user_id = User.get(u | sername=self.user.name).id
# find associate ppp interface
from utils import get_ppp_interfaces
interfaces = get_ppp_interfaces()
for i in interfaces:
if i[1] == user.local_ip:
self.interface = i[0]
user.capture_session = self
self.q =... |
eduNEXT/edunext-platform | import_shims/studio/student/management/__init__.py | Python | agpl-3.0 | 383 | 0.010444 | """Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('studen | t.management', 'common.djangoapps.student.management')
from common.djang | oapps.student.management import *
|
sthirugn/robottelo | tests/foreman/cli/test_hostgroup.py | Python | gpl-3.0 | 16,401 | 0 | # -*- encoding: utf-8 -*-
"""Test class for :class:`robottelo.cli.hostgroup.HostGroup` CLI.
@Requirement: Hostgroup
@CaseAutomation: Automated
@CaseLevel: Acceptance
@CaseComponent: CLI
@TestType: Functional
@CaseImportance: High
@Upstream: No
"""
from fauxfactory import gen_string
from robottelo.cli.base impor... | reate_with_name(self):
"""Don't create an HostGroup with inv | alid data.
@id: 853a6d43-129a-497b-94f0-08dc622862f8
@Assert: HostGroup is not created.
"""
for name in invalid_values_list():
with self.subTest(name):
with self.assertRaises(CLIReturnCodeError):
HostGroup.create({'name': name})
@run... |
mzdaniel/oh-mainline | vendor/packages/Django/tests/regressiontests/admin_scripts/tests.py | Python | agpl-3.0 | 61,095 | 0.005663 | """
A series of tests to establish that the command-line managment tools work as
advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE
and default settings.py files.
"""
import os
import shutil
import sys
import re
from django import conf, bin, get_version
from django.conf import settings
... | ings.DATABASES.values():
result = first_package_re.findall(backend['ENGINE'])
if result and result != 'django':
backend_pkg = __import__(result[0])
backend_dir = os.path.dirname(backend_pkg.__file__)
paths.append(os.path.dirname(backend_dir))
... | eturn paths
def run_test(self, script, args, settings_file=None, apps=None):
test_dir = os.path.dirname(os.path.dirname(__file__))
project_dir = os.path.dirname(test_dir)
base_dir = os.path.dirname(project_dir)
ext_backend_base_dirs = self._ext_backend_paths()
# Remember th... |
martydill/PyCIL | src/Assembly.py | Python | bsd-2-clause | 273 | 0.007326 |
class Assembly:
| def __init__(self):
self.name = 'Unname | dAssembly'
self.methods = []
self.extern = False
self.version = '1.0.0.0'
self.hashAlgorithm = None
self.customAttributes = []
self.classes = []
|
ygrass/handsome | accounts/migrations/0003_auto__add_photo.py | Python | unlicense | 5,858 | 0.008365 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Photo'
db.create_table(u'accounts_photo', (
(... | : ('django.db.models.fields.CharField', [], {'max_length': '32', 'blank': 'True'}),
'chest': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
'foot': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
| 'height': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
'hipline': ('django.db.models.fields.CharField', [], {'max_length': '16', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'preferred_style'... |
imk1/IMKTFBindingCode | makefastqdumpScript.py | Python | mit | 788 | 0.029188 | def makefastqdumpScript(sraFileNameListFileName, outputDirectory, scriptFileName):
# Make a script that wi | ll run fastq-dump on each of a list of SRA files
sraFileNameListFile = open(sraFileNameListFileName)
scriptFile = open(scriptFileName, 'w+')
for line in sraFileNameListFile:
# Iterate through the SRA files and make a line in the script for each
scriptFile.write("fastq-dump --split-3 --outdir " + outputDi... |
import sys
sraFileNameListFileName = sys.argv[1] # Contents should end with .sra
outputDirectory = sys.argv[2]
scriptFileName = sys.argv[3]
makefastqdumpScript(sraFileNameListFileName, outputDirectory, scriptFileName)
|
jfriedly/rethinkdb | drivers/python/docs/conf.py | Python | agpl-3.0 | 8,299 | 0.007591 | # Copyright 2010-2012 RethinkDB, all rights reserved.
# -*- coding: utf-8 -*-
#
# RethinkDB Python Driver documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 24 13:12:58 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible ... | ge for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B... | iles.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
# If true, the current module name will be prepended to all description
# un... |
Jessime/Excision | src/pick_file.py | Python | mit | 734 | 0.008174 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 28 23:15:47 2016
@author: jessime
"""
import sys
from PyQt5.QtWidgets import (QMainWindow, QFileDialog, QApplication)
class SelectScript(QMainWindow):
def __init__(self):
super().__init__()
self.file = self.initUI()
def i... | t" error.
| app = QApplication(sys.argv)
picker = SelectScript()
picker.close()
return picker.file
if __name__ == '__main__':
print(pick())
|
markusd/gpgpu | aws/delete-s3-keys.py | Python | gpl-3.0 | 361 | 0.00277 | #!/usr/bin/env python2.6
import sys
import bot | o
from boto.s3.key import Key
if len(sys.argv) < 3:
print "Not enough arguments"
| print "%s <bucket> <prefix>" % sys.argv[0]
sys.exit(1)
s3 = boto.connect_s3()
bucket = s3.get_bucket(sys.argv[1])
for k in bucket.list(sys.argv[2]):
if k.name not in [sys.argv[2]]:
bucket.delete_key(k.name) |
kawamon/hue | desktop/core/ext-py/pyasn1-modules-0.2.6/tools/pkcs10dump.py | Python | apache-2.0 | 1,165 | 0.000858 | #!/usr/bin/env python
#
# This file is part of pyasn1-modules software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
# Read ASN.1/PEM X.5 | 09 certificate requests (PKCS#10 format) on stdin,
# parse each into plain text, then build substrate from it
#
import sys
from pyasn1.codec.der import decoder
from pyasn1.codec.der import encoder
from pyasn1_modules import pem
from pyasn1_modules import rfc2314
if len(sys.argv) != 1:
print("""Usage:
$ cat cert... | ertificationRequest()
certCnt = 0
while True:
idx, substrate = pem.readPemBlocksFromFile(
sys.stdin, ('-----BEGIN CERTIFICATE REQUEST-----',
'-----END CERTIFICATE REQUEST-----')
)
if not substrate:
break
cert, rest = decoder.decode(substrate, asn1Spec=certType)
... |
SKA-ScienceDataProcessor/integration-prototype | sip/tango_control/flask_master/app/release.py | Python | bsd-3-clause | 535 | 0 | # -*- coding: utf-8 - | *-
"""SIP Flask Master Device package."""
import logging
__subsystem__ = 'TangoControl'
__service_name__ = 'FlaskMaster'
__version_info__ = (1, 3, 0)
__version__ = '.'.join(map(str, __version_info__))
__service_id__ = ':'.join(map(str, (__subsystem__,
__service_name__,
... | __version__',
'__service_id__',
'LOG'
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.