text stringlengths 6 947k | 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 |
|---|---|---|---|---|---|---|
from kolibri.core.tasks.job import Job
from kolibri.core.tasks.job import State
from kolibri.core.tasks.storage import Storage
DEFAULT_QUEUE = "ICEQUBE_DEFAULT_QUEUE"
class Queue(object):
def __init__(self, queue=DEFAULT_QUEUE, connection=None):
if connection is None:
raise ValueError("Connec... | mrpau/kolibri | kolibri/core/tasks/queue.py | Python | mit | 3,851 | 0.002337 |
__author__ = 'PaleNeutron'
import os
from urllib.parse import urlparse, unquote
import sys
from PyQt5 import QtWidgets, QtCore, QtGui
class MyMainWindow(QtWidgets.QMainWindow):
file_loaded = QtCore.pyqtSignal(str)
image_loaded = QtCore.pyqtSignal(QtGui.QImage)
def __init__(self):
su... | PaleNeutron/EpubBuilder | my_mainwindow.py | Python | apache-2.0 | 3,933 | 0.002628 |
#!/usr/bin/python
# (c) 2012, Stephen Fromm <sfromm@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 optio... | andreaso/ansible | lib/ansible/modules/system/seboolean.py | Python | gpl-3.0 | 7,200 | 0.003194 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with URL parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | hackersql/sq1map | thirdparty/bottle/bottle.py | Python | gpl-3.0 | 152,507 | 0.001489 |
import numpy as np
def zero_mean_normalize_image_data(data, axis=(0, 1, 2)):
return np.divide(data - data.mean(axis=axis), data.std(axis=axis))
def foreground_zero_mean_normalize_image_data(data, channel_dim=4, background_value=0, tolerance=1e-5):
data = np.copy(data)
if data.ndim == channel_dim or data... | ellisdg/3DUnetCNN | unet3d/utils/normalize.py | Python | mit | 7,176 | 0.002508 |
# -*- coding: utf-8 -*-
# enzyme - Video metadata parser
# Copyright 2011-2012 Antoine Bertin <diaoulael@gmail.com>
# Copyright 2003-2006 Thomas Schueppel <stain@acm.org>
# Copyright 2003-2006 Dirk Meyer <dischi@freevo.org>
#
# This file is part of enzyme.
#
# enzyme is free software; you can redistribute it and/or mod... | SickGear/SickGear | lib/enzyme/mpeg.py | Python | gpl-3.0 | 31,404 | 0.00035 |
# Configuration settings for Enso. Eventually this will take
# localization into account too (or we can make a separate module for
# such strings).
# The keys to start, exit, and cancel the quasimode.
# Their values are strings referring to the names of constants defined
# in the os-specific input module in use.
QUAS... | tartakynov/enso | enso/config.py | Python | bsd-3-clause | 3,462 | 0.000578 |
import math
import json
import os
import pytest
import rti_python.ADCP.AdcpCommands
def calculate_predicted_range(**kwargs):
"""
:param SystemFrequency=: System frequency for this configuration.
:param CWPON=: Flag if Water Profile is turned on.
:param CWPBL=: WP Blank in meters.
:param CWPBS=: WP... | ricorx7/rti_python | ADCP/Predictor/Range.py | Python | bsd-3-clause | 30,092 | 0.007344 |
from toee import *
from utilities import *
from Co8 import *
from py00439script_daemon import npc_set, npc_get
from combat_standard_routines import *
def san_dialog( attachee, triggerer ):
if (npc_get(attachee, 1) == 0):
triggerer.begin_dialog( attachee, 1 )
elif (npc_get(attachee, 1) == 1):
triggerer.begin_dia... | GrognardsFromHell/TemplePlus | tpdatasrc/co8infra/scr/py00416standard_equipment_chest.py | Python | mit | 4,171 | 0.101415 |
from functions.science import rms, mae, average, nan, inf
from collections import OrderedDict
from rawdata.table import table
from numpy import array, log10
import cma
from time import time, strftime
__all__ = ['fmin', 'optimbox', 'box', 'array', 'log10', 'rms', 'mae', 'average', 'nan', 'inf']
def box(x, y, xmin=-inf... | raphaelvalentin/Utils | optimize/optlib2.py | Python | gpl-2.0 | 8,671 | 0.011302 |
from __future__ import print_function
from sqlalchemy import create_engine
from sqlalchemy.pool import NullPool
import sqlalchemy
import sys
# This value must be incremented after schema changes on replicated tables!
SCHEMA_VERSION = 1
engine = None
def init_db_engine(connect_str):
global engine
engine = cre... | Freso/listenbrainz-server | messybrainz/db/__init__.py | Python | gpl-2.0 | 1,338 | 0.003737 |
import random
import musictheory
import filezart
import math
from pydub import AudioSegment
from pydub.playback import play
class Part:
def __init__(self, typ=None, intensity=0, size=0, gen=0, cho=0):
self._type = typ #"n1", "n2", "bg", "ch", "ge"
if intensity<0 or gen<0 or cho<0 or size<0 or inte... | joaoperfig/mikezart | source/markovzart2.py | Python | mit | 8,058 | 0.018367 |
# -*- coding: utf-8 -*-
import sqlite3
from flask import g, current_app
def connect_db():
db = sqlite3.connect(current_app.config['DATABASE_URI'])
db.row_factory = sqlite3.Row
return db
# http://flask.pocoo.org/docs/0.10/appcontext/
def get_db():
"""Opens a new database connection if there is none ... | gaowhen/summer | summer/db/connect.py | Python | mit | 485 | 0 |
import threading
import time
class Status:
lock = None
statusno =0
def __init__(self):
self.lock = threading.Lock()
def update(self, add):
self.lock.acquire()
self.statusno = self.statusno + add
self.lock.release()
def get(self):
self.loc... | RedFoxPi/Playground | threadtest.py | Python | gpl-2.0 | 929 | 0.01507 |
import os.path
import platform
from nose2.compat import unittest
from nose2.tests._common import FunctionalTestCase
class TestCoverage(FunctionalTestCase):
@unittest.skipIf(
platform.python_version_tuple()[:2] == ('3', '2'),
'coverage package does not support python 3.2')
def test_run(self):
... | usc-isi-i2/WEDC | spark_dependencies/python_lib/nose2/tests/functional/test_coverage.py | Python | apache-2.0 | 878 | 0.004556 |
__author__ = 'Alex Breshears'
__license__ = '''
Copyright (C) 2012 Alex Breshears
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 restriction, including without limitation the rights to
us... | t3hi3x/p-k.co | shorturls/admin.py | Python | mit | 1,450 | 0.008276 |
# Copyright (C) 2013 - 2016 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
import logging
import traceback
from collections import defaultdict
from ..anagonda.context import guru
from commands.base import Command
class PackageSymbols(Command):
"""Run g... | danalec/dotfiles | sublime/.config/sublime-text-3/Packages/anaconda_go/plugin/handlers_go/commands/package_symbols.py | Python | mit | 5,136 | 0 |
import time
import numpy as np
import keras
import tensorflow as tf
import keras.backend as K
from keras import optimizers
from keras.models import load_model
from keras.callbacks import Callback
from functions import calculate_top_k_new_only
"""
PeriodicValidation - Keras callback - checks val_loss periodically i... | DimiterM/santander | PeriodicValidation.py | Python | mit | 2,287 | 0.00962 |
# -*- coding: utf8 -*-
from .task import TaskID
from .core import Handler
from .queue import EventQueue
__all__ = [
'TaskID',
'Handler',
'EventQueue',
] | nosix/PyCraft | src/pycraft/service/whole/handler/__init__.py | Python | lgpl-3.0 | 171 | 0.005848 |
from .PBXResolver import *
from .PBX_Constants import *
class PBX_Base(object):
def __init__(self, lookup_func, dictionary, project, identifier):
# default 'name' property of a PBX object is the type
self.name = self.__class__.__name__;
# this is the identifier for this object
... | samdmarshall/xcparse | xcparse/Xcode/PBX/PBX_Base.py | Python | bsd-3-clause | 2,017 | 0.020327 |
##########################################################################
#
# Copyright (c) 2014, John Haddon. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of so... | chippey/gaffer | python/GafferSceneTest/PrimitiveVariablesTest.py | Python | bsd-3-clause | 2,924 | 0.027018 |
import logging
logger = logging.getLogger(__name__)
def get(isdsAppliance, check_mode=False, force=False):
"""
Retrieve available updates
"""
return isdsAppliance.invoke_get("Retrieving available updates",
"/updates/available.json")
def discover(isdsAppliance, ch... | IBM-Security/ibmsecurity | ibmsecurity/isds/available_updates.py | Python | apache-2.0 | 6,037 | 0.002319 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import re
import task_classes
from task_classes import QsubAnalysisTask
class DemoQsubAnalysisTask(QsubAnalysisTask):
"""
Demo task that will submit a single qsub job for the analysis
"""
def __init__(self, analysis, taskname = 'DemoQs... | NYU-Molecular-Pathology/snsxt | snsxt/sns_tasks/DemoQsubAnalysisTask.py | Python | gpl-3.0 | 2,720 | 0.015074 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------#
# Security - Linux Authentication Tester with /etc/shadow #
# ============================================================================ #
# Note: To be used for te... | Chavjoh/LinuxAuthenticationTester | LinuxAuthenticationTesterShadow.py | Python | apache-2.0 | 5,520 | 0.025915 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Tests for the registry flows."""
import os
from absl import app
from grr_response_client.client_actions import file_fingerprint
from grr_response_client.client_actions import searching
from grr_response_client.client_actions import standard
from grr_response_core.li... | google/grr | grr/server/grr_response_server/flows/general/registry_test.py | Python | apache-2.0 | 12,992 | 0.002617 |
from bitmovin.resources.models import AbstractModel
from bitmovin.resources import AbstractNameDescriptionResource
from bitmovin.errors import InvalidTypeError
from bitmovin.utils import Serializable
from .encoding_output import EncodingOutput
class Sprite(AbstractNameDescriptionResource, AbstractModel, Serializable)... | bitmovin/bitmovin-python | bitmovin/resources/models/encodings/sprite.py | Python | unlicense | 2,500 | 0.002 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import time
import unittest
import logging
import functools
from nose.tools import * # flake8: noqa (PEP8 asserts)
import mock
from framework.auth.core import Auth
from website import settings
import website.... | icereval/osf.io | osf_tests/test_elastic_search.py | Python | apache-2.0 | 47,974 | 0.001772 |
#!/usr/bin/env jython
import sys
#sys.path.append("/usr/share/java/itextpdf-5.4.1.jar")
sys.path.append("itextpdf-5.4.1.jar")
#sys.path.append("/usr/share/java/itext-2.0.7.jar")
#sys.path.append("/usr/share/java/xercesImpl.jar")
#sys.path.append("/usr/share/java/xml-apis.jar")
from java.io import FileOutputStream
fro... | jeffery9/mixprint_addons | ineco_thai_account/report/jy_serv.py | Python | agpl-3.0 | 1,612 | 0.031638 |
from __future__ import print_function
import math, nltk
from termcolor import colored
from analyze import generate_stopwords, sanitize
from vector import Vector
class NaiveBayesClassifier():
def __init__(self):
"""
Creates:
"""
self.c = {"+" : Vector(), "-" : Vector()}
... | trivedi/sentapy | NaiveBayes.py | Python | mit | 7,810 | 0.009091 |
# -*- coding: utf-8 -*-
# © 2015 Eficent Business and IT Consulting Services S.L. -
# Jordi Ballester Alomar
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models
| Eficent/odoo-operating-unit | account_invoice_merge_operating_unit/__init__.py | Python | agpl-3.0 | 202 | 0 |
'''
compile_test.py - check pyximport functionality with pysam
==========================================================
test script for checking if compilation against
pysam and tabix works.
'''
# clean up previous compilation
import os
import unittest
import pysam
from TestUtils import make_data_files, BAM_DATADIR... | pysam-developers/pysam | tests/compile_test.py | Python | mit | 1,181 | 0.001693 |
""" Title: Ch3LpfPlotResponse - Chapter 3: Plot filter response
Author: Ricardo Alejos
Date: 2016-09-20
Description: Plots the micro-strip filter response against the specifications
Version: 1.0.0
Comments: -
"""
# Import Python's built-in modules
import csv as _csv
import logging as _... | ricardoalejos/RalejosMsrElcDsn | SmdAngPtnSnt/pkg/ExpFlows/Ch3LpfPlotSaEvoVsRes.py | Python | mit | 5,718 | 0.03148 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2018 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).
# Support for fake joystick/gamepad during devlopment
# if no 'real' joystick/gamepad is available use keyboard emulation
# 'ctrl' + ... | hoechenberger/psychopy | psychopy/experiment/components/joystick/mouseJoystick.py | Python | gpl-3.0 | 1,348 | 0.009644 |
# -*- coding: Latin-1 -*-
# Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See License.txt for complete terms.
# file object -> CybOX File Object mappings
file_object_mappings = {'file_format': 'file_format',
'type': 'type',
'file_name': 'file_name',
... | MAECProject/pefile-to-maec | pefile_to_maec/mappings/file_object.py | Python | bsd-3-clause | 586 | 0.001706 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###################################################################
#
# Company: Squeeze Studio Animation
#
# Author: Danilo Pinheiro
# Date: 2014-02-10
# Updated: 2014-02-24
#
# sqStickyLipsSetup.py
#
# This script will create a Sticky Lips setup.
#
########... | SqueezeStudioAnimation/dpAutoRigSystem | dpAutoRigSystem/Extras/sqStickyLipsSetup.py | Python | gpl-2.0 | 20,524 | 0.007698 |
#!/usr/bin/env python3
import arrow
import math
from . import statnett
from . import ENTSOE
from . import DK
import logging
import pandas as pd
import requests
def fetch_production(zone_key='NL', session=None, target_datetime=None,
logger=logging.getLogger(__name__), energieopwek_nl=True):
... | corradio/electricitymap | parsers/NL.py | Python | gpl-3.0 | 9,768 | 0.005119 |
import argparse
import glob
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pickle
from sklearn.preprocessing import StandardScaler, normalize
import sys
import common
FACT = 'pmi' # nmf/pmi_wl/pmi_wp/pmi_wlp
DIM = 200
DATASET = 'MSDmm'
WINDOW = 1
NSAMPLES = 'all' #all
MAX_N_S... | sergiooramas/tartarus | src/load.py | Python | mit | 6,438 | 0.005747 |
import sys
print("Hello, World!") | bikoheke/hacktoberfest | scripts/hello_world_amlaanb.py | Python | gpl-3.0 | 34 | 0.029412 |
from cantilever_divingboard import *
# We need to scale the parameters before applying the optimization algorithm
# Normally there are about 20 orders of magnitude between the dimensions and
# the doping concentration, so this is a critical step
# Run the script
freq_min = 1e3
freq_max = 1e5
omega_min = 10... | jcdoll/PiezoD | python/archive/lbfgs.py | Python | gpl-3.0 | 752 | 0.009309 |
#
# 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... | apache/incubator-airflow | airflow/example_dags/example_complex.py | Python | apache-2.0 | 7,913 | 0.004929 |
def pytest_addoption(parser):
parser.addoption(
'--integration',
action='store_true',
help='run integration tests',
)
def pytest_ignore_collect(path, config):
if not config.getoption('integration') and 'integration' in str(path):
return True
| malinoff/amqproto | tests/conftest.py | Python | apache-2.0 | 288 | 0 |
def read_logfile_by_line(logfile):
"""generator function that yields the log file content line by line"""
with open(logfile, 'r') as f:
for line in f:
yield line
yield None
def parse_commands(log_content):
"""
parse cwl commands from the line-by-line generator of log file cont... | 4dn-dcic/tibanna | awsf3/log.py | Python | mit | 1,003 | 0.004985 |
import copy
import json
import logging
import threading
import uuid
from flask import Flask, abort, jsonify, request
import kubernetes
app = Flask(__name__)
app.secret_key = "mega secret key"
JOB_DB = {}
def get_config(experiment):
with open('config_template.json', 'r') as config:
return json.load(config... | diegodelemos/cap-reuse | step-broker/app.py | Python | gpl-3.0 | 3,081 | 0 |
# encoding: utf-8
# This file is part of Guacamole.
#
# Copyright 2012-2015 Canonical Ltd.
# Written by:
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
#
# Guacamole is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3,
# as published by ... | zyga/guacamole | guacamole/ingredients/test_cmdtree.py | Python | gpl-3.0 | 2,078 | 0 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | belokop/indico_bare | indico/modules/attachments/controllers/compat.py | Python | gpl-3.0 | 3,649 | 0.001644 |
import sys
[_, ms, _, ns] = list(sys.stdin)
ms = set(int(m) for m in ms.split(' '))
ns = set(int(n) for n in ns.split(' '))
print(sep='\n', *sorted(ms.difference(ns).union(ns.difference(ms))))
| alexander-matsievsky/HackerRank | All_Domains/Python/Sets/symmetric-difference.py | Python | mit | 194 | 0 |
import os
from whylog.log_reader.exceptions import EmptyFile, OffsetBiggerThanFileSize
class ReadUtils(object):
STANDARD_BUFFER_SIZE = 512
@classmethod
def size_of_opened_file(cls, fh):
prev_position = fh.tell()
fh.seek(0, os.SEEK_END)
size = fh.tell()
fh.seek(prev_positi... | andrzejgorski/whylog | whylog/log_reader/read_utils.py | Python | bsd-3-clause | 2,366 | 0.000423 |
#!python
# -*- coding: utf-8 -*-
from os import path
import shutil
def install():
filename = 'ilmaruuvi.service'
install_path = path.join('/etc/systemd/system', filename)
here = path.abspath(path.dirname(__file__))
with open(path.join(here, filename), 'r') as f:
service = f.read()
service =... | juhi24/ilmaruuvi | ilmaruuvi/systemd_service.py | Python | mit | 455 | 0.006593 |
"""
This scripts specifies all PTX special objects.
"""
from __future__ import print_function, absolute_import, division
import operator
import numpy
import llvmlite.llvmpy.core as lc
from numba import types, ir, typing, macro
from .cudadrv import nvvm
class Stub(object):
'''A stub object to represent special obj... | stefanseefeld/numba | numba/cuda/stubs.py | Python | bsd-2-clause | 9,284 | 0.002801 |
"""
sampyl.samplers.NUTS
~~~~~~~~~~~~~~~~~~~~
This module implements No-U-Turn Sampler (NUTS).
:copyright: (c) 2015 by Mat Leonard.
:license: MIT, see LICENSE for more details.
"""
from __future__ import division
import collections
from ..core import np
from .base import Sampler
from .hamiltonian import energy, ... | mcleonard/sampyl | sampyl/samplers/NUTS.py | Python | mit | 5,706 | 0.002103 |
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2017 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... | DataONEorg/d1_python | lib_common/src/d1_common/ext/mimeparser.py | Python | apache-2.0 | 6,325 | 0.003794 |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... | SUSE/kiwi | kiwi/system/kernel.py | Python | gpl-3.0 | 5,997 | 0 |
import medic
from maya import OpenMaya
class FaceAssigned(medic.PyTester):
def __init__(self):
super(FaceAssigned, self).__init__()
def Name(self):
return "FaceAssigned"
def Description(self):
return "Face assigned mesh(s)"
def Match(self, node):
return node.object()... | sol-ansano-kim/medic | plugins/Tester/faceAssigned.py | Python | mit | 1,666 | 0.001801 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gobject
import clutter
from text import TextContainer
from roundrect import RoundRectangle, OutlinedRoundRectangle
from clutter import cogl
class ClassicButton(TextContainer):
__gtype_name__ = 'ClassicButton'
def __init__(self, label=' ', margin=0, pad... | UbiCastTeam/candies | candies2/buttons.py | Python | lgpl-3.0 | 9,259 | 0.007884 |
import logging
from . import generic
from .elfreloc import ELFReloc
l = logging.getLogger(name=__name__)
# http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.pdf
arch = 'PPC64'
class R_PPC64_JMP_SLOT(ELFReloc):
def relocate(self):
if self.owner.is_ppc64_abiv1:
# R_PPC64_JMP_SLOT
... | angr/cle | cle/backends/elf/relocation/pcc64.py | Python | bsd-2-clause | 4,448 | 0.004946 |
def flatten(x):
"""
Takes an N times nested list of list like [[a,b],[c, [d, e]],[f]]
and returns a single list [a,b,c,d,e,f]
"""
result = []
for el in x:
if hasattr(el, "__iter__") and not isinstance(el, str):
result.extend(flatten(el))
else:
result.appen... | ai-se/Transfer-Learning | src/utils/misc_utils.py | Python | unlicense | 344 | 0 |
"""
For a detailed gene table and a summary gene table
"""
#!/usr/bin/env python
from collections import defaultdict
filename = 'detailed_gene_table_v75'
detailed_out = open(filename, 'w')
file = 'summary_gene_table_v75'
summary_out = open(file, 'w')
# write out files for detailed and summary gene table
detailed_... | brentp/gemini | gemini/annotation_provenance/gene_table/combined_gene_table.py | Python | mit | 9,693 | 0.018983 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0014_generalsetting_titulo'),
]
operations = [
migrations.AlterField(
model_name='imagen',
n... | nicolas471/Lecole | main/migrations/0015_auto_20160404_1648.py | Python | gpl-3.0 | 433 | 0.002309 |
#!/usr/bin/env python3
# -*- coding : utf-8 -*-
def mymodules2():
print("test module2!")
mymodules2() | kmahyyg/learn_py3 | modules/mymodule2/__init__.py | Python | agpl-3.0 | 107 | 0.018692 |
#! /usr/bin/env python3
import getopt
import os
import os.path
import re
import socket
import subprocess
import sys
import threading
import time
import tokenize
import traceback
import types
import linecache
from code import InteractiveInterpreter
try:
from tkinter import *
except ImportError:
print("** IDLE... | wdv4758h/ZipPy | lib-python/3/idlelib/PyShell.py | Python | bsd-3-clause | 52,145 | 0.001285 |
from __future__ import absolute_import
from Queue import Empty
from random import randint
from time import sleep
import os
from unittest import TestCase, skipUnless
from signal import SIGINT, SIGCHLD
from select import error as select_error
from os import getpid
from mock import MagicMock, patch, PropertyMock
from psy... | transifex/hermes | test_hermes/test_client.py | Python | bsd-3-clause | 17,562 | 0.000228 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import random
class BackoffTimer(object):
def __init__(self, ratio=1, max_interval=None, min_interval=None):
self.c = 0
self.ratio = ratio
self.max_interval = max_interval
self.min_interval = min_interval
def is_r... | wtolson/gnsq | gnsq/backofftimer.py | Python | bsd-3-clause | 899 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
from pip.basecommand import Command
from pip.index import PackageFinder
from pip.log import logger
from pip.exceptions import CommandError, PreviousBuildDirError
from pip.req import InstallRequirement, RequirementSet, parse_requirement... | tesb/flask-crystal | venv/Lib/site-packages/pip/commands/wheel.py | Python | apache-2.0 | 7,402 | 0.003513 |
# -*- coding: utf-8 -*-
import os
import lxml.etree
import io
from . import pipeline_item
import core.docvert_exception
class GeneratePostConversionEditorFiles(pipeline_item.pipeline_stage):
def stage(self, pipeline_value):
return pipeline_value
| holloway/docvert-python3 | core/pipeline_type/generatepostconversioneditorfiles.py | Python | gpl-3.0 | 263 | 0.003802 |
import random
from plugin import Plugin
class Flatter(Plugin):
def help_text(self, bot):
return bot.translate("flatter_help")
def on_msg(self, bot, user_nick, host, channel, message):
if message.lower().startswith(bot.translate("flatter_cmd")):
if len(message.split()) >= 2:
if bot.getlanguage... | k4cg/Rezeptionistin | plugins/flatter.py | Python | mit | 687 | 0.016012 |
import scipy as sp
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import sys
import matplotlib.lines as lines
import h5py
from matplotlib.font_manager import FontProperties
import matplotlib.ticker as ticker
from scipy.fftpack import fft
axial_label_font = FontProperties()
axial_label_font.se... | BorisJeremic/Real-ESSI-Examples | motion_one_component/Deconvolution_DRM_Propagation_Northridge/python_plot_parameteric_study.py | Python | cc0-1.0 | 5,870 | 0.019591 |
# -*- python -*-
# Copyright (C) 2009-2017 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 versio... | jocelynmass/nrf51 | toolchain/arm_cm0/arm-none-eabi/lib/thumb/v7-m/libstdc++.a-gdb.py | Python | gpl-2.0 | 2,482 | 0.006446 |
"""Run Monte Carlo simulations."""
from joblib import Parallel, delayed
from frbpoppy import Survey, CosmicPopulation, SurveyPopulation, pprint
from datetime import datetime
from copy import deepcopy
from glob import glob
import frbpoppy.paths
import os
import numpy as np
import pandas as pd
from tqdm import tqdm
impo... | davidgardenier/frbpoppy | tests/monte_carlo/simulations.py | Python | mit | 14,711 | 0 |
class Solution(object):
def imageSmoother(self, M):
"""
:type M: List[List[int]]
:rtype: List[List[int]]
"""
row, col = len(M), len(M[0])
ans = [[0]*col for i in xrange(row)]
for i in xrange(row):
for j in xrange(col):
cnt = 0
... | YiqunPeng/Leetcode-pyq | solutions/661ImageSmoother.py | Python | gpl-3.0 | 684 | 0.010234 |
"""Help to make choice"""
# PYTHON STUFFS #######################################################
import random
import shlex
from nemubot import context
from nemubot.exception import IMException
from nemubot.hooks import hook
from nemubot.module.more import Response
# MODULE INTERFACE ############################... | nbr23/nemubot | modules/rnd.py | Python | agpl-3.0 | 1,491 | 0.003353 |
from datetime import datetime
import uuid
class Torrent(object):
def __init__(self):
self.tracker = None
self.url = None
self.title = None
self.magnet = None
self.seeders = None
self.leechers = None
self.size = None
self.date = None
self.detai... | stopstop/duvet | duvet/objects.py | Python | gpl-3.0 | 1,485 | 0.003367 |
from . import services
def prep_rules(rules):
prepped = []
for rule in rules:
if rule['enabled']:
prepped.append(prep_rule(rule))
return prepped
def prep_rule(raw_rule):
rule = dict(raw_rule)
if rule['service'] != 'custom':
proto, port = services.decode_service(rul... | Kromey/piroute | iptables/utils.py | Python | mit | 808 | 0.001238 |
"""
The parser:
1. gets and expression
2. parses it
3. handles all boolean logic
4. delegates operator and rvalue parsing to the OperatorMap
SchemaFreeOperatorMap
supports all mongo operators for all fields.
SchemaAwareOperatorMap
1. verifies fields exist.
2. verifies operators are applied to fields of correc... | alonho/pql | pql/matching.py | Python | bsd-3-clause | 14,159 | 0.00678 |
from __future__ import unicode_literals
from . import exceptions
DEFAULT_HOST = 'http://api.acoustid.org/'
FORMATS = ('json', 'jsonp', 'xml')
META = (
'recordings', 'recordingids', 'releases', 'releaseids',
'releasegroups', 'releasegroupids', 'tracks', 'compress',
'usermeta', 'sources'
)
ERRORS = {
... | mattdennewitz/python-acoustid-api | acoustid_api/consts.py | Python | mit | 819 | 0 |
import sys
import time
from naoqi import ALProxy
IP = "nao.local"
PORT = 9559
if (len(sys.argv) < 2):
print "Usage: 'python RecordAudio.py nume'"
sys.exit(1)
fileName = "/home/nao/" + sys.argv[1] + ".wav"
aur = ALProxy("ALAudioRecorder", IP, PORT)
channels = [0,0,1,0]
aur.startMicrophonesRecording(fileName... | ioanaantoche/muhaha | ioana/RecordAudio.py | Python | gpl-2.0 | 757 | 0.018494 |
import os, sys, shutil
import zipfile
from zipfile import ZipFile
from urllib import urlretrieve
from subprocess import Popen, PIPE
from distutils.cmd import Command
def zip_directory(dir, zip_file):
zip = ZipFile(zip_file, 'w', compression=zipfile.ZIP_DEFLATED)
root_len = len(os.path.abspath(dir))
... | nuigroup/pymt-widgets | pymt/tools/packaging/win32/build.py | Python | lgpl-3.0 | 6,313 | 0.010771 |
# Copyright 2014 Alcatel-Lucent USA 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 l... | samsu/neutron | plugins/nuage/common/exceptions.py | Python | apache-2.0 | 919 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-10-26 14:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Occupanc... | christianknu/eitu | eitu/migrations/0001_initial.py | Python | mit | 662 | 0.001511 |
from django import template
from django.conf import settings
from django.template.defaultfilters import stringfilter
import os
register = template.Library()
@register.filter(name='basename')
@stringfilter
def basename(value):
return os.path.basename(value)
@register.filter(name='replace_macros')
@stringfilter... | troeger/opensubmit | web/opensubmit/templatetags/projecttags.py | Python | agpl-3.0 | 1,869 | 0.000535 |
"""
This script is a starting point for new Blocks users already familiar with
Machine Learning and Theano.
We demonstrate how to use blocks to train a generic set of parameters (theano
shared variables) that influence some arbitrary cost function (theano
symbolic variable), so you can start using blocks features (... | capybaralet/Blocks_quickstart | basic_blocks_script.py | Python | mit | 3,082 | 0.00292 |
# -----------------------------------------------------------------------------
# File name: main.py #
# Date created: 3/20/2014 #
# Date last modified: 1/18/2015 #
... | TonyWu386/redshift-game | main.py | Python | gpl-2.0 | 49,393 | 0.000121 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
# Datetime ############################
dt = datetime.datetime.now()
print(dt)
dt = datetime.datetime(year=2018, month=8, day=30, hour=13, minute=30)
print(dt)
print(dt.isoformat())
# Date ################################
d = datetime.date.today()
pr... | jeremiedecock/snippets | python/datetime_snippets.py | Python | mit | 605 | 0 |
"""AWS plugin for integration tests."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from ..util import (
ApplicationError,
display,
ConfigParser,
)
from . import (
CloudProvider,
CloudEnvironment,
CloudEnvironmentConfig,
)
from ..core_ci ... | azaghal/ansible | test/lib/ansible_test/_internal/cloud/aws.py | Python | gpl-3.0 | 3,937 | 0.002286 |
from Sire.IO import *
from Sire.MM import *
from Sire.System import *
from Sire.Mol import *
from Sire.Maths import *
from Sire.FF import *
from Sire.Move import *
from Sire.Units import *
from Sire.Vol import *
from Sire.Qt import *
import os
coul_cutoff = 20 * angstrom
lj_cutoff = 10 * angstrom
amber = Amber()
(... | chryswoods/SireTests | unittests/SireMM/testgridff2.py | Python | gpl-2.0 | 3,699 | 0.011895 |
# Copyright 2014 Objectif Libre
# Copyright 2015 DotHill Systems
#
# 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
#
# U... | nikesh-mahalka/cinder | cinder/volume/drivers/dothill/dothill_client.py | Python | apache-2.0 | 14,785 | 0 |
# Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | tensorflow/probability | tensorflow_probability/python/distributions/moyal_test.py | Python | apache-2.0 | 10,137 | 0.002861 |
""" UnitTests for the SimpleHTTPServer
"""
import mock
import unittest
class TestHTTPServerHandler(unittest.TestCase):
"""
"""
def setUp(self):
self.handler = mock.Mock()
def test_do_GET(self):
pass
def test_do_POST(self):
pass
def tearDown(self):
self.handler()
... | martynbristow/gabbi-examples | test_server.py | Python | mit | 367 | 0.016349 |
#a=[int(x) for x in input().split()]
#print (a)
x=5
y=10
b=[int(y) for y in input().split()]
#a=[int(x) for x in input().split()]
dir(_builtins_)
| krishnakantkumar0/Simple-Python | 13.py | Python | gpl-3.0 | 147 | 0.040816 |
a = "python"
print(a*2)
try:
print(a[-10])
except IndexError as e:
print("인덱스 범위를 초과 했습니다.")
print(e)
print(a[0:4])
print(a[1:-2])
# -10은 hi뒤로 10칸
print("%-10sjane." % "hi")
b = "Python is best choice."
print(b.find("b"))
print(b.find("B"))
try:
print(b.index("B"))
except ValueError as e:
prin... | JaeGyu/PythonEx_1 | 20170106.py | Python | mit | 455 | 0.004728 |
# 3rd party imports
from reportlab.platypus import Image, Paragraph, PageBreak, Table, Spacer
from reportlab.lib.units import cm
from reportlab.lib.pagesizes import A4
# Django imports
from django.conf import settings
# Project imports
from .arabic_reshaper import reshape
from .pdf_canvas import NumberedCanvas, getAr... | SmartElect/SmartElect | rollgen/generate_pdf.py | Python | apache-2.0 | 5,841 | 0.003938 |
from .analysis import *
from .toolbox import *
from . import utils
| Geosyntec/python-tidegates | tidegates/__init__.py | Python | bsd-3-clause | 67 | 0 |
"""Utilities for extracting common archive formats"""
import zipfile
import tarfile
import os
import shutil
import posixpath
import contextlib
from distutils.errors import DistutilsError
if "__PEX_UNVENDORED__" in __import__("os").environ:
from pkg_resources import ensure_directory # vendor:skip
else:
from pex.t... | pantsbuild/pex | pex/vendor/_vendored/setuptools/setuptools/archive_util.py | Python | apache-2.0 | 6,730 | 0.000594 |
# coding: utf-8
# These tests are taken from astropy, as with the astrodynamics.constant.Constant
# class. It retains the original license (see licenses/ASTROPY_LICENSE.txt)
from __future__ import absolute_import, division, print_function
import copy
import astropy.units as u
from astropy.units import Quantity
impor... | python-astrodynamics/astrodynamics | tests/test_constants.py | Python | mit | 2,079 | 0.000962 |
# coding: utf-8
# # Query `apiso:ServiceType`
# In[43]:
from owslib.csw import CatalogueServiceWeb
from owslib import fes
import numpy as np
# The GetCaps request for these services looks like this:
# http://catalog.data.gov/csw-all/csw?SERVICE=CSW&VERSION=2.0.2&REQUEST=GetCapabilities
# In[56]:
endpoint =... | rsignell-usgs/notebook | CSW/data.ioos.us-pycsw.py | Python | mit | 2,570 | 0.01323 |
from __future__ import unicode_literals
import json
from django.utils import six
from kgb import SpyAgency
from reviewboard.hostingsvcs.github import GitHub
from reviewboard.hostingsvcs.models import HostingServiceAccount
from reviewboard.hostingsvcs.repository import RemoteRepository
from reviewboard.hostingsvcs.ut... | chipx86/reviewboard | reviewboard/webapi/tests/test_remote_repository.py | Python | mit | 5,858 | 0 |
"""
Support to interface with Sonos players (via SoCo).
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.sonos/
"""
import datetime
import logging
from os import path
import socket
import urllib
import voluptuous as vol
from homeassistant.com... | betrisey/home-assistant | homeassistant/components/media_player/sonos.py | Python | mit | 20,355 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from shutil import which
from unittest.mock import patch
from urllib... | thumbor/thumbor | tests/handlers/test_base_handler_with_auto_webp.py | Python | mit | 7,701 | 0.00013 |
#!/usr/bin/env python
import os
import sys
import string
import random
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
kernels = {
'aes-aes' : 'gf_alog,gf_log,gf_mulinv,rj_sbox,rj_xtime,aes_subBytes,aes_addRoundKey,aes_addRoundKey... | giosalv/526-aladdin | MachSuite/script/llvm_compile.py | Python | apache-2.0 | 3,257 | 0.023641 |
import Linked_List
import sys
import random
def split_list(lst, a, b):
if lst.length % 2 == 1:
first_length = (lst.length / 2) + 1
else:
first_length = lst.length / 2
list_iterator = lst.head
count = 0
while count < first_length:
a.append(list_iterator.data)
list_i... | afaquejam/Linked-List-Problems | Others/FrontBackSplit.py | Python | mit | 1,330 | 0.003008 |
import re
from typing import Callable, Dict, List # noqa: F401
FormatText = Callable[[str], str]
ascii: str = (''' !"#$%&'()*+,-./'''
'0123456789'
':;<=>?@'
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
r'[\]^_`'
'abcdefghijklmnopqrstuvwxyz'
'{|}~')... | MeGotsThis/BotGotsThis | lib/helper/textformat.py | Python | gpl-3.0 | 11,881 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.