code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/python
import os
import multiprocessing
import shutil
# Provide access to the helper scripts
def modify_path():
scripts_dir = os.path.dirname(__file__)
while not 'Scripts' in os.listdir(scripts_dir):
scripts_dir = os.path.abspath(os.path.join(scripts_dir, '..'))
scripts_dir = os.path.jo... | mkraska/CalculiX-Examples | NonLinear/Honeycomb/test.py | Python | mit | 1,484 |
#
# 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... | airbnb/airflow | airflow/providers/amazon/aws/transfers/s3_to_sftp.py | Python | apache-2.0 | 3,122 |
# -*- coding: utf8 -*-
from binascii import hexlify as hex
from pycraft.common import ByteBuffer
from pycraft.common.util import summary
class Packet:
"""全てのパケットの基底クラス"""
__slots__ = ['_buffer']
ID_NONE = -1
id = ID_NONE
BUFFER_FACTORY = ByteBuffer
def __init__(self, buffer=b''):
... | nosix/PyCraft | src/pycraft/network/packet/base.py | Python | lgpl-3.0 | 1,942 |
#!/usr/bin/python
"""
This is a simple plugin that does the same deal as the l2t_find_evil.py script does.
It loads up a YARA rule file and runs it against each line in the CSV file and if there
is a match it will fire up an alert.
Copyright 2012 Kristinn Gudjonsson (kristinn ( a t ) log2timeline (d o t) net)
This fi... | kiddinn/l2t-tools | plugins/yara_match.py | Python | gpl-3.0 | 3,103 |
import pickle
import numpy as np
import os
import unittest
import numpy as np
import vec_hsqc
curdir = os.path.dirname( os.path.abspath( __file__ ) )
with open( os.path.join( curdir, 'training_eg_01.pickle'), 'r' ) as f:
fdd = pickle.load(f).full_data_dict
sp_feat = fdd['120319_C6G6.ucsf']['picked_features']
sp... | kieranrimmer/vec_hsqc | vec_hsqc/tests/feature_tests.py | Python | bsd-3-clause | 8,250 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
from webnotes.utils import flt
records = webnotes.conn.sql("""
select against_voucher_type, against_voucher,
sum(ifnull(debit, 0)) - sum(ifnull(credi... | saurabh6790/med_app_rels | patches/february_2013/fix_outstanding.py | Python | agpl-3.0 | 1,168 |
from PyQt5.QtCore import QAbstractItemModel, pyqtSignal, Qt, QModelIndex
from PyQt5.QtGui import QIcon
from qgis._core import QgsMapLayer, QgsProject
from configmanager.resources import icons
class QgsLayerModel(QAbstractItemModel):
layerchecked = pyqtSignal(object, object, int)
def __init__(self, watchregi... | DMS-Aus/Roam | src/configmanager/models/layers.py | Python | gpl-2.0 | 2,967 |
# Copyright 2017 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... | aselle/tensorflow | tensorflow/compiler/tests/random_ops_test.py | Python | apache-2.0 | 5,996 |
from setuptools import setup, find_packages
import sys
import toever.config as config
install_requires = ['evernote', 'clint', 'chardet', 'keyring']
if sys.version_info < (2, 7):
install_requires.append('argparse')
setup(name='toever',
version=config.version,
description='Evernote command line tool',... | methane/toever | setup.py | Python | gpl-3.0 | 608 |
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 16 20:59:46 2017
@author: tm3y13
"""
from abc import ABC, abstractmethod
import numpy as np
from init_solutions import random_tour
class MultiRunner(object):
def __init__(self, solver):
self.solver = solver
self.solutions = []
... | CLAHRCWessex/SymmetricTSP | random_restarts.py | Python | mit | 6,617 |
import sys
def isAlly(ally):
return 0
def isEnemy(enemy):
if enemy == 'fed_dub' or enemy == 'binayre' or enemy == 'liberation_party':
return 1
return 0 | agry/NGECore2 | scripts/faction/pirate.py | Python | lgpl-3.0 | 158 |
"""
This script adds a BindingInfoProvider.
"""
scriptExtension.importPreset(None)# fix for compatibility with Jython > 2.7.0
import core
from core.osgi import register_service, unregister_service
from core.log import logging, LOG_PREFIX
PROVIDER_CLASS = None
try:
from org.openhab.core.binding import BindingInfoP... | steve-bate/openhab2-jython | Script Examples/Python/components/200_JythonBindingInfoProvider.py | Python | epl-1.0 | 1,922 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# The MIT License (MIT)
#
# Copyright (c) <2013-2014> <Colin Duquesnoy>
# Copyright (c) <2017-2018> <Michell Stuttgart>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),... | mstuttgart/qdarkgray-stylesheet | setup.py | Python | mit | 2,548 |
import platform
import os
class Controller(object):
def __init__(self):
self._system = ""
def clear_screen(self):
self.get_platform()
if(self._system == "Windows"):
os.system('cls')
else:
os.system('clear')
def get_platform(self):
self._sys... | Azurras/Survithon | survive/generic/controller.py | Python | mit | 344 |
"""
.. module:: dj-stripe.tests.test_mixins
:synopsis: dj-stripe Mixin Tests.
.. moduleauthor:: Alex Kavanaugh (@kavdev)
"""
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.http.request import HttpRequest
from django.test.testcases import TestCase
from djst... | aliev/dj-stripe | tests/test_mixins.py | Python | bsd-3-clause | 2,662 |
import os
import pickle
from sigal.gallery import Gallery, Image
from sigal.plugins import extended_caching
CURRENT_DIR = os.path.dirname(__file__)
def test_save_cache(settings, tmpdir):
settings['destination'] = str(tmpdir)
gal = Gallery(settings, ncpu=1)
extended_caching.save_cache(gal)
cachePath... | saimn/sigal | tests/test_extended_caching.py | Python | mit | 4,517 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger("Super Resolution CNN")
log.setLevel(logging.INFO) | Tauranis/super-resolution | Logging.py | Python | mit | 177 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cashflow.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| gsirow/cashflow | manage.py | Python | mit | 251 |
"""
Tests suite for the data models of the user strike app.
"""
from datetime import timedelta
from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
from django.test import TestCase
from django.utils import timezone
from ..models import UserStrike
class... | TamiaLab/carnetdumaker | apps/userstrike/tests/test_models.py | Python | agpl-3.0 | 11,460 |
##write a program that will allow the user to input digits, and arrange them in numerical order.
##for extra credit, have it also arrange strings in alphabetical order
terms = input("Enter terms, separated by a space: ")
terms = " ".join(sorted(terms.split(" ")))
print(terms)
| ngmhprogramming/dailyprogrammer | Python/python_easy_9.py | Python | mit | 282 |
"""
MongoDB Blueprint
=================
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.mongodb
settings:
mongodb:
# bind: 0.0.0.0 # Set the bind address specifically (Default: 127.0.0.1)
replSet: webscale
keyfile: 'mongodb-keyfile'
admin:
... | 5monkeys/blues | blues/mongodb.py | Python | mit | 4,929 |
"""
For unmodified comments, change comment.modified from None to False since the default value
has been set to False on the comment model.
"""
import sys
import logging
from modularodm import Q
from framework.transactions.context import TokuTransaction
from scripts import utils as script_utils
from website.app impor... | rdhyee/osf.io | scripts/set_comment_modified_default_false.py | Python | apache-2.0 | 1,054 |
import numpy as np
import pytest
import pandas as pd
from pandas import Categorical, CategoricalIndex, Series
import pandas._testing as tm
class TestSeriesValueCounts:
def test_value_counts_datetime(self):
# most dtypes are tested in tests/base
values = [
pd.Timestamp("2011-01-01 09:0... | jreback/pandas | pandas/tests/series/methods/test_value_counts.py | Python | bsd-3-clause | 8,055 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-04 21:38
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('location', '0003_locationitems'),
]
operations = [
migrations.RenameModel(
... | ej2/pixelpuncher | pixelpuncher/location/migrations/0004_auto_20160604_2138.py | Python | bsd-3-clause | 401 |
from molpher.core.morphing.AtomLibrary import AtomLibrary
from molpher.core.morphing.Molpher import Molpher
from molpher.core.morphing.MorphCollector import MorphCollector
| lich-uct/molpher-lib | src/python/molpher/core/morphing/__init__.py | Python | gpl-3.0 | 172 |
#!/usr/bin/python3
import sys
import eth.gdax_client as gcl
import eth.gdax_priv as gpr
import eth.num_utils as nu
import time
if (__name__ != '__main__'):
print("This should only be called as a script.")
sys.exit(1)
if(len(sys.argv) < 2):
print("Error: missing arguments.")
print("Usage: force_buy.py ... | astew/eth_tools | script/force_buy.py | Python | mit | 3,806 |
import sys
import time
from main import setup_parser as sp
from Fake_Serial import Fake_Serial as fake_serial
"""pa273_v1.py
Created by Amit Sandhel on 2013-05-27. With contributions by Fredrick Leber.
Note: this script requires:
1) Python 2.7
2) matplotlib
3) PySerial
"""
TIMEDELAY = 0.3 # ... | amitsandhel/PA273-Potentiostat-Software | pa273_v1_record.py | Python | gpl-3.0 | 8,014 |
#!/usr/bin/env python3
'''Usage: python3 <name>.py dict_url
Output: prints number of stems in that dict.
Issues: If dict encoding is not convertable to utf-8, returns -1
'''
import sys, urllib.request
import xml.etree.ElementTree as xml
import argparse, urllib.request
def print_info(uri, bidix=None):
dictX ... | johnjcamilleri/apertium-mlt | john/dixcounter.py | Python | gpl-3.0 | 2,071 |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'students.views.home', name='home'),
# url(r'^students/', include('students.foo.urls')),
... | pkuhad/django-student | students/urls.py | Python | mit | 684 |
import ply.lex
# pattern : token-name
reserved = {'input':'INPUT', 'output':'OUTPUT', 'import':'IMPORT',}
# 'tokens' is a special word in ply's lexers.
tokens = [
'LPAREN','RPAREN', # Individual parentheses
'LBRACE','RBRACE', # Individual braces
'OP_ADD','OP_SUB','OP_MUL','OP_DIV', # the four basic arithmetic ... | 207leftovers/cs207project | pype/lexer.py | Python | mit | 1,645 |
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebrush>)
# This pro... | cherrygirl/micronaet7 | menuitem_purchase/__openerp__.py | Python | agpl-3.0 | 1,674 |
"""
Views for the rss_proxy djangoapp.
"""
import requests
from django.conf import settings
from django.core.cache import cache
from django.http import HttpResponse, HttpResponseNotFound
from rss_proxy.models import WhitelistedRssUrl
CACHE_KEY_RSS = "rss_proxy.{url}"
def proxy(request):
"""
Proxy requests... | cpennington/edx-platform | lms/djangoapps/rss_proxy/views.py | Python | agpl-3.0 | 1,178 |
"""
Django settings for sites project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# B... | cmwaura/Final_Red_Scrap | sites/sites/settings.py | Python | mit | 4,129 |
import shesha.config as conf
simul_name = "scao_8m_pyr40"
# loop
p_loop = conf.Param_loop()
p_loop.set_niter(1000)
p_loop.set_ittime(0.002) # =1/500
p_loop.set_devices([0, 1, 2, 3])
# geom
p_geom = conf.Param_geom()
p_geom.set_zenithangle(0.)
# tel
p_tel = conf.Param_tel()
p_tel.set_diam(8.0)
p_tel.set_cobs(0.12... | ANR-COMPASS/shesha | data/par/par4bench/scao_pyrhr_40x40.py | Python | gpl-3.0 | 1,949 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2018 The OctoPrint Project - Released under terms of the AGPLv3 License"
import octoprint.pl... | foosel/OctoPrint | src/octoprint/plugins/tracking/__init__.py | Python | agpl-3.0 | 15,412 |
## @file
# This file is used to define common static strings used by INF/DEC/DSC files
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies th... | google/google-ctf | third_party/edk2/BaseTools/Source/Python/Common/GlobalData.py | Python | apache-2.0 | 3,651 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tombomation.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| tcuthbert/tcuthbert | tombomation/manage.py | Python | mit | 254 |
class Config(object):
_instance = None
def __new__(cls, *args, **kwargs): # This may be a singleton
if not cls._instance:
cls._instance = super(Config, cls).__new__(cls, *args, **kwargs)
return cls._instance
def get(self, key):
if key == "cert.file":
import ... | sergiosgc/Syncthing.py | syncthing/app/Config.py | Python | gpl-2.0 | 623 |
"""
This module provides functions to generate demographic events for
"isolation-with-migration", or IM, models.
"""
import attr
import numpy as np
from fwdpy11.class_decorators import (attr_add_asblack, attr_class_pickle,
attr_class_to_from_dict)
@attr_add_asblack
# @attr_class_... | molpopgen/fwdpy11 | fwdpy11/demographic_models/IM.py | Python | gpl-3.0 | 6,028 |
"""MailIn plugin modules."""
| alexanderfefelov/nav | python/nav/mailin/plugins/__init__.py | Python | gpl-2.0 | 29 |
from flask import Flask
app = Flask(__name__)
@app.route("/<input>")
def hello(input):
return input
if __name__ == "__main__": app.run(debug=True)
| naoyak/Agile_Data_Code_2 | ch02/web/test_flask.py | Python | mit | 152 |
# flake8: noqa
import warnings
warnings.warn("The pandas.tslib module is deprecated and will be "
"removed in a future version.", FutureWarning, stacklevel=2)
from pandas._libs.tslib import (Timestamp, Timedelta,
NaT, NaTType, OutOfBoundsDatetime)
| mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/pandas/tslib.py | Python | mit | 294 |
__author__ = 'SL_RU'
# -*- coding: utf-8 -*-
#Проигрыватель музыкальных файлов
import vlc
#import time
#import sys
from queue import Queue
def log(msg):
#print(msg)
pass
class Aplayer(object):
def __init__(self, output_device):
"""Initializing Aplayer.
output_device can be:
... | SL-RU/RaspiBluePlayer | aplayer.py | Python | mit | 3,966 |
import re, os, logging, commands
from autotest.client.shared import error
from virttest import remote, libvirt_vm, virsh, libvirt_xml
from xml.dom.minidom import parse
def run_virsh_setvcpus(test, params, env):
"""
Test command: virsh setvcpus.
The conmand can change the number of virtual CPUs in the gues... | rbbratta/virt-test | libvirt/tests/src/virsh_cmd/domain/virsh_setvcpus.py | Python | gpl-2.0 | 6,257 |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
fr... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyKDE4/kdeui/KFindDialog.py | Python | gpl-2.0 | 1,781 |
# -*- coding: utf-8 -*-
##Copyright (C) [2003] [Jürgen Hamel, D-32584 Löhne]
##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 versi... | CuonDeveloper/cuon | cuon_client/CUON/cuon/Addresses/addresses.py | Python | gpl-3.0 | 20,421 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-09 14:43
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('batch', '0002_auto_20170412_1225'),
('recipe', '001... | ngageoint/scale | scale/storage/migrations/0008_auto_20170609_1443.py | Python | apache-2.0 | 1,859 |
# -*- 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
class CrawlerType1Pipeline(object):
def process_item(self, item, spider):
return item
| rksaxena/crawler_templates | crawler_type1/crawler_type1/pipelines.py | Python | mit | 292 |
__all__ = ('Registry', 'RegistryError')
class RegistryError(Exception):
pass
class Registry(object):
registries = []
def __init__(self):
if self not in self.registries:
self.registries.append(self)
self.clear()
def __len__(self):
return len(self.stubs)
@cla... | jeffh/describe | describe/mock/registry.py | Python | mit | 1,402 |
# __init__.py
#
# Copyright (C) 2009, 2010, 2011, 2012, 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is d... | mulkieran/blivet | blivet/__init__.py | Python | gpl-2.0 | 6,402 |
from invoke import task, run
BOLD_ON = "\033[1m"
BOLD_OFF = "\033[21m"
@task
def test(ugen=None):
print "Testing: {}{}{}".format(BOLD_ON, ugen, BOLD_OFF)
run("chuck lib/{0} test/{0}_test".format(ugen))
| trzewiczek/beta-vulgaris-aka-beet | tasks.py | Python | bsd-3-clause | 209 |
# Copyright 2019 The TensorNetwork 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 or agreed ... | google/TensorNetwork | tensornetwork/backends/jax/jax_backend.py | Python | apache-2.0 | 36,454 |
from src.base.solution import Solution
from src.tests.part1.q310_test_min_height_trees import MinHeightTreesTestCases
class MinHeightTrees(Solution):
def verify_output(self, test_output, output):
return set(test_output) == set(output)
def print_output(self, output):
super(MinHeightTrees, self... | hychrisli/PyAlgorithms | src/solutions/part1/q310_min_height_trees.py | Python | apache-2.0 | 1,318 |
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
import os
def pubdev_1480():
if not pyunit_utils.hadoop_namenode_is_accessible(): raise(EnvironmentError, "Not running on H2O internal network. No access to HDFS.")
train = h2o.import_file("hdfs://mr-0xd6/datasets/kaggle/sf.cri... | madmax983/h2o-3 | h2o-py/tests/testdir_jira/pyunit_NOPASS_INTERNAL_pubdev_1480_medium.py | Python | apache-2.0 | 734 |
import util.geo as geo
import util.testingProfile
import math
def test_deltaTime_dateAware():
'''
make sure deltaTime is coping with real dates correctly
'''
# 2 days on a leap year:
early = (2004, 2, 28, 0)
late = (2004, 3, 1, 0)
diff = geo.deltaTime(early, late)
assert diff == 1728... | s-good/AutoQC | tests/geo_tests.py | Python | mit | 2,569 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
# test that admin actually saves catalog
from __future__ import unicode_literals
import d... | shoopio/shoop | shuup_tests/campaigns/test_catalog_campaign_admin.py | Python | agpl-3.0 | 7,668 |
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.contrib import admin
from django.shortcuts import redirect
from django.views.i18n import javascript_catalog
from django.views.decorators.cache import cache_page
from amo.urlresolvers import reverse
from amo.utils import ur... | wagnerand/zamboni | lib/urls_base.py | Python | bsd-3-clause | 7,313 |
#!/usr/bin/python2.4
#
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | mhfrantz/alertfeed | ui/templatelib.py | Python | apache-2.0 | 1,915 |
"""Tests related to hammer command and its options and subcommands."""
import json
from robottelo import ssh
from robottelo.cli import hammer
from robottelo.decorators import bz_bug_is_open, tier1
from robottelo.helpers import read_data_file
from robottelo.test import CLITestCase
HAMMER_COMMANDS = json.loads(read_dat... | tkolhar/robottelo | tests/foreman/cli/test_hammer.py | Python | gpl-3.0 | 4,270 |
#!/usr/bin/env python
shutil.copyfile ("../common/textures/grid.tx", "grid.tx")
command += "python src/test_imageinput.py > out.txt"
| YangYangTL/oiio | testsuite/python-imageinput/run.py | Python | bsd-3-clause | 137 |
from urllib2 import urlopen, HTTPError
from PIL.ImageFile import Parser as ImageParser
from pickle import load
from multiprocessing import Pool
MIN_LINK_THUMB_WIDTH = 350
MIN_LINK_THUMB_HEIGHT = 200
def size_filter(image_url):
try:
file = urlopen(image_url)
except HTTPError:
return None
da... | linkfloyd/linkfloyd | linkfloyd/experimental/imgparsing/parser.py | Python | bsd-3-clause | 922 |
from __future__ import division
from nose.tools import assert_equal
from nose.tools import assert_true
from nose.tools import assert_false
from nose.tools import assert_raises
from nose.tools import raises
import networkx as nx
from networkx.utils import pairwise
def validate_path(G, s, t, soln_len, path):
asse... | cogeorg/BlackRhino | networkx/algorithms/shortest_paths/tests/test_weighted.py | Python | gpl-3.0 | 24,879 |
# Copyright (c) 2014, The Boovix authors that are listed
# in the AUTHORS file. All rights reserved. Use of this
# source code is governed by the BSD 3-clause license that
# can be found in the LICENSE file.
"""
Static analysis: pylint, pep8. The autopep8 is disabled currently,
as it forces strict indentation while pe... | CzarekTomczak/boovix | boovix1/static_analysis/static_analysis.py | Python | bsd-3-clause | 4,525 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-12-12 14:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('irish_townlands', '0006_nameentry'),
]
operations = [
migrations.AddField(
... | osmie/osm-irish-townlands | irish_townlands/migrations/0007_auto_20161212_1431.py | Python | gpl-3.0 | 1,132 |
# -*- coding: utf-8 -*-
from django.contrib.sitemaps import Sitemap
from ideas.models import Idea, Category
class IdeaCategorySitemap(Sitemap):
changefreq = 'weekly'
priority = 0.1
def items(self):
return Category.objects.all()
def lastmod(self, obj):
return Idea.objects.all().orde... | Lisaveta-K/lisaveta-k.github.io | _site/tomat/apps/ideas/sitemaps.py | Python | mit | 570 |
#!/usr/bin/env python
import sys
import numpy as np
# import statepoint
sys.path.append('../../src/utils')
import statepoint
# read in statepoint file
if len(sys.argv) > 1:
sp = statepoint.StatePoint(sys.argv[1])
else:
sp = statepoint.StatePoint('statepoint.10.binary')
sp.read_results()
# extract tally resu... | shenqicang/openmc | tests/test_fixed_source/results.py | Python | mit | 697 |
#!/usr/bin/env python
'Unit test for trepan.lib.thred'
import sys, thread, threading, unittest
from trepan.lib import thred as Mthread
class BgThread(threading.Thread):
def __init__(self, id_name_checker):
threading.Thread.__init__(self)
self.id_name_checker = id_name_checker
return
... | rocky/python2-trepan | test/unit/test-lib-thread.py | Python | gpl-3.0 | 1,582 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Nicolas Bessi (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers who ... | jeffery9/mixprint_addons | report_webkit/__openerp__.py | Python | agpl-3.0 | 3,813 |
# 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 applicable ... | maxkferg/smart-city-model | modules/vision/datasets/imagenet.py | Python | gpl-3.0 | 7,476 |
from django.db import models, transaction
from django.db.models import Q, Max, Count
from django.core.management.base import BaseCommand, CommandError
from django.contrib.contenttypes.models import ContentType
from editor.models import EditorItem, NewQuestion, Project, NewExam, NUMBAS_FILE_VERSION
from numbasobject imp... | numbas/editor | feature_survey/management/commands/feature_survey.py | Python | apache-2.0 | 13,887 |
"""
tests.test_validation
~~~~~~~~~~~~~~~~~~~~~
Provides unit tests for SQLAlchemy models which have some validation
functionality and therefore raise validation errors when requests are made
to write to the database.
Validation is not provided by Flask-Restless itself, but it must capture
... | CommonsCloud/CommonsRestless | tests/test_validation.py | Python | agpl-3.0 | 9,523 |
# -*- coding: utf-8 -*-
#
# 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
#... | artwr/airflow | airflow/contrib/operators/vertica_to_mysql.py | Python | apache-2.0 | 6,016 |
""" Unit processing_library for polarisation
"""
import numpy
import unittest
from numpy import random
from numpy.testing import assert_array_almost_equal
from data_models.polarisation import PolarisationFrame, ReceptorFrame, congruent_polarisation, correlate_polarisation, \
convert_pol_frame, convert_circular_... | SKA-ScienceDataProcessor/algorithm-reference-library | tests/data_models/test_polarisation.py | Python | apache-2.0 | 7,298 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Resource information of graphite
"""
def get_name(friendly=False):
"""Get name of this resource
:return: name of this resource
:rtype: str
"""
if friendly: # pragma: no cover
return 'Graphite connection'
return 'graphite'
def get_do... | Alignak-monitoring-contrib/alignak-backend | alignak_backend/models/graphite.py | Python | agpl-3.0 | 6,079 |
import os.path
import urwid
from mitmproxy.tools.console import common
from mitmproxy.tools.console import signals
from mitmproxy.tools.console import commandexecutor
import mitmproxy.tools.console.master # noqa
from mitmproxy.tools.console.commander import commander
class PromptPath:
def __init__(self, callbac... | ujjwal96/mitmproxy | mitmproxy/tools/console/statusbar.py | Python | mit | 10,908 |
# -*- encoding: utf-8 -*-
from socket import *
import threading
class Server:
def __init__(self):
# Set up socket
self.server_sock = socket(AF_INET, SOCK_STREAM)
self.server_sock.bind(("127.0.0.1", 5021))
self.server_sock.listen(5)
print 'Server socket setting is done!!'
... | GreedyOsori/Chat | Eunji/server.py | Python | mit | 2,042 |
# This file is part of PRAW.
#
# PRAW 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.
#
# PRAW is distributed in the hope that it will ... | appleorange1/praw | praw/objects.py | Python | gpl-3.0 | 72,632 |
#!/usr/bin/env python
# Copyright (c) 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.
#
"""Logic to generate lists of DEPS used by various parts of
the android_webview continuous integration (buildbot) infrastructure.
... | M4sse/chromium.src | android_webview/buildbot/deps_whitelist.py | Python | bsd-3-clause | 9,068 |
from __future__ import absolute_import
from django.contrib.auth.models import UserManager
from django.utils.timezone import now as timezone_now
from zerver.models import UserProfile, Recipient, Subscription, Realm, Stream
import base64
import ujson
import os
import string
from six.moves import range
from typing impor... | vabs22/zulip | zerver/lib/create_user.py | Python | apache-2.0 | 3,927 |
# Lint as python3
# Copyright 2020 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 r... | sarvex/tensorflow | tensorflow/python/ops/structured/structured_array_ops.py | Python | apache-2.0 | 20,742 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2018-09-15 10:27:31
# Project: lianjia_zufang_hz
from pyspider.libs.base_handler import *
import pymysql.cursors
import json
import re
import time
class DBHelper:
def __init__(self):
self.connection = pymysql.connect(
host='127.0.0.... | zhanglun/pureloser | spider/lianjia/zufang.py | Python | mpl-2.0 | 9,016 |
def itemTemplate():
return ['object/tangible/loot/creature_loot/collections/shared_housing_improvement_03.iff']
def lootDescriptor():
return 'customattributes'
def customizationAttributes():
return ['/private/index_color_1']
def customizationValues():
return [2]
def STFparams():
r... | agry/NGECore2 | scripts/loot/lootItems/collections/housing_improvements/craftsman_tools/craftsman_tools_2.py | Python | lgpl-3.0 | 600 |
"""
Stub implementation of EdxNotes for acceptance tests
"""
import json
import re
from uuid import uuid4
from datetime import datetime
from copy import deepcopy
from .http import StubHttpRequestHandler, StubHttpService
# pylint: disable=invalid-name
class StubEdxNotesServiceHandler(StubHttpRequestHandler):
"""... | Semi-global/edx-platform | common/djangoapps/terrain/stubs/edxnotes.py | Python | agpl-3.0 | 10,136 |
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
self.val = val
self.left, self.right = None, None
"""
class Solution:
"""
@param root: The root of binary tree.
@return: An integer
"""
def maxDepth(self, root):
# write your code here
if not ro... | shawncaojob/LC | LINTCODE/97_maximum_depth_of_binary_tree.py | Python | gpl-3.0 | 409 |
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
template = 'landing.html'
return render(request, template) | arusyonok/speakup | speakup/views.py | Python | apache-2.0 | 161 |
#!/usr/bin/python
# Copyright 2011 WebDriver committers
#
# 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... | freynaud/selenium | py/test/selenium/webdriver/common/webdriverwait_tests.py | Python | apache-2.0 | 16,433 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 ExceptionError
# Copyright (C) 2015 Takeshi HASEGAWA
#
# 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 Licens... | hasegaw/IkaLog | ikalog/inputs/win/screencapture.py | Python | apache-2.0 | 5,654 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import tree
def main(argv):
dna = files.read_line(argv[0])
st = tree.SuffixTree(dna)
print '\n'.join(st.traverse())
if __name__ == "__main__":
main(sys.argv[1:])
| cowboysmall/rosalind | src/stronghold/rosalind_suff.py | Python | mit | 288 |
# Copyright © 2010-2013 Piotr Ożarowski <piotr@debian.org>
#
# 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 use, copy, modif... | Bjay1435/capstone | rootfs/usr/share/dh-python/dhpython/pydist.py | Python | mit | 10,352 |
# -*- coding: utf-8 -*-
#
# Pyplis is a Python library for the analysis of UV SO2 camera data
# Copyright (C) 2017 Jonas Gliss (jonasgliss@gmail.com)
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License a
# published by the Free Software Foundat... | jgliss/pyplis | scripts/more_scripts/ex001_save_all_calib_imgs.py | Python | gpl-3.0 | 3,637 |
"""
Logic functions for Sudoku
"""
# Disable "invalid variable name"
# pylint: disable=C0103
from pyeda.boolalg.expr import And, OneHot, expr2dimacscnf
from pyeda.boolalg.vexpr import bitvec
from pyeda.boolalg.picosat import satisfy_one
DIGITS = "123456789"
class SudokuSolver(object):
"""Logical constraints fo... | lthurlow/Boolean-Constrained-Routing | pyeda-0.19.3/pyeda/logic/sudoku.py | Python | mit | 2,804 |
#!/usr/bin/python
from __future__ import print_function
from datetime import date, datetime, timedelta
import os
import mysql.connector
import csv, sys, pprint
import MySQLdb
import time
import sys
import logging
import logging.config
import json
reload(sys)
sys.setdefaultencoding("utf-8")
def any(iterable):
for... | purnomoeko/filereader | readjson.py | Python | apache-2.0 | 5,911 |
from django.conf.urls import patterns, include, url
from django.contrib.auth.views import login, logout
from infos.models import Repository
from django.conf import settings
import os
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
... | paolinux86/SubInfos | SubInfos/urls.py | Python | gpl-2.0 | 1,615 |
# (c) Copyright 2012-2014 Hewlett-Packard Development Company, L.P.
# 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/lic... | mahak/cinder | cinder/zonemanager/utils.py | Python | apache-2.0 | 3,815 |
import atexit
import BaseHTTPServer
import errno
import os
import shutil
import signal
import socket
import subprocess
import sys
import tempfile
import threading
import time
class ToSServerThread(threading.Thread):
class ToSHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
sel... | dev-alex-alex2006hw/acme-ca | test/startservers.py | Python | mpl-2.0 | 4,947 |
"""Support for functionality to have conversations with Home Assistant."""
import logging
import re
import voluptuous as vol
from homeassistant import core
from homeassistant.components import http, websocket_api
from homeassistant.components.http.data_validator import RequestDataValidator
from homeassistant.helpers ... | postlund/home-assistant | homeassistant/components/conversation/__init__.py | Python | apache-2.0 | 5,518 |
#!/usr/bin/python
import sys
import time
import random
from fidonet import Address
from fidonet.formats import *
import fidonet.app
class App (fidonet.app.AppUsingAddresses, fidonet.app.AppUsingNames):
logtag = 'fidonet.makemsg'
def create_parser(self):
p = super(App, self).create_parser()
... | larsks/python-ftn | fidonet/apps/makemsg.py | Python | gpl-3.0 | 3,792 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = 'Denis Ro... | 3nids/QGIS | tests/src/python/test_qgssymbollayerregistry.py | Python | gpl-2.0 | 2,864 |
#! /usr/bin/env python
import requests
import sys
import urllib
from requests.auth import HTTPBasicAuth
if len(sys.argv) != 4:
print "usage: find-host onos-node name device-id"
sys.exit(1)
node = sys.argv[1]
name = sys.argv[2]
id = sys.argv[3]
hostRequest = requests.get('http://' + node + ':8181/onos/v1/ho... | planoAccess/clonedONOS | tools/test/scenarios/bin/find-host.py | Python | apache-2.0 | 730 |
# Author: Rob Sanderson (azaroth42@gmail.com)
# License: Apache2
# Last Modified: 2016-09-02
from __future__ import print_function
import json
from rdflib import ConjunctiveGraph, URIRef
from pyld import jsonld
from pyld.jsonld import compact, expand, frame, from_rdf, to_rdf, JsonLdProcessor
import urllib
# Stop co... | peterjoel/servo | tests/wpt/web-platform-tests/annotation-vocab/tools/vocab_tester.py | Python | mpl-2.0 | 8,366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.