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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src/shop/cron.py | Python | apache-2.0 | 827 | 0 |
#!/usr/bin/python
""" README
This script is deprecated. Please use https://github.com/device42/servicenow_device42_mapping
This script reads CIs from Servicenow and uploads them to Device42.
It has 2 modes:
1. Full migration - when the TIMEFRAME is set to 0
2. Synchronization - when the TIMEFRAME... | device42/servicenow_to_device42_sync | starter.py | Python | mit | 2,360 | 0.013136 |
import urlparse
from scrapy.spider import BaseSpider
from scrapy.selector import Selector
from scrapy.http import Request
from ..items import Car
# Add the model(s) below you want to search for
# e.g. MODELS = ['Outback']
MODELS = []
# Enter the domain name(s) here you have permission to retrieve data from
# e.g. DO... | JeffPaine/subaru_search | subaru/spiders/subaru_spider.py | Python | mit | 3,059 | 0.002942 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists o... | pkdevbox/trac | trac/dist.py | Python | bsd-3-clause | 22,240 | 0.000899 |
# This loop monitors the rf Discharges for a particular amplitude, then repeats for other amplitudes
# n
from DAQ.Environment import *
def scanRF(LowestAmp, HighestAmp, step, numScans):
# setup
AmpList = []
fileSystem = Environs.FileSystem
file = \
fileSystem.GetDataDirectory(\
fileSystem.Paths["scanMaster... | ColdMatter/EDMSuite | EDMScripts/OldScripts/MonitorRFDischargesScanSynthAmp.py | Python | mit | 1,182 | 0.032995 |
import time
import rlp
import trie
import db
import utils
import processblock
import transactions
import logging
import copy
import sys
from repoze.lru import lru_cache
# logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger()
INITIAL_DIFFICULTY = 2 ** 17
GENESIS_PREVHASH = '\00' * 32
GENESIS_COINBASE =... | jnnk/pyethereum | pyethereum/blocks.py | Python | mit | 32,057 | 0.000655 |
#!/usr/bin/env python3
# Copyright © 2012-13 Qtrac Ltd. All rights reserved.
# This program or module 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)... | nwiizo/workspace_2017 | pipng/imagescale-c.py | Python | mit | 4,916 | 0.002035 |
import os
from setuptools import setup
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
LICENSE = open(os.path.join(os.path.dirname(__file__), 'LICENSE.txt')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup... | aptivate/django-spreadsheetresponsemixin | setup.py | Python | gpl-3.0 | 1,365 | 0.001465 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | HBEE/odoo-addons | sale_restrict_partners/__openerp__.py | Python | agpl-3.0 | 1,762 | 0.001135 |
# ------------------------------------------------------------------------------
import os, os.path, sys, re, time, random, types, base64
from appy import Object
import appy.gen
from appy.gen import Search, UiSearch, String, Page
from appy.gen.layout import ColumnLayout
from appy.gen import utils as gutils
from appy.ge... | Eveler/libs | __Python__/ufms_blanks/appy3/gen/mixins/ToolMixin.py | Python | gpl-3.0 | 65,134 | 0.00281 |
from enum import Enum
class Direction(Enum):
invalid = (0.0, 0.0)
up = (0.0, -1.0)
down = (0.0, 1.0)
left = (-1.0, 0.0)
right = (1.0, 0.0)
def x(self):
return self.value[0]
def y(self):
return self.value[1]
def __str__(self):
return str(self.... | Daarknes/Gadakeco | src/util/directions.py | Python | gpl-3.0 | 328 | 0 |
##############################################################################
# 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, [email protected], All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/py-readme-renderer/package.py | Python | lgpl-2.1 | 1,901 | 0.001052 |
#!/usr/bin/env python3
# encoding: UTF-8
import unittest
from vCloudOVFMunger import sanitise_machine_name
# Test my basic string sanitiser. This needs no setup, files, or network stuff.
# python -m unittest test.test_sanitise_machine_name
class XMLTests(unittest.TestCase):
def setUp(self):
self.allte... | environmentalomics/iso-to-image | uploader/test/test_sanitise_machine_name.py | Python | mit | 1,066 | 0.020657 |
import re, os, datetime
from sopel import module
from sopel.config.types import StaticSection, ValidatedAttribute, FilenameAttribute
DEFAULT_CHANLOGS_DIR = os.getenv("HOME") + "/chanlogs"
DEFAULT_LINE_PATTERN = re.compile(r"^([^\s]*) <([^>]*)> (.*)$")
class GrepLogsSection(StaticSection):
dir = FilenameAttribu... | thegoonies/tools | sopel-modules/grep-logs.py | Python | mit | 2,449 | 0.003675 |
## @example stream_from_webcamera.py
# This example will stream images from your webcamera and run it through a simple edge detection filter (LaplacianOfGaussian)
# and display it in real-time.
import fast
streamer = fast.CameraStreamer.create()
filter = fast.LaplacianOfGaussian.create().connect(streamer)
renderer =... | smistad/FAST | source/FAST/Examples/Python/stream_from_webcamera.py | Python | bsd-2-clause | 428 | 0.004673 |
'''Siku scenario
Sea ice element simple free drift example
Creates a (large) polygon in polar region and sets some basic winds
in still water. No interaction with any boundaries, just a free
float of the polygon in the area and output in KML format of its
locations.
Be sure that siku module is in y... | Atoku/siku | samples/beaufort.py | Python | gpl-2.0 | 14,677 | 0.025346 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | gunan/tensorflow | tensorflow/python/util/nest_test.py | Python | apache-2.0 | 54,367 | 0.003532 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | citrix-openstack-build/python-keystoneclient | keystoneclient/tests/v3/test_endpoints.py | Python | apache-2.0 | 3,490 | 0 |
# -*- coding:utf-8 -*-
import unittest
import nose
from mobileclick import Iunit, Intent, Summary, SummaryError
class SummaryTestCase(unittest.TestCase):
def setUp(self):
self.qid = 'MC2-E-0001'
self.i1 = Intent(self.qid, '%s-INTENT0001' % self.qid, 'Link')
self.i2 = Intent(self.qid, '%s-IN... | mpkato/mobileclick | tests/summary_test.py | Python | mit | 3,680 | 0.003261 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# module builder script
#
import os, sys, shutil, tempfile, subprocess, platform
template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
support_dir = os.path.join(template_dir, 'support')
sdk_dir = os.path.dirname(template_dir)
android_suppo... | arnaudsj/titanium_mobile | support/module/builder.py | Python | apache-2.0 | 7,110 | 0.03488 |
import numpy as np
import os
from mpEntropy import mpSystem
import matplotlib as mpl
from matplotlib.pyplot import cm
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from scipy.stats import norm
from scipy.signal import savgol_filter
from scipy.optimize import curve_fit
# This is a workaround until scipy... | marvinlenk/subsystem_entropy_epsplots | pyplot_eps/ent_eps.py | Python | bsd-2-clause | 6,836 | 0.00395 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most... | mitchcapper/mythbox | resources/lib/mysql-connector-python/python2/examples/unicode.py | Python | gpl-2.0 | 2,921 | 0.003766 |
# coding=utf-8
"""
The SNMPRawCollector is designed for collecting data from SNMP-enables devices,
using a set of specified OIDs
#### Configuration
Below is an example configuration for the SNMPRawCollector. The collector
can collect data any number of devices by adding configuration sections
under the *devices* hea... | disqus/Diamond | src/collectors/snmpraw/snmpraw.py | Python | mit | 6,089 | 0.000493 |
import os
import sys
import shutil
import subprocess
BASEDIR,BASEFILE = os.path.split(os.path.abspath(__file__))
print(BASEDIR,BASEFILE,os.getcwd())
par_dir,cur_dir = os.path.split(BASEDIR)
src_dir = os.path.join(par_dir,'AnimeWatch-PyQt5')
deb_config_dir = os.path.join(BASEDIR,'DEBIAN')
control_file = os.path.join(... | kanishka-linux/AnimeWatch | AnimeWatch-Debian-PyQt5/create_deb.py | Python | gpl-3.0 | 1,480 | 0.032432 |
"""
Contains all classes and functions to deal with lists, dicts, generators and
iterators in general.
Array modifications
*******************
If the content of an array (``set``/``list``) is requested somewhere, the
current module will be checked for appearances of ``arr.append``,
``arr.insert``, etc. If the ``arr`... | tequa/ammisoft | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/site-packages/jedi/evaluate/iterable.py | Python | bsd-3-clause | 31,484 | 0.00127 |
class MimeError(Exception):
pass
class DecodingError(MimeError):
"""Thrown when there is an encoding error."""
pass
class EncodingError(MimeError):
"""Thrown when there is an decoding error."""
pass
| alex/flanker | flanker/mime/message/errors.py | Python | apache-2.0 | 223 | 0 |
'''
Copyright (C) 2016 Turi
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
'''
import logging
import pprint
class ConsumerMock:
def __init__(self):
self._num_flushes = 0
def flush(self):
self._num_flushes += 1
cla... | ylow/SFrame | oss_src/unity/python/sframe/util/metric_mock.py | Python | bsd-3-clause | 1,457 | 0.019218 |
__author__ = 'k-sthan(II)'
def greeting(msg):
print(msg) | kvs6rj/cs3240-labdemo | helper.py | Python | mit | 61 | 0.032787 |
#-*- encoding: utf-8 -*-
"""
Copyright (c) 2010 Camille "nephthys" Bouiller <[email protected]>
InsideTags is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your opti... | nephthys/insidetags | functions.py | Python | agpl-3.0 | 5,173 | 0.010632 |
import pytest
from unittest.mock import patch
from borg_summon import config_parser
from .util import mock_globbing, mock_multiple_opens
def test_merge():
d1 = {
'a': 'a',
'b': {
'c': 'c',
'd': [1, 2, 3],
'e': [1, 2, 3],
},
... | grensjo/borg-summon | test/test_config_parser.py | Python | mit | 1,894 | 0.000528 |
#!/usr/bin/env python2.6
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2013 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... | stdweird/aquilon | tests/broker/test_del_disk.py | Python | apache-2.0 | 2,362 | 0.00127 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-25 18:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courses', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | paulopinda/simplemooc | simplemooc/courses/migrations/0002_auto_20160625_1845.py | Python | gpl-2.0 | 454 | 0.002203 |
import re
import urlparse
import datetime
from django.template.defaultfilters import truncatewords
from billy.core import mdb as db, feeds_db, settings
from .base import Document
from .metadata import Metadata
class FeedEntry(Document):
collection = feeds_db.entries
def __init__(self, *args, **kw):
... | mileswwatkins/billy | billy/models/feeds.py | Python | bsd-3-clause | 5,523 | 0.000362 |
# -*- coding: utf-8 -*-
import os.path as op
import gzip
import io
import struct
from datetime import datetime
from xml.etree import ElementTree
import numpy as np
import scipy.sparse
from aston.resources import cache
from aston.trace.Trace import AstonSeries, AstonFrame
from aston.tracefile.TraceFile import TraceFile... | molliewebb/aston | aston/tracefile/AgilentMS.py | Python | gpl-3.0 | 11,532 | 0.002168 |
"""
Test parsing of complex date and times
"""
import unittest, time, datetime
import parsedatetime as pdt
class test(unittest.TestCase):
@pdt.tests.assertEqualWithComparator
def assertExpectedResult(self, result, check, **kwargs):
return pdt.tests.compareResultByTimeTuplesAndFlags(result, check, **... | r3tard/BartusBot | lib/parsedatetime/tests/TestComplexDateTimes.py | Python | apache-2.0 | 3,487 | 0.009464 |
# -*- coding: utf-8 -*-
#
# This file is part of spectrumctl. See spectrumctl.py for a description.
#
# Copyright (C) 2009, 2010 Mathias Ertl
#
# Spectrumctl 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; eit... | hanzz/spectrum | spectrumctl/spectrum/__init__.py | Python | gpl-2.0 | 883 | 0.00453 |
'''
Created on 19 nov. 2015
@author: Bertrand Verdu
'''
if __name__ == '__main__':
pass | bverdu/onDemand | onDemand/plugins/zigbee/light.py | Python | agpl-3.0 | 95 | 0.021053 |
import os
from setuptools import find_packages, setup
from pip.req import parse_requirements
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
#... | eamoncaddigan/Leverage | setup.py | Python | agpl-3.0 | 1,490 | 0.000671 |
#!/usr/bin/env python3
import json
import os
import unittest
import requests
AGNOS_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)))
MANIFEST = os.path.join(AGNOS_DIR, "agnos.json")
class TestAgnosUpdater(unittest.TestCase):
def test_manifest(self):
with open(MANIFEST) as f:
m = json.load(f... | commaai/openpilot | selfdrive/hardware/tici/test_agnos_updater.py | Python | mit | 595 | 0.011765 |
# coding=utf-8
import functools
import re
import stat
import sys
if sys.version_info >= (3,0):
import io
StringIO = io.StringIO
else:
import cStringIO
StringIO = cStringIO.StringIO
import csbuild
from . import log
try:
from PyQt5 import QtCore, QtGui, QtWidgets
QMainWindow = QtWidgets.QMainWindow
QApplication =... | brandonmbare/csbuild | csbuild/_gui.py | Python | mit | 88,329 | 0.0338 |
#! /usr/bin/env python
# Released to the public domain, by Tim Peters, 03 October 2000.
"""reindent [-d][-r][-v] path ...
-d Dry run. Analyze, but don't make any changes to, files.
-r Recurse. Search for all .py files in subdirectories too.
-v Verbose. Print informative msgs; else no output.
Change ... | niavok/perroquet | utils/reindent.py | Python | gpl-3.0 | 8,897 | 0.001236 |
from boto.s3.connection import S3Connection
def main():
conn = S3Connection()
buckets = conn.get_all_buckets()
for b in buckets:
print b.name
if __name__ == "__main__":
main()
| chrisbarr/bilious-rutabaga | bucket_lister/__init__.py | Python | mit | 204 | 0.009804 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains simple input/output related functionality that is not
part of a larger framework or standard.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ...extern import ... | AustereCuriosity/astropy | astropy/io/misc/pickle_helpers.py | Python | bsd-3-clause | 3,779 | 0.000265 |
from gene_acronym_query import GeneAcronymQuery
query = GeneAcronymQuery()
gene_info = query.get_data('ABAT')
for gene in gene_info:
print "%s (%s)" % (gene['name'], gene['organism']['name'])
| wvangeit/AllenSDK | doc_template/examples/data_api_client_ex2.py | Python | gpl-3.0 | 197 | 0 |
"""Tests for GP and SP classes"""
import math
import unittest
import numpy as np
from gpkit import (Model, Monomial, settings, VectorVariable, Variable,
SignomialsEnabled, ArrayVariable)
from gpkit.geometric_program import GeometricProgram
from gpkit.small_classes import CootMatrix
from gpkit.feasibi... | galbramc/gpkit | gpkit/tests/t_model.py | Python | mit | 14,190 | 0.001339 |
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | freedomboxtwh/Plinth | plinth/__init__.py | Python | agpl-3.0 | 750 | 0 |
#! /usr/bin/env python
import argparse, re, os
parser = argparse.ArgumentParser(description = 'Download genome/transcript sequences and gene annotations')
parser.add_argument('species', choices=['hg19','mm10','TAIR10'], help='choose a species (Human, Mouse, Arabidopsis)')
parser.add_argument('-d', '--download', action... | bioxfu/circRNAFinder | src/SeqAnnoDownloadBuild.py | Python | gpl-3.0 | 7,557 | 0.025275 |
from __future__ import unicode_literals
import binascii
import collections
import email
import getpass
import io
import optparse
import os
import re
import shlex
import shutil
import socket
import subprocess
import sys
import itertools
import xml.etree.ElementTree
try:
import urllib.request as compat_urllib_requ... | nfedera/rg3-youtube-dl | youtube_dl/compat.py | Python | unlicense | 21,183 | 0.001275 |
# coding=utf-8
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# di... | MDSLab/s4t-iotronic | iotronic/common/keystone.py | Python | apache-2.0 | 5,025 | 0 |
# Copyright Least Authority Enterprises.
# See LICENSE for details.
"""
An in-memory implementation of the Kubernetes client interface.
"""
from json import loads
import attr
from pyrsistent import InvariantException, PClass, field, pset
from zope.interface import Interface, implementer
from twisted.python.url im... | LeastAuthority/txkube | src/txkube/_memory.py | Python | mit | 25,882 | 0.001468 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <[email protected]>
#
# This file is part of Weblate <http://weblate.org/>
#
# 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, eithe... | dhodhala88/Bosch1 | weblate/trans/tests/test_models.py | Python | gpl-3.0 | 23,236 | 0 |
# Generated by Django 1.11.21 on 2019-07-01 12:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('instructor_task', '0002_gradereportsetting'),
]
operations = [
migrations.AlterField(
model_name='instructortask',
... | eduNEXT/edx-platform | lms/djangoapps/instructor_task/migrations/0003_alter_task_input_field.py | Python | agpl-3.0 | 396 | 0 |
import gc
import os
import random
import eventlet
from eventlet import hubs, greenpool, event, pools
from eventlet.support import greenlets as greenlet, six
import tests
def passthru(a):
eventlet.sleep(0.01)
return a
def passthru2(a, b):
eventlet.sleep(0.01)
return a, b
def raiser(exc):
raise... | collinstocks/eventlet | tests/greenpool_test.py | Python | mit | 15,085 | 0.000133 |
"""
Common task fixtures.
"""
#
# Fimfarchive, preserves stories from Fimfiction.
# Copyright (C) 2020 Joakim Soderlund
#
# 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 t... | JockeTF/fimfarchive | tests/tasks/conftest.py | Python | gpl-3.0 | 2,907 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import argparse
import os, sys, re
import random
from time import time
import cv2
import numpy as np
import chainer
from chainer import cuda
import chainer.functions as F
import overwrite
from chainer.functions import caffe
"""
off... | nutszebra/ddp | illust2vecNC.py | Python | mit | 4,789 | 0.019661 |
# -*- coding: utf-8 -*-
import os,math
from qgis.core import NULL
from mole import oeq_global
from mole.project import config
from mole.extensions import OeQExtension
from mole.stat_corr import rb_contemporary_base_uvalue_by_building_age_lookup
def calculation(self=None, parameters={},feature = None):
from math i... | UdK-VPT/Open_eQuarter | mole/extensions/prop_buildings/oeq_HHRS.py | Python | gpl-2.0 | 1,148 | 0.008711 |
from django.conf import settings
from appconf import AppConf
class ModelDatabankAppConf(AppConf):
"""App specific settings. Overridable in global settings.
DATA_PATH: path to the real mercurial repositories; these should never
be manipulated directly. Active repositories are symlinked in the
... | nens/model-databank | model_databank/conf.py | Python | gpl-3.0 | 1,241 | 0 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | yanheven/nova | nova/tests/functional/v3/test_deferred_delete.py | Python | apache-2.0 | 1,610 | 0 |
from db_utils import deleteLinksByHost
from db_utils import deleteHost
from db_utils import addNewHost
from db_utils import getAllHosts
from error_message import showErrorPage
from error_message import ErrorMessages
import utils
import webapp2
from google.appengine.api import users
from google.appengine.ext import ndb... | cloud-io/CloudUp | src/admin_views.py | Python | mit | 2,370 | 0.007173 |
"""Unittests for the barrista project."""
# pylint: disable=F0401, C0330, C0302, C0103, R0201, R0914, R0915, W0212
# pylint: disable=no-name-in-module, no-member
import unittest
import logging
logging.basicConfig(level=logging.WARN)
try:
import cv2 # pylint: disable=W0611
CV2_AVAILABLE = True
except ImportEr... | classner/barrista | tests.py | Python | mit | 108,780 | 0.000276 |
# coding=utf-8
import pprint
import config
import json
import urllib
import requests
class Driver(object):
def __init__(self):
self.driver_type = self.__class__.__name__
# Get credentials from conf files for CMDB
pass
def get_driver_type(self):
return self.driver_type
... | uggla/alexandria | alexandria/drivers.py | Python | apache-2.0 | 4,848 | 0.010111 |
from gtk import *
import sys
import gview
import string
import gvutils
import GtkExtra
import time
import os
import gviewapp
import gvplot
import gdal
sys.path.append('.')
import ev_profile
from quality_hist_tool import QualityHistogramROITool
LYR_GENERIC = 0
LYR_LANDSAT8 = 1
LYR_SOURCE_TRACE = 2
LYR... | warmerdam/plcompositor | oev_tools/ev_mosaic_viewer.py | Python | apache-2.0 | 9,675 | 0.007649 |
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
try:
import cPickle as pickle
except ImportError:
import pickle
# Handle the case where the requests module has been patched to not have
# urllib3 bundled as part of its source.
try:
from pip._v... | ncos/lisa | src/lisa_drive/scripts/venv/lib/python3.5/site-packages/pip-10.0.1-py3.5.egg/pip/_vendor/cachecontrol/compat.py | Python | mit | 724 | 0 |
#!/usr/bin/env python
# Copyright (c) 2005-2009 Jaroslav Gresula
#
# Distributed under the MIT license (See accompanying file
# LICENSE.txt or copy at http://jagpdf.org/LICENSE.txt)
#
import jagpdf
import jag.testlib as testlib
def test_main(argv=None):
doc = testlib.create_test_doc(argv, 'defaultfont2.pdf')
... | jgresula/jagpdf | code/test/apitest/py/defaultfont2.py | Python | mit | 952 | 0.003151 |
import os
import pathlib
import locale
import time
from . import xn_logger
logger = xn_logger.get(__name__, debug=False)
# Incapsulates downloaded pages storage
# keeps all downloaded files in ./cache
# the file first requested from this cache,
# and only if get() returns None, it will be
# downloaded over network
... | minlexx/xnovacmd | ui/xnova/xn_page_cache.py | Python | gpl-2.0 | 4,643 | 0.002585 |
from decimal import Decimal
from django.conf import settings
from coupons.models import Coupon
from shop.models import Product
class Cart(object):
def __init__(self, request):
"""
initialize the cart.
"""
self.session = request.session
cart = self.session.get(settings.CAR... | spectrumone/online-shop-template | myshop/cart/cart.py | Python | mit | 3,017 | 0.001326 |
#
# Copyright (c) 2013-2014, Scott J Maddox
#
# This file is part of openbandparams.
#
# openbandparams is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# ... | scott-maddox/openbandparams | src/openbandparams/examples/advanced/GaInAsSb_on_GaSb/Plot_Bandgap_vs_Lattice_Constant_of_Quaternary3.py | Python | agpl-3.0 | 3,726 | 0.001879 |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import
# Standard imports
from future import standard_library
standard_library.install_aliases()
from builtins import *
from past.utils import old_div
import unittest
import json... | shankari/e-mission-server | emission/incomplete_tests/TestCarbon.py | Python | bsd-3-clause | 13,159 | 0.012387 |
from recon.core.module import BaseModule
import codecs
import os
class Module(BaseModule):
meta = {
'name': 'List Creator',
'author': 'Tim Tomes (@LaNMaSteR53)',
'description': 'Creates a file containing a list of records from the database.',
'options': (
('table', 'hos... | praetorian-inc/pentestly | modules/reporting/list.py | Python | gpl-3.0 | 1,569 | 0.003824 |
# da vs turns module
import numpy as np
from scipy import optimize
import matplotlib.pyplot as pl
import glob, sys, os, time
from deskdb import SixDeskDB,tune_dir,mk_dir
import matplotlib
# ------------- basic functions -----------
def get_divisors(n):
"""finds the divisors of an integer number"""
large_divisors = ... | mfittere/SixDeskDB | sixdeskdb/davsturns.py | Python | lgpl-2.1 | 28,687 | 0.049395 |
from JupJup.Present import collector
| karlin13/LzCoinJupJup | JupJup/Present/__init__.py | Python | mit | 37 | 0 |
from PySide import QtGui, QtCore
import os, struct, time
class ControlMainWindow(QtGui.QMainWindow):
_storeButtonUsed = False
_gv = None
_parser = None
_inter = None
_workpiecePos = [ 5, 5, 5 ]
_originOffset = [ 0, 0 ]
_polarCorrection = [ 1, 0 ]
_debounce = None
def __init__(self, chatBackend):
super(Cont... | stesie/PyPC-NC | Control/MainWindow.py | Python | gpl-3.0 | 11,785 | 0.02919 |
import os
import sys
import re
import yaml
import uuid
import glob
from lib.tarantool_server import TarantoolServer
## Get cluster uuid
cluster_uuid = ''
try:
cluster_uuid = yaml.load(server.admin("box.space._schema:get('cluster')",
silent = True))[0][1]
uuid.UUID('{' + cluster_uuid + '}')
print 'o... | mejedi/tarantool | test/replication-py/cluster.test.py | Python | bsd-2-clause | 13,538 | 0.001847 |
# -*- coding: utf-8 -*-
# __author__: Yixuan LI
# __email__: [email protected]
import os
import json
import re
from optparse import OptionParser
import tweepy
import time
class UserTimeline:
def __init__(self,inputDir,outputDir):
self.inputDir = inputDir
self.outputDir = outputDir
os.system("mkdir -p %s"%(o... | YixuanLi/geo-tweet | twitter-timeline/get_non_locator_timeline.py | Python | gpl-2.0 | 5,282 | 0.029156 |
# Copyright (C) 2014 Pierre de Buyl
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and... | capoe/espressopp.soap | src/analysis/TotalVelocity.py | Python | gpl-3.0 | 2,733 | 0.011343 |
# -*- coding: utf-8 -*-
# This file is part of wger Workout Manager.
#
# wger Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any ... | DeveloperMal/wger | wger/manager/api/resources.py | Python | agpl-3.0 | 6,864 | 0.000874 |
# Multiple Linear Regression
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('50_Startups.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 4].values
# One hot encoding
from sklearn.preprocessing impor... | balazssimon/ml-playground | udemy/Machine Learning A-Z/Part 2 - Regression/Section 5 - Multiple Linear Regression/backward_elimination_manual.py | Python | apache-2.0 | 1,681 | 0.030934 |
from UI import UI
from View import View
import Elements
import Colors
| v4nz666/7drl2017 | RoguePy/UI/__init__.py | Python | gpl-3.0 | 70 | 0 |
import asyncio
from aio_pika import connect, IncomingMessage, ExchangeType
loop = asyncio.get_event_loop()
async def on_message(message: IncomingMessage):
async with message.process():
print("[x] %r" % message.body)
async def main():
# Perform connection
connection = await connect(
"amq... | mosquito/aio-pika | docs/source/rabbitmq-tutorial/examples/3-publish-subscribe/receive_logs.py | Python | apache-2.0 | 1,094 | 0 |
# DFF -- An Open Source Digital Forensics Framework
# Copyright (C) 2009-2011 ArxSys
# This program is free software, distributed under the terms of
# the GNU General Public License Version 2. See the LICENSE file
# at the top of the source tree.
#
# See http://www.digital-forensic.org for more information about this... | halbbob/dff | modules/builtins/info.py | Python | gpl-2.0 | 5,653 | 0.012383 |
#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"pinax.pinax_hello",
"pinax.pinax_hello.tests"
],
MIDD... | bennybauer/pinax-hello | runtests.py | Python | mit | 1,274 | 0.000785 |
# -*- coding: utf-8 -*-
from core.toad.generictask import GenericTask
from lib.images import Images
__author__ = "Mathieu Desrosiers, Arnaud Bore"
__copyright__ = "Copyright (C) 2016, TOAD"
__credits__ = ["Mathieu Desrosiers", "Arnaud Bore"]
class TensorMrtrix(GenericTask):
def __init__(self, subject):
... | mathieudesro/toad | tasks/11-tensormrtrix.py | Python | gpl-2.0 | 4,911 | 0.007127 |
import logging
import os
import shutil
from fusesoc.provider.provider import Provider
from fusesoc.utils import Launcher
logger = logging.getLogger(__name__)
class Coregen(Provider):
def _checkout(self, local_dir):
script_file = self.config.get('script_file')
project_file = self.config.get('proj... | imphil/fusesoc | fusesoc/provider/coregen.py | Python | gpl-3.0 | 1,221 | 0.002457 |
# Copyright (C) 2008-2012 Joachim B. Haga and Fredrik Valdmanis
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your... | maciekswat/dolfin_1.3.0 | site-packages/dolfin/common/plotting.py | Python | gpl-3.0 | 4,997 | 0.003602 |
from DIRAC import gLogger
from DIRAC.Core.Security.X509Chain import X509Chain
from DIRAC.Core.DISET.ThreadConfig import ThreadConfig
from DIRAC.ConfigurationSystem.Client.Helpers import Registry
from DIRAC.Core.DISET.AuthManager import AuthManager
from WebAppDIRAC.Lib.SessionData import SessionData
from WebAppDIRAC.Li... | zmathe/WebAppDIRAC | Lib/WebHandler.py | Python | gpl-3.0 | 10,812 | 0.045135 |
from functools import wraps
from flask import current_app, request
from standup.errors import api_error
def api_key_required(view):
@wraps(view)
def wrapper(*args, **kwargs):
data = request.args if request.method == 'GET' else request.form
api_key = data.get('api_key', '')
if api_key ... | rehandalal/standup | standup/apps/api2/decorators.py | Python | bsd-3-clause | 480 | 0 |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-06-20 19:55
import functools
import itertools
import logging
import os
from collections import defaultdict
from copy import copy
from itertools import chain
from typing import Union, List, Callable, Dict, Optional, Any, Iterable, Tuple
import numpy as np
import torc... | hankcs/HanLP | hanlp/components/mtl/multi_task_learning.py | Python | apache-2.0 | 38,042 | 0.00276 |
import numpy as np
from scipy import signal
import math
def norm_matrix(matrix):
for i in range(np.shape(matrix)[0]):
if np.max(matrix[i]) <= 0:
matrix[i] = matrix[i]
else:
matrix[i] /= np.max(matrix[i])
return matrix
def pool_boundaries(boundaries, filter_size, coeff... | michaelStettler/HISI | HISI/boundaries.py | Python | mit | 16,880 | 0.005746 |
from collections.abc import Sequence
from numbers import Number
from . import Validator, Length, Range, Instance
from .compound import All
class Latitude(All):
"""Validate the given value as a number between -90 and +90 in decimal degrees, representing latitude."""
validators = [
Instance(Number),
Range(-9... | marrow/schema | marrow/schema/validate/geo.py | Python | mit | 1,013 | 0.0385 |
import time
import collections
from overviewbot import OverviewBot, Window
def format_time(timestamp):
return time.strftime("%Y-%m-%d %H:%M:%S UTC", time.gmtime(timestamp))
class CustomWindow(Window):
def __init__(self, input_key, *args, **keys):
Window.__init__(self, *args, **keys)
self.inpu... | softcert/vsroom | vsroom/common/customoverview.py | Python | mit | 1,942 | 0.003605 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from processors.hra.extractors import _clean_identifier
from processors.hra.extractors import _url_from_title
# Tests
def test_clean_identifier... | arthurSena/processors | tests/test_hra.py | Python | mit | 992 | 0.004036 |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | noironetworks/heat | heat/tests/openstack/senlin/test_receiver.py | Python | apache-2.0 | 4,398 | 0 |
from django import forms
attr = {'class': 'form-control'}
class GroupSeedForm(forms.Form):
seed = forms.CharField(label='Seed', max_length=1337, initial='none', widget=forms.TextInput(attrs=attr))
class UserSeedForm(forms.Form):
pseudonym = forms.CharField(label='Pseudonym', min_length=3, widget=forms.TextIn... | ZenifiedFromI2P/antisocial | bootstraps/forms.py | Python | gpl-3.0 | 426 | 0.011737 |
# -*- coding: utf-8 -*-
'''
Created on 2012-7-3
@author: lihao
'''
try: import httplib
except ImportError:
import http.client as httplib
import urllib
import time
import hashlib
import json
import top
import itertools
import mimetypes
'''
定义一些系统变量
'''
SYSTEM_GENERATE_VERSION = "taobao-sdk-python-20151214"
P_AP... | BillBillBillBill/WishTalk-server | WishTalk/top/api/base.py | Python | mit | 10,416 | 0.009482 |
__author__ = 'Liam'
import types
def flag(func):
func.is_flag = True
return func
class BadSearchOp(Exception):
def __init__(self, value = "bad search operation"):
self.value = value
def __str__(self):
return "BadSearchOp: %s" % self.value
class ImapSearchQueryParser(object):
"... | syberkitten/Imap4SearchQueryParser | SearchParser.py | Python | gpl-3.0 | 16,261 | 0.011746 |
import os
import re
source_dir = "src/main/res/"
target_dir = "../fastlane/metadata/android/"
def copy_key_from_strings_xml_to_file(xml, key, filename):
match = re.search("<string name=\"" + key + "\">\"?(.*?)\"?</string>", xml, re.DOTALL)
if match:
with open(filename, "w", encoding='utf8') as file:
file.wri... | Binnette/StreetComplete | app/copyShopDescriptions.py | Python | gpl-3.0 | 1,324 | 0.036254 |
import binascii
import hashlib
import mmap
import struct
import zlib
from . import delta
from .sixx import byte2int
class Error(Exception):
"""Pack Error"""
OBJ_TYPE_COMMIT = 1
OBJ_TYPE_TREE = 2
OBJ_TYPE_BLOB = 3
OBJ_TYPE_TAG = 4
OBJ_TYPE_OFS_DELTA = 6
OBJ_TYPE_REF_DELTA = 7
object_types = {
1: 'commit',
... | suutari/gitexpy | gitexpy/pack.py | Python | gpl-2.0 | 8,148 | 0.003436 |
# -*- coding: utf-8 -*-
import numpy as np
def signal_to_class(data, n=2, normalize=True):
"""
Converts a list of signals to a n-dimensional list of classes [buy, .., sell].
Arguments
n (int): Number of classes.
normalize (bool): It normalizes to unity. False - the signal changes only the... | terentjew-alexey/market-analysis-system | mas_tools/classes.py | Python | mit | 5,267 | 0.001899 |
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
# from basemap/examples/daynight.py
import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from datetime import datetime
# example showing how to compute the day/night terminator and shade ... | TheClimateCorporation/conda-recipes | basemap/run_test.py | Python | apache-2.0 | 1,026 | 0.019493 |
#!/usr/bin/env python2.5
#
# Unit tester for neural_net.py
#
import sys
from neural_net import train, test,\
make_neural_net_basic,\
make_neural_net_two_layer,\
make_neural_net_challenging,\
make_neural_net_with_weights
from neural_net_data import simple_data_sets,\
harder_data_sets,\
ch... | joshishungry/artificial_intel | assignments/lab5/neural_net_tester.py | Python | apache-2.0 | 2,227 | 0.00449 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.