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 |
|---|---|---|---|---|---|
import cPickle as pickle
import uuid
from utils import local_file
import codecs
import json
CONF_FILE = local_file('configs.pkl')
defaults = {
'too_small': 7,
'small_contour_thresh': 2, # times small std dev
'viterbi_post_process': True,
'break_threshold': 2.0,
... | zmr/namsel | config_util.py | Python | mit | 1,589 |
from ..cw_model import CWModel
class Activity(CWModel):
def __init__(self, json_dict=None):
self.id = None # (Integer)
self.name = None # *(String(100))
self.type = None # (ActivityTypeReference)
self.company = None # (CompanyReference)
self.contact = None #... | joshuamsmith/ConnectPyse | sales/activity.py | Python | mit | 1,379 |
from tests.testing_framework.base_test_cases import BaseTestCase
from hamcrest import *
from flexmock import flexmock
from framework.protocols.smtp import SMTP
class SMTPTests(BaseTestCase):
def before(self):
self.core_mock = flexmock()
def test_Connect_if_TLS_is_not_enabled_the_execution_should_con... | sharad1126/owtf | tests/test_cases/framework/protocols/smtp_tests.py | Python | bsd-3-clause | 3,450 |
from tornado.web import URLSpec as url
from .api import HealthcheckHandler
urls = [
url(r'', HealthcheckHandler.as_list())
]
| vladiibine/trust-network | src/python/trust_network_backend/tnb/apps/core/urls.py | Python | mit | 131 |
# 7.1.2015
# Builtins
import os, sys
# from armchair biology blog (now implemented in biopython)
from KGML_parser import read
from KGML_vis import KGMLCanvas
from KGML_scrape import retrieve_kgml_to_file, retrieve_KEGG_pathway
import argparse
import pandas as pd
############################
psr = argparse.ArgumentPars... | bluegenes/MakeMyTranscriptome | scripts/util/color_pathways2.py | Python | bsd-3-clause | 3,579 |
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
| filipecifali/dnsdiff | tcolors.py | Python | mit | 203 |
import sys
import os
import tempfile
import unittest
import shutil
import copy
CURDIR = os.path.abspath(os.path.dirname(__file__))
TOPDIR = os.path.split(CURDIR)[0]
sys.path.insert(0, TOPDIR)
from distribute_setup import (use_setuptools, _build_egg, _python_cmd,
_do_download, _install, D... | waseem18/oh-mainline | vendor/packages/distribute/tests/test_distribute_setup.py | Python | agpl-3.0 | 2,155 |
"""
These views handle all actions in Studio related to import and exporting of
courses
"""
import base64
import json
import logging
import os
import re
import shutil
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from djan... | ahmedaljazzar/edx-platform | cms/djangoapps/contentstore/views/import_export.py | Python | agpl-3.0 | 17,332 |
# Copyright (C) 2012 VT SuperDARN Lab
# Full license can be found in LICENSE.txt
#
# 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 la... | Shirling-VT/davitpy_sam | davitpy/gme/base/gmeBase.py | Python | gpl-3.0 | 3,802 |
# Copyright 2016,2017 Schatz Forensic Pty Ltd. 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 appl... | blschatz/aff4 | pyaff4/pyaff4/standards_test.py | Python | apache-2.0 | 2,666 |
import attr
from navmazing import NavigateToAttribute
from navmazing import NavigateToSibling
from widgetastic.widget import NoSuchElementException
from widgetastic.widget import Text
from widgetastic.widget import View
from widgetastic_patternfly import BreadCrumb
from widgetastic_patternfly import Button
from widgeta... | nachandr/cfme_tests | cfme/storage/manager.py | Python | gpl-2.0 | 11,178 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import utool as ut
import plottool.draw_sv as draw_sv
(print, print_, printDBG, rrr, profile) = ut.inject(__name__, '[viz_sver]', DEBUG=False)
WRITE_SV_DEBUG = ut.get_argflag('--write-sv-debug')
def _get_sv_vartup_for_plottool(... | SU-ECE-17-7/ibeis | ibeis/viz/viz_sver.py | Python | apache-2.0 | 3,446 |
from math import *
__all__ = [
"_TILE_SIZE",
"_get_coordinate",
]
_TILE_SIZE = 256
def _get_coordinate(lat, long, zoom):
n = 2 ** zoom
xtile = ((long + 180) / 360) * n
lat_radians = radians(lat)
ytile = (1 - (log(tan(lat_radians) + 1 / cos(lat_radians)) / pi))... | CiderMan/PGTips | slippy/utils.py | Python | unlicense | 401 |
import struct
from twisted.internet import protocol
import cPickle as pickle
class CarbonClientProtocol(protocol.Protocol):
def __init__(self, factory):
self._factory = factory
def connectionMade(self):
protocol.Protocol.connectionMade(self)
self.check_queued_metrics_to_send()
... | fdChasm/txCarbonClient | src/txCarbonClient/carbon_client_protocol.py | Python | mit | 661 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Category'
db.create_table(u'category_category', (
... | ariel17/poppurri | poppurri/category/migrations/0001_initial.py | Python | mit | 1,969 |
from __future__ import unicode_literals
# -*- coding: utf-8 -*-
#Faça um Programa que pergunte quanto você ganha por hora e o número de horas trabalhadas no mês.
# Calcule e mostre o total do seu salário no referido mês, sabendo-se que são
# descontados 11% para o Imposto de Renda, 8% para o INSS e 5% para o sindicato... | josecostamartins/pythonreges | lista1/exercicio14.py | Python | mit | 1,028 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsAttributeTableConfig.
.. 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 versio... | drnextgis/QGIS | tests/src/python/test_qgsattributetableconfig.py | Python | gpl-2.0 | 4,004 |
from glob import glob
import os
from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
from distutils.command.build_clib import build_clib
import numpy
np_include_path = [numpy.get_include()]
c_options = {}
c_options['use_numpy'] = 1
def generate_cython_c_config_file():
print('G... | pstoll/prime-hexagon | setup.py | Python | mit | 1,746 |
#!/usr/bin/python3
"""
Program to edit a food item
This cgi-bin program is one of a group of programs to help me create and
maintain a record of everything I eat. This one writes and populates an html
form page which allows the food item fields be edited
Other programs will input new data, prepare output web pages, a... | MikeBirdsall/food-log | foodlog/edit.py | Python | mit | 7,868 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2011-2013 Acysos S.L. (http://acysos.com)
# Ignacio Ibeas Izquierdo <ignacio@acysos.com>
#
# This program is free software: y... | RamonGuiuGou/l10n-spain | l10n_es_aeat_mod340_type0/__openerp__.py | Python | agpl-3.0 | 1,627 |
import argparse
import sys, traceback
from tools.validation.classes.vector import CHaMP_Polygon
def polyinsidepoly(inner, outer):
for innerPoly in inner.features:
results = []
for outPoly in outer.features:
buffered = outPoly['geometry'].buffer(0.001)
results.append(buffere... | SouthForkResearch/CHaMP_Metrics | test/test_polygons_inside_other_polygons.py | Python | gpl-3.0 | 1,061 |
from pelican import signals
from PIL import Image
import logging
import os
logging.Logger(__name__)
def isclose(a, b, rtol=1e-2):
db = abs(b)*float(rtol)
return a > b-db and a < b+db
def rewrite_images(p):
siteurl = p.settings["SITEURL"]
output_path = p.output_path
for dirName, subdirList, fileList in os.w... | azz2k/skeleton | plugins/SkeletonImages/orientation.py | Python | agpl-3.0 | 2,936 |
from __future__ import absolute_import, unicode_literals
from os.path import normpath, join
try:
import threading
except ImportError:
threading = None
from django.conf import settings
from django.core.files.storage import get_storage_class
from django.contrib.staticfiles import finders, storage
from django.con... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/debug_toolbar/panels/staticfiles.py | Python | agpl-3.0 | 5,656 |
from django.test import SimpleTestCase
from crits.relationships.handlers import forge_relationship, update_relationship_reasons, update_relationship_confidences
from crits.core.user import CRITsUser
from crits.campaigns.campaign import Campaign
TUSER_NAME = "test_user"
TUSER_PASS = "!@#j54kfeimn?>S<D"
TUSER_EMAIL = "... | seanthegeek/crits | crits/relationships/tests.py | Python | mit | 4,809 |
from .. import Provider as InternetProvider
class Provider(InternetProvider):
free_email_domains = (
'gmail.com',
'yahoo.com',
'hotmail.com',
'inspire.net.nz',
'xtra.co.nz',
)
tlds = (
'nz',
'co.nz',
'org.nz',
'kiwi',
'kiwi.... | danhuss/faker | faker/providers/internet/en_NZ/__init__.py | Python | mit | 426 |
###
# Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2008-2009, James Vega
# 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 source code must retain the above c... | raboof/supybot | plugins/Owner/plugin.py | Python | bsd-3-clause | 25,422 |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from unittest.mock import patch, Mock
from .models import Subscription
User = get_user_model()
class SubscriptionModelTest(TestCase):
def test_user_returns_active_subscription(self):
... | stlk/socialist | console/tests.py | Python | mit | 2,236 |
# -*- coding: latin-1 -*-
"""This file contains the public interface to the aiml module."""
import AimlParser
import DefaultSubs
import Utils
from PatternMgr import PatternMgr
from WordSub import WordSub
from ConfigParser import ConfigParser
import copy
import glob
import os
import random
import re
impor... | LCAS/spqrel_tools | slu4p/dialogue_management/Kernel.py | Python | mit | 48,268 |
#!/usr/bin/python
import sys
import os
from conary.lib import util
sys.excepthook = util.genExcepthook()
sys.path.insert(0, os.path.abspath('../'))
from updatebot import bot, config, log
log.addRootLogger()
cfg = config.UpdateBotConfig()
cfg.read(os.path.abspath('../') + '/config/%s/updatebotrc' % sys.argv[1])
obj... | sassoftware/mirrorball | scripts/lookupsources.py | Python | apache-2.0 | 873 |
"""
nova_log - files ``/var/log/nova/*.log``
========================================
This module contains classes to parse logs under ``/var/log/nova/``
"""
from .. import LogFileOutput, parser
from insights.specs import nova_api_log
from insights.specs import nova_compute_log
@parser(nova_api_log)
class NovaApiLog(... | wcmitchell/insights-core | insights/parsers/nova_log.py | Python | apache-2.0 | 755 |
from .base import *
class Banners(ListableApiResource, CreateableApiResource,
UpdateableApiResource, DeleteableApiResource,
CollectionDeleteableApiResource):
resource_name = 'banners'
| hockeybuggy/bigcommerce-api-python | bigcommerce/resources/banners.py | Python | mit | 218 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# calibre-metadata - A collection of metadata sources for calibre
# Copyright 2013 Abdó Roig-Maranges <abdo.roig@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by... | aroig/metadata-sources | arxiv/src/__init__.py | Python | gpl-3.0 | 856 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | jsakamoto/selenium | py/selenium/webdriver/remote/webdriver.py | Python | apache-2.0 | 41,741 |
"""
A release-automation toolkit.
Don't use this outside of Twisted.
Maintainer: Christopher Armstrong
"""
import os
import re
# errors
class DirectoryExists(OSError):
"""Some directory exists when it shouldn't."""
pass
class DirectoryDoesntExist(OSError):
"""Some directory doesn't exist when it sh... | mzdaniel/oh-mainline | vendor/packages/twisted/twisted/python/release.py | Python | agpl-3.0 | 1,019 |
"""Support for Xiaomi Yeelight WiFi color bulb."""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.discovery import SERVICE_YEELIGHT
from homeassistant.const import CONF_DEVICES, CONF_NAME, CONF_SCAN_INTERVAL, \
CONF_HOST, ATTR_ENTITY_ID
from homeassistant.comp... | jamespcole/home-assistant | homeassistant/components/yeelight/__init__.py | Python | apache-2.0 | 8,526 |
import ssl
import httpx
import httpx.config
import httpx.backends.asyncio
from OpenSSL.crypto import load_certificate, FILETYPE_ASN1
def set_or_concat_value(obj, key, value):
if key in obj:
obj[key] = obj[key] + ', ' + value
else:
obj[key] = value
def cert_to_obj(cert):
obj = {}
for ... | dalf/searx-stats2 | searxstats/common/ssl_info.py | Python | agpl-3.0 | 3,479 |
# 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 u... | zhouyao1994/incubator-superset | superset/tasks/schedules.py | Python | apache-2.0 | 13,402 |
#review on flipkart
import requests
import time
from bs4 import BeautifulSoup
for page in range(0,2000):
url_raw = 'http://www.flipkart.com/lenovo-vibe-p1/product-reviews/ITMECHK5WMGKXKYQ?pid=MOBEB3VWYDTEM5QW&rating=1,2,3,4,5&reviewers=all&type=all&sort=most_helpful&start='
#'http://www.flipkart.com/apple-iphone... | kumarrishav/Real-Time-Opining-Mining | flipkart/flipkartProductReview.py | Python | mpl-2.0 | 1,408 |
import xml.dom.minidom
import time
import logging
def debug(msg):
logging.debug(msg)
def warning(msg):
logging.warning(msg)
class XMLTVDocument(object):
# this renames some of the channels
add_display_name = {}
category_map = {
# 00
'onbepaald': '',
# 01
'tv drama': 'movie/drama',
'... | beralt/horepg | horepg/xmltvdoc.py | Python | mit | 7,447 |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import asyncio
from azure_devtools.perfstress_tests import PerfStressTest
from azure.identity import DefaultAzureCredential
from azure.identity.aio import DefaultAzureC... | Azure/azure-sdk-for-python | sdk/keyvault/azure-keyvault-secrets/tests/perfstress_tests/list_secrets.py | Python | mit | 3,312 |
#!/usr/bin/env python
##########################################################################
#
# estimates.py -- scoped by US criteria
# analyze and report story & task estimates
#
# --rallyConfig=<config_file_name> name of the file with settings for pyral
# --config=<config_file_name> ditto
# --co... | geekymeek/rally-pyral-scripts | estimates.py | Python | mit | 3,647 |
# Copyright 2014 PerfKitBenchmarker 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 appli... | GoogleCloudPlatform/PerfKitBenchmarker | perfkitbenchmarker/linux_benchmarks/sysbench_benchmark.py | Python | apache-2.0 | 30,910 |
"""
This configuration file loads environment's specific config settings for the application.
It takes precedence over the config located in the boilerplate package.
"""
import os
if os.environ['HTTP_HOST'] == "appengine.beecoss.com":
# Load Boilerplate config only in http://appengine.beecoss.com
# this code ... | shupelneker/gae_new_structure | config/__init__.py | Python | lgpl-3.0 | 745 |
"""
Tests of the XBlock-family functionality mixins
"""
import ddt as ddt
from datetime import datetime
import pytz
from lxml import etree
import mock
from unittest import TestCase
from xblock.core import XBlock
from xblock.fields import List, Scope, Integer, String, ScopeIds, UNIQUE_ID, DateTime
from xblock.field_dat... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/xblock/test/test_mixins.py | Python | agpl-3.0 | 17,055 |
#!/usr/bin/env python
'''
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")... | radicalbit/ambari | ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py | Python | apache-2.0 | 19,264 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, imageio contributors
# imageio is distributed under the terms of the (new) BSD License.
""" Plugin for reading DICOM files.
"""
# todo: Use pydicom:
# * Note: is not py3k ready yet
# * Allow reading the full meta info
# I think we can more or less replace the SimpleDicomR... | kerimlcr/ab2017-dpyo | ornek/imageio/imageio-2.1.2/imageio/plugins/dicom.py | Python | gpl-3.0 | 10,446 |
""" main.py is the top level script.
Return "Hello World" at the root URL.
"""
import os
import sys
# sys.path includes 'server/lib' due to appengine_config.py
from flask import Flask, url_for
from flask import request
from flask import render_template
app = Flask(__name__.split('.')[0])
@app.route('/... | jeremydane/Info3180-Project4 | main.py | Python | apache-2.0 | 1,432 |
import pandas as pd
import numpy as np
from scipy import stats
import matplotlib
from CommonFiles.PlotOptions import PlotOptions, layout_pad, blue, green
PlotOptions(uselatex=True)
import matplotlib.pylab as plt
# Load the pickled dataframe
decay_f = pd.read_csv('stochastic_model_data/volume_results.csv')
vols = deca... | pstjohn/decay-methods | stochastic_modeling/plot_stochastic_data.py | Python | gpl-3.0 | 13,010 |
# -*- coding: utf-8 -*-
import moose
import re
def fixPath(path):
path = re.sub(r'/+', '/', path)
return path
paths = [ '/a'
, '//a'
, '/a/b'
, '/a/b/'
, '//a//b/////'
, '/a/./b'
, '///a/././b'
]
expectedPath = set([fixPath(p) for p in paths])
expectedC... | upibhalla/moose-core | tests/python/test_moose_paths.py | Python | gpl-3.0 | 679 |
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework import routers
from testcenter.views import *
# urlpatterns = [
# url(r'^applicationlist/$', views.ApplicationList.as_view()),
# url(r'^application/(?P<tc>[0-9]+)/$', views.ApplicationDetails.as_vi... | mkmeral/TevitolApplication | application/backend/testcenter/urls.py | Python | gpl-3.0 | 487 |
import urllib.request as urllib
from bs4 import BeautifulSoup as bs
import unicodedata
import pandas as pd
import os
baseURL='http://snre.ifas.ufl.edu/academics/graduate/courses-syllabi-and-curriculum/'
classListFile='majorClassLists/SNREList.csv'
html_titles = ['Principles of Ecology Courses','Particular Perspective... | sdtaylor/scheduleCrossRef | getSNREClassList.py | Python | mit | 3,204 |
# -*- coding: utf-8 -*-
import re
from datetime import date
from datetime import datetime
from decimal import Decimal
from .erros import CampoFixoError
from .erros import CampoObrigatorioError
from .erros import FormatoInvalidoError
class Campo(object):
"""
Classe base para definição de um campo de um reg... | sped-br/python-sped | sped/campos.py | Python | mit | 7,486 |
#!/usr/bin/python
#
# Copyright 2016 Red Hat | Ansible
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['prev... | resmo/ansible | lib/ansible/modules/cloud/docker/docker_container.py | Python | gpl-3.0 | 136,963 |
from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Time Trabble'
language = 'en'
url = 'http://timetrabble.com/'
start_date = '2010-05-09'
rights = 'Mikey Heller'
class Crawler(CrawlerBase):
... | datagutten/comics | comics/comics/timetrabble.py | Python | agpl-3.0 | 759 |
from binascii import hexlify
from binascii import unhexlify
from struct import pack, unpack
from PyQt4 import QtGui, QtCore
from EditorMisc import *
import ghostUI
import sys
import os
data = None
data_folder_path = os.path.dirname(os.path.abspath(sys.argv[0])) + "\data"
scenario_dirs = []
mortals = []
... | xavomel/GM_MiniEditor | GM MiniEditor.py | Python | mit | 71,115 |
#####################################################################
# app/controllers/tool_remotecommand.py
#
# (c) Copyright 2015, Benjamin Parzella. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as publis... | bparzella/gemma | app/controllers/tool_remotecommand.py | Python | lgpl-2.1 | 2,235 |
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2015 Jérémy Bobbio <lunar@debian.org>
#
# diffoscope 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 Foundati... | bnewbold/diffoscope | tests/comparators/test_bzip2.py | Python | gpl-3.0 | 2,633 |
"""Functions for generating and parsing HTTP Accept: headers for supporting server-directed content negotiation."""
from __future__ import unicode_literals
from operator import itemgetter
import six
from openid.oidutil import string_to_text
def generateAcceptHeader(*elements):
"""Generate an accept header valu... | openid/python-openid | openid/yadis/accept.py | Python | apache-2.0 | 4,986 |
#
# This file is part of Bakefile (http://bakefile.org)
#
# Copyright (C) 2009-2013 Vaclav Slavik
#
# 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... | vslavik/bakefile | src/bkl/plugins/gnu.py | Python | mit | 27,019 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Vincent A
#
# This file is part of weboob.
#
# weboob 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 opt... | sputnick-dev/weboob | modules/unsee/test.py | Python | agpl-3.0 | 1,380 |
import MySQLdb
def getConnection():
return MySQLdb.connect(
host="localhost", db="database",
user="username", passwd="password"
)
| Baughn/hymmnoserver | secure/db.py | Python | gpl-3.0 | 139 |
import re
import numpy as np
import logging
import warnings
from collections.abc import Iterable
import copy
from astropy.io import fits
from .utils import contiguous_regions, jit, HAS_NUMBA
from .utils import assign_value_if_none, apply_function_if_none
from .utils import check_iterables_close
from stingray.exceptio... | StingraySoftware/stingray | stingray/gti.py | Python | mit | 47,662 |
#! /usr/bin/env python
import logging, logtool, sys
LOG = logging.getLogger (__name__)
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname (os.path.dirname (__file__))
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "SidewallSl... | clearclaw/qeventlog | qeventlog/settings.py | Python | gpl-3.0 | 5,621 |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
urlpatterns = patterns('myproject.myapp.views',
url(r'^upload/$', 'list', name='list'),
url(r'^plot/$', 'makeGraph', name='makeGraph'),
#url(r'^plot/$', 'plot', name='plot'),
)
| khushhallchandra/dataVisualization | myproject/myproject/myapp/urls.py | Python | mit | 257 |
# Copyright 2008-2014 Nokia Solutions and Networks
#
# 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... | userzimmermann/robotframework-python3 | src/robot/libraries/DeprecatedBuiltIn.py | Python | apache-2.0 | 3,751 |
from unfold.plugin import Plugin
import datetime
from datetime import timedelta
class Scheduler2 (Plugin):
def __init__ (self, query, query_lease, **settings):
Plugin.__init__ (self, **settings)
self.query=query
self.query_lease = query_lease
self.query_leas... | onelab-eu/myslice | plugins/scheduler2/__init__.py | Python | gpl-3.0 | 3,174 |
#!/usr/bin/env python
# -*- coding=utf-8 -*-
import sys
import re
import step1
import redis
reload(sys)
sys.setdefaultencoding( "utf-8" )
#解决UnicodeEncodeError: 'ascii' codec can't encode characters in position
class step_2:
def __init__(self):
self.url = 'https://www.zhihu.com'
self.url_question = {... | luoweis/python | project1/step2.py | Python | apache-2.0 | 1,210 |
# 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
# d... | dims/etcd3-gateway | etcd3gw/client.py | Python | apache-2.0 | 14,161 |
# Copyright 2022 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | google/atheris | contrib/libprotobuf_mutator/example_fuzzers/example_proto_fuzzer.py | Python | apache-2.0 | 1,004 |
# Copyright (C) 2013-2014 The Debsources developers <info@sources.debian.net>.
# See the AUTHORS file at the top-level directory of this distribution and at
# https://anonscm.debian.org/gitweb/?p=qa/debsources.git;a=blob;f=AUTHORS;hb=HEAD
#
# This file is part of Debsources. Debsources is free software: you can
# redi... | matthieucan/debsources | debsources/app/views.py | Python | agpl-3.0 | 17,826 |
# coding: utf-8
# # Simulación de un sistema de cola simple - Taller 5
#
# El presente informe presenta la simulación de un sistema simple de colas con una entrada y un servidor, las llegadas es la cantidad de clientes en una unidad de tiempo con distribución de Poisson con parámetro lambda y numero de clientes at... | hackbray/Simulaci-n_Repository | Simulación_de_un_sistema_de_cola_simple.py | Python | gpl-2.0 | 1,957 |
"""
.. _streamline_tools:
=========================================================
Connectivity Matrices, ROI Intersections and Density Maps
=========================================================
This example is meant to be an introduction to some of the streamline tools
available in DIPY_. Some of the functions ... | FrancoisRheaultUS/dipy | doc/examples/streamline_tools.py | Python | bsd-3-clause | 10,275 |
from ..item import Item
from ..writer import Writer
content_type = 'text/tab-separated-values; charset=utf-8'
escaped_chars = [('\t', '\\t'), ('\n', '\\n'), ('\r', '\\r'), ('', '\\')]
def BadBackslash():
pass
def escape(value):
for a, b in escaped_chars:
if a:
value = value.replace(a, ... | openregister/openregister-python | openregister/representations/tsv.py | Python | mit | 1,906 |
# 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,... | faizan-barmawer/openstack_ironic | ironic/tests/test_driver_factory.py | Python | apache-2.0 | 2,538 |
"""
@package mi.dataset.driver.spkir_abj.cspp.test
@file mi/dataset/driver/spikr_abj/cspp/test/test_spkir_abj_cspp_recovered_driver.py
@author Mark Worden
@brief Minimal test code to exercise the driver parse method for spkir_abj_cspp recovered
Release notes:
Initial Release
"""
import os
import unittest
from mi.c... | janeen666/mi-instrument | mi/dataset/driver/spkir_abj/cspp/test/test_spkir_abj_cspp_recovered_driver.py | Python | bsd-2-clause | 1,163 |
#! /usr/bin/env python
# -*- coding : utf8 -*-
'Plots topological indices of Voronoi polihedra'
import os
import numpy as N
try:
from shs.calc import SiestaCalc
except (ImportError,):
from calc import SiestaCalc
def ti():
calc_dir = '/home/andrey/calc/FeC/Fe161C39/NVT/1'
c = SiestaCalc(calc_dir, c... | ansobolev/shs | bin/additional/plot_ti.py | Python | mit | 801 |
"""
test script for the model itself.
Just checking whether it runs without
errors, no sanity check so far
"""
from mayasim.model.ModelCore import ModelCore as M
m_instance = M()
assert m_instance.run_test(1) == 1
| jakobkolb/MayaSim | tests/test_model.py | Python | gpl-3.0 | 217 |
# -*- coding: utf-8 -*-
# pylint: disable=E1101
import os.path
from hashids import Hashids
from amnesia.modules.content import Content
class File(Content):
def feed(self, **kwargs):
for c in ('file_size', 'mime_id', 'original_name'):
if c in kwargs:
setattr(self, c, kwargs... | silenius/amnesia | amnesia/modules/file/model.py | Python | bsd-2-clause | 1,109 |
__CONFIG_HELP__ = '''
<div class="traceback">
<b>To disable this interface, set </b>
<a target="window"
href="https://pecan.readthedocs.org/en/latest/deployment.html#disabling-debug-mode">
<pre>conf.app.debug = False</pre>
</a>
</div>
''' # noqa
try:
import re
from backlash.debug import DebuggedAp... | jdandrea/pecan | pecan/middleware/debug.py | Python | bsd-3-clause | 2,998 |
import os
import pytest
from atomicio.core import AtomicWriter
@pytest.fixture
def atomic_writer(tmpdir):
fileobj = tmpdir.join('test')
fileobj.write('ha')
return AtomicWriter(str(fileobj), mode='w')
def test_get_stream(atomic_writer):
with atomic_writer.get_stream() as writer:
ctx = [writer... | datalib/atomicio | tests/test_core.py | Python | mit | 911 |
from random import Random
class Board(object):
"""Board dimensions"""
# directions enum
N = 'n'
S = 's'
E = 'e'
W = 'w'
def __init__(self, x_dim, y_dim):
self.x_dim = x_dim
self.y_dim = y_dim
class Position(object):
"""0 based position on the board with origin in SW... | cash/zombie | zombie/game.py | Python | gpl-2.0 | 3,703 |
import shm
from math import degrees
from mission.missions.hydrophones import ThrusterSilencer
from mission.framework.task import Task
class Silence(Task):
def on_first_run(self):
self.silencer = ThrusterSilencer()
self.hydro_watcher = shm.watchers.watcher()
self.hydro_watcher.watc... | cuauv/software | mission/missions/old/2017/silence.py | Python | bsd-3-clause | 1,089 |
# Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | SVilgelm/CloudFerry | cloudferry_devlab/cloudferry_devlab/tests/testcases/test_verify_dst_del_tenant_resources.py | Python | apache-2.0 | 12,413 |
import json
from pprint import pprint
import unicodedata
import urllib2
import csv
with open('kimonoData.json') as data_file:
data = json.load(data_file)
results = data['results']
collections = results['collection1']
final_result = []
base_url = 'http://engine-codes.herokuapp.com/api/troublecode?troublecode='
... | anistark/scraper | python/engine_codes/datos.py | Python | mit | 959 |
#!/usr/bin/python3
import requests
from sense_hat import SenseHat
count = 10
sense=SenseHat()
api_key = "ERFYPSGPGER05WM3"
temperature = sense.get_temperature()
data={"api_key": api_key, "field4": temperature }
req = requests.post("https://api.thingspeak.com/update", data=data)
print(str(round(temperature,2)));
| sdhnt/fireivacuation | iVacuation_Client/fire.py | Python | gpl-3.0 | 316 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import logging
from py4j.protocol import Py4JJavaError
from ckan.lib.base import BaseController, render, abort
import ckan.model as model
import ckan.new_authz as new_authz
from ckan.logic import tuplize_dict, clean_dict, parse_params
from ckan.lib.navl.dictization_functions i... | nullbox/ckan-streamcatalog | ckanext/streamcatalog/controllers/wso2esb_controller.py | Python | mit | 3,605 |
#
# Copyright (C) 2010-2011 Canonical Ltd. All Rights Reserved
#
# This file is part of txzookeeper.
#
# Authors:
# Kapil Thangavelu
#
# txzookeeper 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 Foundatio... | kapilt/txzookeeper | txzookeeper/tests/__init__.py | Python | lgpl-3.0 | 3,210 |
from setuptools import setup, find_packages
setup(
name='church_encoding',
version='0.1.1',
license='BSD',
author='Risto Stevcev',
author_email='risto1@gmail.com',
url='http://github.com/Risto-Stevcev/python-church-encodings',
description='Church encodings written in Python',
long_desc... | Risto-Stevcev/python-church-encodings | setup.py | Python | bsd-3-clause | 1,542 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Purchase module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you ca... | rschnapka/bank-payment | account_payment_purchase/__init__.py | Python | agpl-3.0 | 1,065 |
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
import matplotlib.mlab as mlab
import statsmodels.api as sm
from statsmodels.tsa.arima_process import arma_generate_sample
from random import normalvariate
from handler import Handler
def calibrate_arma(ar=3, ma=2, data=... | rafaelgiordano12/evolvings | evolvings/plot_synt_error.py | Python | gpl-3.0 | 2,702 |
#!/usr/bin/env python
import argparse
import binascii
import copy
import datetime
import hashlib
import json
import logging
import os
import shutil
import struct
import subprocess
import tempfile
import xml.etree.ElementTree as ET
from collections import defaultdict
from Bio.Data import CodonTable
logging.basicConfig(... | lparsons/tools-iuc | tools/jbrowse/jbrowse.py | Python | mit | 52,736 |
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
import base64
from email.mime.audio import MIMEAudio
from email.mime.base import MIMEBase
from email.mime.ima... | Fatman13/gta_swarm | quickstart.py | Python | mit | 4,885 |
"""@author: Bryan Silverthorn <bcs@cargo-cult.org>"""
import os
import signal
import multiprocessing
import condor
logger = condor.log.get_logger(__name__)
class LocalWorkerProcess(multiprocessing.Process):
"""Work in a subprocess."""
def __init__(self, stm_queue):
"""Initialize."""
multipr... | borg-project/utcondor | condor/managers/parallel.py | Python | mit | 3,455 |
from jingo import register
import jinja2
import sharing
from django.utils import encoding
@register.inclusion_tag('sharing/sharing_widget.html')
@jinja2.contextfunction
def sharing_widget(context, obj, condensed=False):
c = dict(context.items())
services = sharing.get_services()
counts = {}
for ser... | mrrrgn/olympia | apps/sharing/helpers.py | Python | bsd-3-clause | 975 |
import json
import sys
val = abs(-4)
print("val 值 %d" % val)
# 2个方法一模一样
print("val 值 " + str(val))
# password = input("enter your password")
# 有一种叫做文档字符串的特别注释。你可以在模块、类或者函数的起始添加一个字符串,
# 起到在线文档的功能,这是 Java 程序员非常熟悉的一个特性。
# def foo():
# "This is a doc string."
# return True
# 与普通注释不同,文档字符串可以在运行时访问,也可以用来自动生成文档。
# print("... | yanjinbin/learnPython | chapter_2/chapter2.py | Python | gpl-3.0 | 5,863 |
#!/usr/bin/env python
#
# This exists to paper over differences between gyp's `action` definitions
# and moz.build `GENERATED_FILES` semantics.
import buildconfig
import subprocess
def main(output, *inputs):
output.write(subprocess.check_output([buildconfig.substs['PERL']] + list(inputs)))
return None
| Yukarumya/Yukarum-Redfoxes | security/generate_certdata.py | Python | mpl-2.0 | 313 |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# FILE: seticon.py
# USAGE: seticon [folder] [icon]
# DESCRIPTION: Set a custom icon to a folder.
# REQUIREMENTS: .
# AUTHOR: Diogo Luvizon <diogo@luvizon.com>
# VERSION: 0.2
# CREATED: 1... | diogocl/deoxutils | python/seticon.py | Python | gpl-2.0 | 1,188 |
from datetime import datetime
from POICrawler.place import Place
from POICrawler.foody_place import FoodyPlace
class Diner(FoodyPlace):
def __init__(self, foody_id='', foody_rating='', name='', address='', phone='',
category=None, cuisine='', open_time=None, close_time=None,
pri... | earlwlkr/POICrawler | POICrawler/diner.py | Python | mit | 1,141 |
import networkx as nx
#import Biconnected
import operator
from Biconnect import _biconnected_dfs
from os import listdir
import xlwt
if __name__ == '__main__':
lis1 = [f for f in listdir("C:/Users/Romauld/Desktop/final year project/update 4.3/cluster")]
for each_file in lis1:
fp = open('cluster/... | amudalab/concept-graphs | document retrieval/biconnected.py | Python | mit | 1,740 |
from collections import OrderedDict
from django.db.models import Q
from django.utils.functional import cached_property
from pontoon.base.models import (
Locale,
Project,
Resource,
TranslatedResource,
Translation,
)
from pontoon.tags.models import Tag
class Clonable:
"""Instantiated descendan... | mathjazz/pontoon | pontoon/tags/utils/base.py | Python | bsd-3-clause | 5,250 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.