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/env python
from pymongo import MongoClient
import pymongo
HOST = "mongo-nosh-norep-10f:27017"
c = MongoClient(HOST)
dbname = "google"
task = "task_events"
db = c[dbname]
c[dbname].drop_collection(task)
c[dbname].create_collection(task)
#c.admin.command('enableSharding', dbname)
db = c[dbname]
task_c... | elainenaomi/sciwonc-dataflow-examples | sbbd2016/experiments/0-import-data/2-import-10files-mongo-nosh-norep/init/DataStoreInit.py | Python | gpl-3.0 | 645 |
from rest_framework.routers import SimpleRouter
from . import views
router = SimpleRouter()
router.register('countries', views.CountryViewSet)
urlpatterns = router.urls
| marcgibbons/drf_signed_auth | example/countries/urls.py | Python | bsd-2-clause | 173 |
#
# Copyright (c) 2008--2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | jdobes/spacewalk | backend/server/importlib/packageImport.py | Python | gpl-2.0 | 21,688 |
import logging
from autotest.client.shared import error
from virttest.libvirt_xml import VMXML, LibvirtXMLError
from virttest import virt_vm
def run_virsh_define(test, params, env):
"""
Test defining/undefining domain by dumping xml, changing it, and re-adding.
(1) Get name and uuid of existing vm
(2... | ehabkost/virt-test | libvirt/tests/virsh_define.py | Python | gpl-2.0 | 1,794 |
#!/usr/bin/env python2
import i3ipc
import subprocess
# process all windows on this workspace. hide when leaving and show when entering
# because chrome/ium doesnt consider itself hidden when on an invisible workspace
# this script drops my cpu usage when listening to google music from ~10% to ~3%
# I'm just putting... | lbeckman314/dotfiles | i3/musicwatcher.py | Python | mit | 1,595 |
# -*- coding: utf-8 -*-
##############################################################################
#
# jasper_server module for OpenERP
# Copyright (c) 2008-2009 EVERLIBRE (http://everlibre.fr) Eric VERNICHON
# Copyright (C) 2009-2011 SYLEAM ([http://www.syleam.fr]) Christophe CHAUVET
#
# This file is a... | Jgarcia-IAS/Fidelizacion_odoo | openerp/extras/jasper_server/__openerp__.py | Python | agpl-3.0 | 2,744 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011 Florian Mounier
# Copyright (c) 2011 Kenji_Takahashi
# Copyright (c) 2012 roger
# Copyright (c) 2012, 2014 Tycho Andersen
# Copyright (c) 2012 Maximilian Köhl
# Copyright (c) 2013 Craig Barnes
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 Adi Sieker
#
# Permission is ... | xplv/qtile | libqtile/widget/currentlayout.py | Python | mit | 2,371 |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QTextLength(): # skipped bases: <class 'sip.simplewrapper'>
"""
QTextLength()
QTextLength(QTextLengt... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtGui/QTextLength.py | Python | gpl-2.0 | 1,916 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GeoAlgorithm.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************************... | alexbruy/QGIS | python/plugins/processing/core/GeoAlgorithm.py | Python | gpl-2.0 | 21,081 |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
from math import sqrt
from math import log
dx = [1/sqrt(16), 1/sqrt(64), 1/sqrt(256), 1/sqrt(1024)]
dx_tri = [1/sqrt(32), 1/sqrt(128), 1/sqrt(512), 1/sqrt(2048)]
dx_pert = [0.0270466, 0.0134827, 0.00680914, 0.00367054]
dx_fp = [0.122799, 0.081584, 0.0445639, 0.022... | Rob-Rau/EbbCFD | ms_refinement/plot_conv.py | Python | mit | 2,727 |
from werkzeug.wrappers import Request, Response
@Request.application
def application(request):
return Response('Hello World!')
if __name__ == '__main__':
from werkzeug.serving import run_simple
run_simple('localhost', 4000, application) | mightysabean/c- | simple.py | Python | mpl-2.0 | 250 |
'''
Add the following to your project/settings.py
AUTHENTICATION_BACKENDS = ('django_linotp.linotp_auth.LinOTP', )
LINOTP = { 'url' : 'https://puckel/validate/check',
'timeout' : 5,
'ssl_verify' : False,
'host_verify' : False,
'create_user' : False,
}
'create_user': if set to True... | cornelinux/django-linotp-auth | django_linotp/linotp_auth.py | Python | gpl-3.0 | 2,749 |
import os
import re
import codecs
from setuptools import setup, find_packages
def read(*parts):
filename = os.path.join(os.path.dirname(__file__), *parts)
with codecs.open(filename, encoding='utf-8') as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
vers... | metalpriest/django-constance | setup.py | Python | bsd-3-clause | 1,931 |
import json
import os
rootUrl = os.environ.get(
'TASKCLUSTER_ROOT_URL',
'https://community-tc.services.mozilla.com')
if 'TC_PROXY' in os.environ:
PROXY_INDEX_URL = 'http://taskcluster/api/index/v1/task/{}'
else:
PROXY_INDEX_URL = rootUrl + '/api/index/v1/task/{}'
ARTIFACT_URL = rootUrl + '/api/queue/v... | glandium/git-cinnabar | CI/variables.py | Python | gpl-2.0 | 1,243 |
'''
Created on Aug 25, 2011
@author: r4stl1n
'''
import sys
from threading import Thread
import paramiko
#Check For Paramiko Dependency
class Connection (Thread):
'''
This is the class that checks if a specific
Username and password combination was successful.
'''
def __init__(self,username, p... | CarlosLannister/TFG-ShodanScripts | ssh/SSH-Brute-Forcer/Connection.py | Python | mit | 1,232 |
from contentbase import upgrade_step
@upgrade_step('analysis_step', '1', '2')
def analysis_step_1_2(value, system):
# http://redmine.encodedcc.org/issues/2770
input_mapping = {
'align-star-pe-v-1-0-2': ['reads'],
'align-star-pe-v-2-0-0': ['reads'],
'align-star-se-v-1-0-2': ['reads'],
... | kidaa/encoded | src/encoded/upgrade/analysis_step.py | Python | mit | 4,642 |
# -*- coding: utf-8 -*-
"""
===============================================================================
module __StokesFlow__: Viscous fluid flow
===============================================================================
"""
import scipy as sp
from OpenPNM.Algorithms import GenericLinearTransport
from OpenPNM... | amdouglas/OpenPNM | OpenPNM/Algorithms/__StokesFlow__.py | Python | mit | 2,480 |
#!/usr/bin/python3
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import psycopg2
import xlsxwriter
import os
import sys
import smtplib
#usage python3 colum.py filename toaddress
SQL_Code = open(str(sys.a... | ColumBrennan/data-dumper | app.py | Python | gpl-3.0 | 1,987 |
import pytest
import json
from . import TestBase
from tests.factories import item_factories
def check_valid_header_type(headers):
assert headers['Content-Type'] == 'application/json'
class TestItemAPI(TestBase):
def test_get_item_present(self, test_client, item):
r = test_client.get('/api/items/%d'... | sourcemash/Sourcemash | tests/test_api/test_items.py | Python | gpl-2.0 | 10,962 |
# Generated by Django 1.10.7 on 2017-05-18 22:37
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('case_search', '0005_migrate_json_config'),
]
operations = [
migrations.RemoveField(
model_name='casesearchconfig',
name='_c... | dimagi/commcare-hq | corehq/apps/case_search/migrations/0006_remove_casesearchconfig__config.py | Python | bsd-3-clause | 345 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import json
from random import shuffle
from datetime import datetime
import psycopg2
from django.db import connection
from django.db.models import Q
from django.core.exceptions import ... | kdeloach/otm-core | opentreemap/treemap/tests/test_udfs.py | Python | gpl-3.0 | 46,210 |
"""
MIMEJSON Serialization.
MIMEJSON extends JSON to allow automatically serialization of large binary objects as "attached" objects.
These large object can then be LAZILY loaded. This is an ALPHA software - the exact specification
of MIMEJSON is likely to evolve through iteration.
"""
import os
from .mimejson import... | wideioltd/mimejson | mimejson/__init__.py | Python | bsd-3-clause | 502 |
# -*- coding: utf-8 -*-
"""
Created on Sun Jun 07 21:39:18 2015
@author: Paco
"""
from api import API
class RubyGems(API):
_class_name = 'Ruby Gems'
_category = 'Code'
_help_url = 'http://guides.rubygems.org/rubygems-org-api/'
_version = '1'
_api_url = 'https://rubygems.org/api/v' + _version + '... | franblas/pyAPI | src/pyapi/rubygems.py | Python | mit | 1,582 |
#!/usr/bin/env python
# Copyright (C) 2014 Dan Scott <dscott@laurentian.ca>
# 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 ver... | dbs/schema-unioncat | schema_union.py | Python | gpl-3.0 | 6,085 |
# Spawn Area file created with PSWG Planetary Spawn Tool
import sys
from java.util import Vector
def addSpawnArea(core):
dynamicGroups = Vector()
dynamicGroups.add('lok_flit')
dynamicGroups.add('lok_kusak')
dynamicGroups.add('lok_perlek')
core.spawnService.addDynamicSpawnArea(dynamicGroups, 5500, 0, 3500, 'lok')
... | agry/NGECore2 | scripts/mobiles/spawnareas/lok_e_1.py | Python | lgpl-3.0 | 328 |
# Copyright 2015 OpenStack Foundation
#
# 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 ... | takeshineshiro/neutron | neutron/db/migration/alembic_migrations/dvr_init_opts.py | Python | apache-2.0 | 2,933 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.11.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
from __fut... | texperience/wagtail-pythonanywhere-quickstart | mysite/settings/base.py | Python | isc | 3,566 |
from pyjamas.ui.Button import Button
from pyjamas.ui.PopupPanel import PopupPanel
from pyjamas.ui.HTML import HTML
from pyjamas.ui.DockPanel import DockPanel
from pyjamas.ui.DialogBox import DialogBox
from pyjamas.ui.Frame import Frame
from pyjamas.ui import HasAlignment
class FileDialog(DialogBox):
def __init__(s... | minghuascode/pyj | examples/misc/djangoweb/media/Popups.py | Python | apache-2.0 | 1,125 |
from setuptools import setup, find_packages
from os import path
VERSION = '0.1.2'
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='program-synthesis',
version=VERSION,
description='NEAR Program Synth... | nearai/program_synthesis | setup.py | Python | apache-2.0 | 1,125 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mangaki', '0020_pairing_is_checked'),
]
operations = [
migrations.CreateModel(
name='Deck',
fields=[... | Mako-kun/mangaki | mangaki/mangaki/migrations/0021_deck.py | Python | agpl-3.0 | 749 |
"""
homeassistant.components.lock.demo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo platform that has two fake locks.
"""
from homeassistant.components.lock import LockDevice
from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED
# pylint: disable=unused-argument
def setup_platform(hass, config, add_devices_callb... | nevercast/home-assistant | homeassistant/components/lock/demo.py | Python | mit | 1,292 |
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on 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 Fo... | IfcOpenShell/IfcOpenShell | src/blenderbim/blenderbim/bim/module/project/operator.py | Python | lgpl-3.0 | 31,195 |
from __future__ import print_function
from __future__ import absolute_import
from celery import current_task
from cloudmesh.pbs.celery import celery_pbs_queue
from cloudmesh.config.cm_config import cm_config
from cloudmesh.pbs.pbs_mongo import pbs_mongo
import datetime
import sys
import os
import time
from celery.uti... | rajpushkar83/cloudmesh | cloudmesh/pbs/tasks.py | Python | apache-2.0 | 1,907 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2016 VoltDB Inc.
#
# 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 limitati... | paulmartel/voltdb | tests/bench/throughput/run.py | Python | agpl-3.0 | 1,927 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import time
import operator
import argparse
import sys
import os
import dbconf
import utils
import re
import codecs
import datetime
def analize(what, data, logfile):
global configuration
regex = False
""" It supports "*" as wildcard in data """
if re.search(r'\*'... | groarnet/groar | scripts/summary_access.py | Python | agpl-3.0 | 3,492 |
########################################################################
#
# University of Southampton IT Innovation Centre, 2011
#
# Copyright in this library belongs to the University of Southampton
# University Road, Highfield, Southampton, UK, SO17 1BJ
#
# This software may not be used, sold, licensed, transferred,... | mmcardle/MServe | django-mserve/jobservice/__init__.py | Python | lgpl-2.1 | 2,703 |
from time import time
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rcParams
import math
from scipy.spatial.distance import pdist, squareform
from sklearn.decomposition import PCA
import os
from tsptw_with_ortools import Solver
from config import get_config, print_config
# C... | MichelDeudon/neural-combinatorial-optimization-rl-tensorflow | Ptr_Net_TSPTW/dataset.py | Python | mit | 14,639 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Integration tests around House Bill "content" scraping.
"""
from django.test import TestCase
from scraper.interpreters import HouseBillPageContentInterpreter
class HouseBillContentInterpreterTestCase(TestCase):
def setUp(self):
self.interpreter = HouseB... | access-missouri/am-django-project | am/scraper/tests/test_integration_house_bill_content.py | Python | bsd-2-clause | 708 |
from rest_framework import permissions
class CreatorPermission(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.creator == request.user
class CreatorOrRestaurantOwner(permissions.... | MichaelCombs28/google-restaurant | server/restaurant/permissions.py | Python | mit | 633 |
''' Version 1.000
Code provided by Daniel Jiwoong Im
Permission is granted for anyone to copy, use, modify, or distribute this
program and accompanying programs and documents for any purpose, provided
this copyright notice is retained and prominently displayed, along with
a note saying that the original programs... | jiwoongim/minimum_probability_flow_learning | mnist_1bit_mpf.py | Python | bsd-3-clause | 3,868 |
from __future__ import division, print_function, absolute_import
import numbers
from numpy.random.mtrand import RandomState
import pandas
import numpy
from sklearn.utils import check_random_state
from ..utils import get_columns_dict, get_columns_in_df
# generating random seeds in the interval [0, RANDINT)
RANDINT =... | Quadrocube/rep | rep/data/storage.py | Python | apache-2.0 | 5,170 |
from datetime import datetime
import numpy as np
import pandas as pd
import pytest
from datalore.display.supported_data_type import _standardize_dict
from datalore.display.supported_data_type import _standardize_value
@pytest.mark.parametrize('value, expected, result_type', [
(np.array([1, 2]), [1, 2], list),
... | jwren/intellij-community | python/helpers/pycharm_display/tests/display/test_supported_data_type.py | Python | apache-2.0 | 2,191 |
# 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 the... | openstack/tosca-parser | doc/source/conf.py | Python | apache-2.0 | 2,423 |
import numpy as np
from pyflux.arma import ARIMA
from pyflux.families import Exponential
data = np.random.exponential(3,200)
def a_test_no_terms():
"""
Tests an ARIMA model with no AR or MA terms, and that
the latent variable list length is correct, and that the estimated
latent variables are not nan
... | RJT1990/pyflux | pyflux/arma/tests/test_arima_exponential.py | Python | bsd-3-clause | 9,932 |
"""
This is a basic model to test saving and loading boolean and date-related
types, which in the past were problematic for some database backends.
"""
from django.db import models
from django.conf import settings
class Donut(models.Model):
name = models.CharField(max_length=100)
is_frosted = models.BooleanFi... | grangier/django-11599 | tests/regressiontests/datatypes/models.py | Python | bsd-3-clause | 3,077 |
# encoding: utf-8
from flask import redirect
from flask.views import MethodView
from project import Cache
class RedirectHandler(MethodView):
header = {'Content-Type': 'application/json; charset=UTF-8'}
def get(self, shortened=None):
original = Cache.redis.get("%s:original" % shortened)
if o... | hugoantunes/shortURL | project/users/views/redirect.py | Python | mit | 500 |
from dashmat.option_spec.module_imports import module_import_spec
from dashmat.formatter import MergedOptionStringFormatter
from dashmat.core_modules.base import Module
from dashmat.errors import UnknownModule
from input_algorithms.spec_base import boolean, string_spec, formatted, listof, overridden, or_spec, set_opti... | realestate-com-au/dashmat | dashmat/option_spec/import_line.py | Python | mit | 2,434 |
"""The tests for the integration sensor platform."""
from datetime import timedelta
from unittest.mock import patch
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util
async def test_state(hass):
"""Test integration sensor state."""
config = {
'sensor': {
... | HydrelioxGitHub/home-assistant | tests/components/sensor/test_integration.py | Python | apache-2.0 | 6,750 |
import tinctest
class CardinalitySmokeTests(tinctest.TINCTestCase):
def test_smoke_cardinality1(self):
pass
def test_smoke_cardinality2(self):
pass
| lintzc/gpdb | src/test/tinc/tinctest/test/discovery/mockquery/cardinality/test_smoke_cardinality.py | Python | apache-2.0 | 175 |
# -*- coding: utf-8 -*-
"""
Metocean scatter diagram for Åsgard given as joint Hs Tp probability.
TODO:
- implement joint CDF(Hs, Tp)
need to think how to use this in practice
- read weather window, return operability
Created on 2018 2 Feb Fri 14:53:20
@author: rarossi
"""
from scipy import stats as ... | haphaeu/yoshimi | metocean.py | Python | lgpl-3.0 | 1,856 |
############################################################################
# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at https://mozil... | perlang/bv9arm-chinese | branches/9.16.16/arm/conf.py | Python | mpl-2.0 | 5,717 |
import os
import sys
from distutils.core import setup
from distutils.sysconfig import get_python_lib
VERSION = '0.4'
# Warn if we are installing over top of an existing installation. This can
# cause issues where files that were deleted from a more recent Django are
# still present in site-packages. See #18115.
ove... | caioariede/django-pikaday | setup.py | Python | mit | 3,816 |
import numpy as np
from copy import deepcopy
from tools.belief_momdp import MOMDPBelief
import math
import itertools
#################################################################
# Implements the Rock Sample POMDP problem
#################################################################
class RockSamplePOMDP():
... | sisl/Chimp | chimp/simulators/pomdp/models/rock_sample.py | Python | apache-2.0 | 11,876 |
"""Manages logic and models related to homepage and CCExtractor data."""
| canihavesomecoffee/sample-platform | mod_home/__init__.py | Python | isc | 73 |
import os
from setuptools import setup, find_packages
import stalker_pyramid
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README')).read()
CHANGES = open(os.path.join(here, 'CHANGELOG')).read()
requires = [
'pyramid>=1.4',
'transaction',
'pyramid_tm',
'pyramid_b... | iyyed/stalker-pyramid | setup.py | Python | gpl-3.0 | 1,995 |
from gensim.interfaces import TransformedCorpus
from safire.data.loaders import IndexLoader
from safire.utils.transformers import SimilarityTransformer
__author__ = 'Jan Hajic jr'
import unittest
from test.safire_test_case import SafireTestCase
class TestSimilarityTransformer(SafireTestCase):
@classmethod
... | hajicj/safire | test/test_similarity_transformer.py | Python | gpl-3.0 | 1,257 |
# coding=utf-8
from simple_ars import search_object
__authors__ = 'Manolis Tsoukalas'
__date__ = '2017-1-3'
__version__ = '0.9.2'
"""
extraction functionalities
"""
def ars_list(response_data, search_json):
"""
method for extracted data in a list format.
this method is ideal if you want to extract the ... | m19t12/simpleARS | simple_ars/extraction.py | Python | gpl-3.0 | 4,202 |
"""
Definition of the Session class.
"""
import re
import sys
import time
import json
import base64
import random
import hashlib
import asyncio
import weakref
import datetime
from http.cookies import SimpleCookie
from ..event._component import new_type
from ._component2 import PyComponent, JsComponent, AppComponentM... | jrversteegh/flexx | flexx/app/_session.py | Python | bsd-2-clause | 32,665 |
# This file is part of PyBuilder
#
# Copyright 2011-2014 PyBuilder Team
#
# 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 re... | shakamunyi/pybuilder | src/unittest/python/execution_tests.py | Python | apache-2.0 | 21,950 |
# 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 later version.
#
# wger W... | petervanderdoes/wger | wger/gym/tests/test_inactive_members.py | Python | agpl-3.0 | 1,562 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
import documentation
| adhoc-dev/odoo-web | website_doc/models/__init__.py | Python | agpl-3.0 | 291 |
import tempfile
import os
import re
import shutil
import cStringIO
from contextlib import contextmanager
import netlib
from pathod import utils, test, pathoc, pathod, language
from netlib import tcp
import requests
def treader(bytes):
"""
Construct a tcp.Read object from bytes.
"""
fp = cStringIO.... | ikoz/mitmproxy | test/pathod/tutils.py | Python | mit | 3,003 |
from network.utils import network_point_coverage
__author__ = 'gabriel'
from network import TEST_DATA_FILE
from network.itn import read_gml, ITNStreetNet
from network.streetnet import NetPath, NetPoint, Edge, GridEdgeIndex
from data import models
import os
import unittest
import settings
import numpy as np
from matplo... | gaberosser/geo-network | tests.py | Python | mit | 21,263 |
import sys
import os
from fabric.api import sudo, hosts, env, task, run, cd
from fabric.contrib.files import exists
from . import config, users, application
DEV = config.HOSTS['development']['ip']
USER = config.HOSTS['development']['user']
PASSWD = config.HOSTS['development']['password']
HOST_PKGS = config.HOSTS['de... | andrewjsledge/python-project | fabfile/development.py | Python | bsd-3-clause | 5,953 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('doctor', '0003_auto_20160111_2302'),
('agenda', '0002_auto_20160111_2258'),
]
operations = [
migrations.RemoveField(... | Foxugly/medagenda | agenda/migrations/0003_auto_20160112_0123.py | Python | gpl-3.0 | 636 |
import sys
from setuptools import setup, find_packages
# Little hack to make 'python setup.py test' work on py2.7
try:
import multiprocessing
import logging
except:
pass
# Requirements to install buffet plugins and engines
_extra_genshi = ["Genshi >= 0.3.5"]
_extra_mako = ["Mako >= 0.1.1"]
_extra_jinja =... | toscawidgets/tw2.bootstrap | setup.py | Python | bsd-2-clause | 2,176 |
import os
import maya.cmds as m
from fxpt.fx_texture_manager.com import cleanupPath
# noinspection PySetFunctionToLiteral
IGNORED_OBJECT_TYPES = set([
'defaultShaderList',
'defaultTextureList'
])
IGNORED_OBJECTS = set()
for t in IGNORED_OBJECT_TYPES:
IGNORED_OBJECTS.update(m.ls(typ=t))
SHADING_ENGINE_TY... | theetcher/fxpt | fxpt/fx_texture_manager/tex_node.py | Python | mit | 2,368 |
# -*- coding: utf-8 -*-
###############################################################################
#
# AddAccessConfig
# Adds an access config to an instance's network interface.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
#... | jordanemedlock/psychtruths | temboo/core/Library/Google/ComputeEngine/Instances/AddAccessConfig.py | Python | apache-2.0 | 6,857 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.contrib import admin
from tree.models import *
admin.site.register(Tree)
admin.site.register(Question)
admin.site.register(Answer)
admin.site.register(TreeState)
admin.site.register(Transition)
admin.site.register(Entry)
admin.site.register(Session)
| genova/rapidsms-senegal | apps/tree/admin.py | Python | bsd-3-clause | 316 |
import tweepy
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
tweepyapi = tweepy.API(auth)
tweepyapi.update_status('Hello World!')
print("Hello {}".format(tweepyapi.me().name)) | LairdStreak/MyPyPlayGround | tujData/tweepy__.py | Python | mit | 248 |
# Copyright 2019 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... | annarev/tensorflow | tensorflow/python/ops/tensor_array_ops_test.py | Python | apache-2.0 | 3,451 |
import numpy as np
def multivariate_gaussian(x, mean, cov):
'''Calculate the probability density of a multivariate
gaussian distribution at x.
'''
n = x.shape[0]
return 1 / (np.power(2 * np.pi, n / 2.0) * np.absolute(np.power(np.linalg.det(cov), 0.5))) \
* np.exp(-0.5 * np.dot(x - mean... | xingjiepan/ss_generator | ss_generator/numeric.py | Python | bsd-3-clause | 561 |
"""
Content metadata exporter for Canvas
"""
from logging import getLogger
from integrated_channels.integrated_channel.exporters.content_metadata import ContentMetadataExporter
LOGGER = getLogger(__name__)
BLACKBOARD_COURSE_CONTENT_NAME = 'edX Course Details'
class BlackboardContentMetadataExporter(ContentMetadata... | edx/edx-enterprise | integrated_channels/blackboard/exporters/content_metadata.py | Python | agpl-3.0 | 3,845 |
#!/bin/env python
# @info - Unit testing suite for the main server program. We will spin it up on localhost
# and send test API requests to it, making sure the correct responses are received.
from unit_test import *
class serverUnitTest(UnitTest) :
def __init__(self, testargs) :
pass
| Praxyk/Praxyk-DevOps | server/unittest/server_unit_tests.py | Python | gpl-2.0 | 310 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
__init__.py
Created by otger on 29/03/17.
All rights reserved.
""" | otger/PubSubTest | tests/webui/api/__init__.py | Python | lgpl-3.0 | 113 |
from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Garfield"
language = "en"
url = "http://www.garfield.com/"
start_date = "1978-06-19"
rights = "Jim Davis"
class Crawler(CrawlerBase):
histo... | jodal/comics | comics/comics/garfield.py | Python | agpl-3.0 | 795 |
from __future__ import division
import os
import tqdm
import copy
from random import (expovariate, uniform, triangular, gammavariate,
lognormvariate, weibullvariate)
from csv import writer, reader
from decimal import getcontext
from itertools import cycle
from .auxiliary import *
from .node import ... | CiwPython/Ciw | ciw/simulation.py | Python | mit | 12,635 |
from datetime import timedelta
from django.db import models
from django.db.models import functions
from yawn.utilities import logger
class Worker(models.Model):
"""Information about current and past workers"""
#
# NOTE: consider instead taking an advisory lock for each worker,
# and using it to chec... | aclowes/yawn | yawn/worker/models.py | Python | mit | 2,457 |
#!/usr/bin/env python
import gammu
import time
# Whether be a bit more verbose
verbose = False
def ReplyTest(message):
if message['Number'] == '999':
# No reply to this number
return None
return 'Reply to %s' % message['Text']
# Reply function, first element is matching string, second can be... | markjeee/gammu | python/examples/sms-replier.py | Python | gpl-2.0 | 1,872 |
# kpbochenek@gmail.com
import time
memo = ["A0"] + [chr(a) + str(b) for a in range(ord('A'), ord('Z')+1) for b in range(1, 10)]
dformat = "%Y-%m-%d"
def count_ingots(report):
return sum(map(lambda v: memo.index(v), report.split(",")))
def count_reports(full_report, from_date, to_date):
from_date, to_date =... | kpbochenek/empireofcode | daily_reports.py | Python | apache-2.0 | 1,324 |
# Serial Photo Merge
# Copyright (C) 2017 Simone Riva mail: simone.rva {at} gmail {dot} com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#(at your optio... | simon-r/SerialPhotoMerge | imgmerge/mergeAverageImage.py | Python | gpl-3.0 | 2,816 |
from urlparse import urljoin
from scrapy import log
from scrapy.http import HtmlResponse
from scrapy.utils.response import get_meta_refresh
from scrapy.exceptions import IgnoreRequest, NotConfigured
class BaseRedirectMiddleware(object):
enabled_setting = 'REDIRECT_ENABLED'
def __init__(self, settings):
... | ofanoyi/scrapy | scrapy/contrib/downloadermiddleware/redirect.py | Python | bsd-3-clause | 4,259 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/perl-svg/package.py | Python | lgpl-2.1 | 1,582 |
from thlib.side.Qt import QtWidgets as QtGui
from thlib.side.Qt import QtGui as Qt4Gui
from thlib.side.Qt import QtCore
import thlib.tactic_classes as tc
from thlib.environment import env_inst
import thlib.global_functions as gf
from thlib.ui_classes.ui_custom_qwidgets import Ui_horizontalCollapsableWidget
from thlib.... | listyque/TACTIC-Handler | thlib/ui_classes/ui_columns_editor_classes.py | Python | epl-1.0 | 12,181 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# All Rights Reserved.
#
# Lic... | tylertian/Openstack | openstack F/nova/nova/db/sqlalchemy/models.py | Python | apache-2.0 | 37,122 |
"""SCons.Tool.gs
Tool-specific initialization for Ghostscript.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a ... | datalogics/scons | src/engine/SCons/Tool/gs.py | Python | mit | 2,354 |
"""
Support for ANSI colours in command-line client.
.. data:: ESC
ansi escape character
.. data:: RESET
ansi reset colour (ansi value)
.. data:: COLOURS_NAMED
dict of colour names mapped to their ansi value
.. data:: COLOURS_MIDS
A list of ansi values for Mid Spectrum Colours
"""
import itertools
... | magloire/twitter | twitter/ansi.py | Python | mit | 1,954 |
"""
def revertДана строка (возможно, пустая), состоящая из букв A-Z и пробелов, разделяющих слова.
Нужно написать функцию, которая развернет слова.
И сгенерирует ошибку, если на вход пришла невалидная строка.
Примеры:
"QUICK FOX JUMPS"->"KCIUQ XOF SPMUJ"
" QUICK FOX JUMPS "->" KCIUQ XOF SPMUJ "
" "->" "
""->"
... | sdenisen/python | yandex/task10/task10_resolve.py | Python | unlicense | 959 |
from __future__ import absolute_import
from django.conf.urls import include, url
from dynamic_rest.routers import DynamicRouter
from tests import viewsets
router = DynamicRouter()
router.register_resource(viewsets.UserViewSet)
router.register_resource(viewsets.GroupViewSet)
router.register_resource(viewsets.ProfileVi... | AltSchool/dynamic-rest-client | tests/urls.py | Python | mit | 964 |
import sys
import argparse
import logging
import importlib
from .server import Server, build_endpoint_description_strings
from .access import AccessLogGenerator
logger = logging.getLogger(__name__)
DEFAULT_HOST = '127.0.0.1'
DEFAULT_PORT = 8000
class CommandLineInterface(object):
"""
Acts as the main CLI en... | maikhoepfel/daphne | daphne/cli.py | Python | bsd-3-clause | 7,303 |
from hypothesis import given, example
from hypothesis.strategies import binary, integers
from mitmproxy.tls import ClientHello
from mitmproxy.proxy.layers.tls import parse_client_hello
client_hello_with_extensions = bytes.fromhex(
"16030300bb" # record layer
"010000b7" # handshake layer
"03033b70638d252... | mitmproxy/mitmproxy | test/mitmproxy/proxy/layers/test_tls_fuzz.py | Python | mit | 1,067 |
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
# Copyright 2017 Fujitsu LIMITED
#
# 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/LI... | openstack/monasca-api | monasca_api/tests/test_alarm_expression.py | Python | apache-2.0 | 6,872 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
""" Usefull functions and classes """
| Martoni/periphondemand | periphondemand/bin/utils/__init__.py | Python | lgpl-2.1 | 81 |
"""Function/variables common to all the commands
"""
__copyright__ = """
Copyright (C) 2005, Catalin Marinas <catalin.marinas@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
Th... | miracle2k/stgit | stgit/commands/common.py | Python | gpl-2.0 | 18,556 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#-----------------------------------------------------------------------#
# fits-for-roi.py #
# #
# Script to create FITS files from ROI observing o... | gracca/fits-for-roi | fits-for-roi.py | Python | gpl-3.0 | 2,686 |
#!/usr/bin/python
# Example file with custom commands, located at /magical/commands/example.py
import lldb
import fblldbbase as fb
def lldbcommands():
return [ PrintKeyWindowLevel() ]
class PrintKeyWindowLevel(fb.FBCommand):
def name(self):
return 'pkeywinlevel'
def description(self):
return 'An incre... | itsthejb/ChiselCommands | NSLogBreakPoint.py | Python | mit | 683 |
from django.conf import settings
from django.db import models
from .ticket import Ticket
class Attachment(models.Model):
"""Ticket attachment model."""
ticket = models.ForeignKey(
Ticket, blank=False, related_name='attachments', db_index=True,
on_delete=models.DO_NOTHING)
user = models.F... | occrp/id-backend | api_v3/models/attachment.py | Python | mit | 887 |
#!/usr/bin/env python
"""
Script to automate some parts of checking NEW packages
Most functions are written in a functional programming style. They
return a string avoiding the side effect of directly printing the string
to stdout. Those functions can be used in multithreaded parts of dak.
@contact: Debian FTP Maste... | luther07/dak | dak/examine_package.py | Python | gpl-2.0 | 23,247 |
#!/usr/bin/env python
# Copyright 2011 Google Inc. All Rights Reserved.
"""Parser for IE index.dat files.
Note that this is a very naive and incomplete implementation and should be
replaced with a more intelligent one. Do not implement anything based on this
code, it is a placeholder for something real.
For anyone w... | darrenbilby/grr | parsers/ie_history.py | Python | apache-2.0 | 5,599 |
# env_inspect.py: Check the testing environment.
# Copyright (C) 2010-2012 Red Hat, Inc.
#
# libvirt-test-API 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 opt... | libvirt/libvirt-test-API | libvirttestapi/src/env_inspect.py | Python | gpl-2.0 | 4,465 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.