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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
class Meta:
title = "Control integration with google translate."
author = "Apostolos Bessas"
description = "Enables/disables translate.google.com integration for projects."
| tymofij/adofex | transifex/addons/copyright/__init__.py | Python | gpl-3.0 | 210 |
# populator.py
# Backend code for populating a DeviceTree.
#
# Copyright (C) 2009-2015 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 Lesser General Public License v.2, or (at your option) any l... | AdamWill/blivet | blivet/populator/populator.py | Python | lgpl-2.1 | 19,751 |
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.db import models
from base.models import ModelloSemplice
from base.tratti import ConMarcaTemporale
class Giudizio(ModelloSemplice, ConMarcaTemporale):
"""
R... | CroceRossaItaliana/jorvik | social/models.py | Python | gpl-3.0 | 4,591 |
from .owlobjectpropertyaxiom import OWLObjectPropertyAxiom
class OWLObjectPropertyCharacteristicAxiom(OWLObjectPropertyAxiom):
"""TODO: implement"""
def __init__(self, property, annotations):
"""
:param property: an owlapy.model.OWLObjectPropertyExpression object
:param annotations: a... | patrickwestphal/owlapy | owlapy/model/owlobjectpropertycharacteristicaxiom.py | Python | gpl-3.0 | 451 |
"""
Django settings for Sample project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
imp... | lewang0418/Django-Celery-Mongodb | Sample/settings.py | Python | apache-2.0 | 4,551 |
PY2 = (str is bytes)
PY3 = (str is not bytes)
if PY3:
number_types = (int, float)
integer_types = int
string_types = str
else:
number_types = (int, long, float)
integer_types = (int, long)
string_types = basestring
| six8/python-clom | src/clom/_compat.py | Python | mit | 240 |
from logging import getLogger
from sqlalchemy import types, Column, Table, ForeignKey, and_, UniqueConstraint
from ckan.lib.base import config
from ckan import model
from ckan.model import Session
from ckan.model import meta
from ckan.model import types as _types
from ckan.model.domain_object import DomainObject
fro... | dubvfan87/ckanext-oauth2provider | ckanext/oauth2provider/model/refresh_token.py | Python | agpl-3.0 | 1,762 |
from django.db import models
from datetime import datetime
from delegate import DelegateManager, delegate
from signalqueue.worker.base import QueueBase
#from signalqueue.utils import logg
class SignalQuerySet(models.query.QuerySet):
"""
SignalQuerySet is a QuerySet that works as a signalqueue backend.
... | Steckelfisch/django-signalqueue | signalqueue/models.py | Python | bsd-3-clause | 4,742 |
import unittest
import copy
class BaseTest(unittest.TestCase):
def setUp(self):
from test_data.test_config import py
self.config = copy.deepcopy(py)
| sirech/Find-Metal-Albums | metalfinder/tests/test_base.py | Python | mit | 171 |
# -*- coding: UTF-8 -*-
#***************************************************************************
#* Copyright (C) 2020 Stefano Chiaro <stefano.chiaro@yahoo.com> *
#* *
#* This library is free software; you can redistribute it and/o... | sanguinariojoe/FreeCAD | src/Mod/Path/PathScripts/post/heidenhain_post.py | Python | lgpl-2.1 | 41,197 |
# -*- coding: utf-8 -*-
class Solution(object):
def intersection(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
return list(set(nums1) & set(nums2))
| Silence-WWT/LeetCode | 349-Intersection-of-Two-Arrays.py | Python | mit | 247 |
import newrelic.agent
from treeherder.etl.classification_mirroring import ElasticsearchDocRequest
from treeherder.workers.task import retryable_task
@retryable_task(name="submit-elasticsearch-doc", max_retries=10, soft_time_limit=30)
def submit_elasticsearch_doc(project, job_id, bug_id, classification_timestamp, who... | tojonmz/treeherder | treeherder/etl/tasks/classification_mirroring_tasks.py | Python | mpl-2.0 | 809 |
# -*- coding: UTF-8 -*-
# import glob as __glob__
# import os as __os__
# def __getModules():
# _ext = []
# _ext_dir = __os__.path.dirname(__file__)
# for file_ in __glob__.glob(_ext_dir + "/*.py"):
# if file_ == "__init__.py":
# continue
# _ext_name = __os__.path.basename(fil... | mariodebian/server-stats-system-agent | sssa/helpers/__init__.py | Python | gpl-2.0 | 810 |
from datetime import timedelta
from django.contrib.sites.models import Site
from django.template.defaultfilters import date as print_date
from django.test.utils import override_settings
from django.utils.datetime_safe import date
from cms.models.pagemodel import Page
from cms.models.placeholdermodel import Placeholde... | aptivate/djangocms_events | tests/events/tests/event_detail_list_plugin_tests.py | Python | gpl-3.0 | 2,714 |
import os
from sqlalchemy import create_engine, MetaData
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
def __db_path():
current_dir = os.path.dirname(__file__)
# parent_dir = os.path.abspath(os.path.join(current_dir, os.path.pardir))
return 'sqlite:///{}'.... | techbureau/zaifbot | zaifbot/db/config.py | Python | mit | 796 |
"""
Copyright 2007-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 l... | trondeau/gnuradio | grc/gui/ActionHandler.py | Python | gpl-3.0 | 35,320 |
#!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... | crocoin/crocoin | contrib/pyminer/pyminer.py | Python | mit | 6,434 |
import bs
import os
import os.path
from md5 import md5
import weakref
import imp
import sys
default = {
"_version": 1,
"_name": "Auto Reload",
"enabled": dict(_default=True, _name="Enable"),
"check_interval": dict(_default=2.5, _min=1, _inc=0.5, _max=10, _name="Check interval"),
"folder": dict(_default="auto_relo... | Mrmaxmeier/BombSquad-Community-Mod-Manager | mods/auto_reloader.py | Python | unlicense | 4,987 |
"""Const for Sonos."""
import datetime
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.media_player import DOMAIN as MP_DOMAIN
from homeassistant.components.media_player.const import (
MEDIA_CLASS_ALBUM,
MEDIA_CLASS_ARTIST,
MEDIA_CLASS_COMPOSE... | jawilson/home-assistant | homeassistant/components/sonos/const.py | Python | apache-2.0 | 5,571 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServer.
.. 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.
"""
__autho... | gioman/QGIS | tests/src/python/test_qgsserver_accesscontrol.py | Python | gpl-2.0 | 67,142 |
r"""
A simple, fast, extensible JSON encoder and decoder
JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
simplejson exposes an API familiar to uses of the standard library
marshal and pickle modules.
Encoding b... | dewitt/webfingerclient-dclinton | third_party/simplejson/__init__.py | Python | apache-2.0 | 10,784 |
#!/usr/bin/python3
"""
Given an array equations of strings that represent relationships between
variables, each string equations[i] has length 4 and takes one of two different
forms: "a==b" or "a!=b". Here, a and b are lowercase letters (not necessarily
different) that represent one-letter variable names.
Return true... | algorhythms/LeetCode | 990 Satisfiability of Equality Equations.py | Python | mit | 1,985 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_03_01/models/topology_resource_py3.py | Python | mit | 1,570 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('wagtailredirects', '0002_add_verbose_names'),
('wagtailforms', '0002_add_verbose_names'),
('wagtailsearch', '0002_add_verbose... | praekelt/molo-ndoh-yep | polls/migrations/0002_auto_20150807_1051.py | Python | bsd-2-clause | 541 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2013, Ansible Project
# 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',
... | h3biomed/ansible | lib/ansible/modules/cloud/vmware/_vsphere_guest.py | Python | gpl-3.0 | 72,207 |
# Hello world python program for chetan to understand what's going on.
| nchetan/poc | python/hello_world.py | Python | mit | 72 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or m... | ingadhoc/openerp-travel | travel_journey/travel_journey_type.py | Python | agpl-3.0 | 1,611 |
# -*- coding: utf-8 -*-
from unittest import TestCase
from bson import ObjectId
from datetime import datetime
from eve.io.mongo.parser import parse, ParseError
from eve.io.mongo import Validator, Mongo, MongoJSONEncoder
from eve.tests import TestBase
from eve.tests.test_settings import MONGO_DBNAME
import simplejson a... | yanyanqin/eve | eve/tests/io/mongo.py | Python | bsd-3-clause | 13,721 |
import numpy as np
import pytest
from alphacsc.utils import check_dimension
def test_check_dimension():
X = np.empty((2, 3, 4))
dims = check_dimension(X, expected_shape="n_trials, n_channels, n_times")
assert dims == X.shape
dims = check_dimension(X[0], expected_shape="n_trials, n_channels")
asse... | alphacsc/alphacsc | alphacsc/utils/tests/test_validation.py | Python | bsd-3-clause | 445 |
from dataset import PennFudanDataset
from processing import process, pipeline
from processing.filters import grayscale, bilateral, canny
from sklearn.metrics import precision_recall_fscore_support
from multiprocessing import cpu_count, Pool
from sklearn.cross_validation import train_test_split
from classifier import ex... | dominiktomicevic/pedestrian | filteropt.py | Python | mit | 3,116 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-30 17:38
from __future__ import absolute_import, unicode_literals
import django.db.models.manager
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('certificates', '0013_remove_certificategenerationco... | ESOedX/edx-platform | lms/djangoapps/certificates/migrations/0014_change_eligible_certs_manager.py | Python | agpl-3.0 | 583 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'BlogPost.status'
db.add_column('pelican_admin_blogpost', 'status',
sel... | fjcaetano/pelican_admin | pelican_admin/migrations/0003_auto__add_field_blogpost_status.py | Python | bsd-3-clause | 2,718 |
import simplemap, webbrowser
map_title = 'Example Map'
center_point = [34.5124, -118.1111]
#center_point = None
gps_markers = [ ['Example text', 34.4563,-118.1241], [34.5235,-118.1245], [34.6432,-118.1554] ]
# TIL that python asigns by reference. Meaning that even though you shift data around in new_gps
# it will ef... | patrick--/simplemap | example.py | Python | mit | 789 |
# -*- coding: utf-8 -*-
import datetime
import sys
import os
# Add flask_velox to the Path
root = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'..',
)
)
sys.path.append(os.path.join(root, 'doit'))
now = datetime.datetime.utcnow()
year = now.year
version = open(os.path.join(root, ... | spacedogXYZ/Flask-Store | docs/conf.py | Python | mit | 1,164 |
import os
import re
import logging
from pegasus.models import (
TargetPlatform, Architecture, ProductType, Language, Executor,
LibraryInfo
)
from pegasus.util import (
push_working_directory,
pop_working_directory,
find_path_in_list
)
class Linux(TargetPlatform):
# tuple: (prefix, extension)
product_type_dat... | apetrone/pegasus | targets/linux.py | Python | bsd-2-clause | 5,862 |
# Copyright (C) 2014 by Clearcode <http://clearcode.cc>
# and associates (see AUTHORS).
# This file is part of mirakuru.
# mirakuru is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of ... | spinus/mirakuru | src/mirakuru/output.py | Python | lgpl-3.0 | 3,278 |
from conans.client.output import ConanOutput
from conans.client.command import Command, migrate_and_get_client_cache
from io import StringIO
import shlex
from conans.util.files import save_files, load, save
from conans.test.utils.runner import TestRunner
import os
from conans.client.remote_manager import RemoteManager
... | AversivePlusPlus/AversivePlusPlus | tools/conan/conans/test/tools.py | Python | bsd-3-clause | 16,236 |
#!/usr/bin/env python
###############################################################################
#
# Copyright 2010 Locomatix, 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
#
# ... | locomatix/locomatix-python | locomatix/cli/get_attributes.py | Python | apache-2.0 | 1,941 |
# Copyright (c) 2012 OpenStack, LLC.
# 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 requi... | maoy/zknova | nova/scheduler/filters/io_ops_filter.py | Python | apache-2.0 | 1,650 |
import itertools
import logging
from grumpy_inspect.connectors import get_openstack_nova_client
logging.captureWarnings(True)
def main():
cli = get_openstack_nova_client()
if not cli:
return
servers = cli.servers.list()
cold_instances = [s for s in servers if s.status != 'ACTIVE']
if col... | CSC-IT-Center-for-Science/grumpy-inspect | scripts/grumpy.py | Python | mit | 2,180 |
import asyncio
import os
import subprocess
import aiofiles
import httpx
import idx2numpy
import pandas as pd
from dataget import utils
from dataget.dataset import Dataset
class imagenet(Dataset):
@property
def name(self):
return "image_imagenet"
def download(self):
subprocess.check_cal... | cgarciae/dataget | dataget/image/imagenet.py | Python | mit | 3,608 |
def purify(args):
result = []
for a in args:
if a%2==0:
result.append(a)
return result
#Testing program
print purify([1,2,3]) | polde-live/learnpython | codecademy/purify.py | Python | unlicense | 167 |
# Copyright (c) 2012 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 or agreed to... | SmartInfrastructures/neutron | neutron/tests/unit/test_policy.py | Python | apache-2.0 | 29,285 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or modify
# it und... | jobiols/management-system | mgmtsystem_hazard/models/mgmtsystem_hazard_origin.py | Python | agpl-3.0 | 1,280 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
import logging
import os
from collections import MutableSet
from datetime import datetime, date, time
from sqlalchemy import Column, Unicod... | oxc/Flexget | flexget/plugins/list/subtitle_list.py | Python | mit | 13,813 |
import unittest
class TestCase(unittest.TestCase):
def test_fail(self):
d = 1 / 0
self.assertEqual(1, 0, "broken")
| siosio/intellij-community | python/testData/debug/unittests_debugging/test_case_16.py | Python | apache-2.0 | 137 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
... | Eric89GXL/vispy | vispy/visuals/tests/test_axis.py | Python | bsd-3-clause | 2,220 |
#!/usr/bin/python
import sys, os
from subprocess import call
from commands import getstatusoutput
from os import listdir
from os.path import isfile, join
print "\nUsage: repeat_masker_run_big.py ListOfSequences NumberOfThreads\n"
try:
lista = sys.argv[1]
except:
lista = raw_input("Introduce list of fastq.gz ... | fjruizruano/ngs-protocols | repeat_masker_run_big_microsat.py | Python | gpl-3.0 | 1,432 |
import math
number = 100
fact = math.factorial(number)
digits = []
while fact > 0:
digit = fact % 10
digits.append(digit)
fact = fact / 10
print sum(digits)
| karolciba/playground | projecteuler/problem_20_factorial_sum.py | Python | unlicense | 174 |
from time import sleep
import pytest
import cfme.utils.auth as authutil
from cfme.utils.log import logger
@pytest.fixture(scope='module')
def amazon_auth_provider():
try:
return authutil.get_auth_crud('amazon')
except KeyError:
pytest.skip('amazon auth provider not found in auth_data.auth_pr... | nachandr/cfme_tests | cfme/fixtures/authentication.py | Python | gpl-2.0 | 6,464 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000045.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000045 | BIOMD0000000045/model.py | Python | cc0-1.0 | 427 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | xirl/xirl/evaluators/nn_visualizer.py | Python | apache-2.0 | 2,694 |
from unittest import TestCase
class TestCoin(TestCase):
def test_reset_pos(self):
from game import Coin
c = Coin()
self.assertEquals(c.center_x, 0)
c.update()
| pauleveritt/visual_debugging_games | testing/test_coin.py | Python | apache-2.0 | 197 |
# -*- coding: utf-8 -*-
dCellSize = 20
WindowWidth = 400
WindowHeight = 400
class SCell(object):
def __init__(self, xmin, xmax, ymin, ymax):
self._iTicksSpentHere = 0
self._left = xmin
self._right = xmax
self._top = ymin
self.bottom = ymax
def Update(self):
self._iTicksSpentHere... | crazyskady/ai-game-python | Chapter08/CMapper.py | Python | mit | 1,821 |
# Copyright 2012 OpenStack Foundation.
# 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 req... | ntt-sic/python-glanceclient | tests/v2/test_images.py | Python | apache-2.0 | 21,861 |
#!/usr/bin/env python
#
# Copyright 2021 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Delete files from the temporary directory on a Swarming bot."""
import os
import sys
if sys.platform == 'win32':
os.system(r'forfiles /P c:\users\chro... | google/skia-buildbot | scripts/run_on_swarming_bots/delete_tmp_dirs.py | Python | bsd-3-clause | 562 |
import re
from io import BytesIO
import bs4
from flask import Flask, abort, render_template, request, send_file, url_for
from logbook import Logger
import maildump
from maildump import db
from maildump.util import bool_arg, get_version, rest
from maildump.web_realtime import handle_sse_request
RE_CID = re.compile(r'... | ThiefMaster/maildump | maildump/web.py | Python | mit | 5,646 |
# ----------------------------------------------------------------------
# SSLCAUDIT - a tool for automating security audit of SSL clients
# Released under terms of GPLv3, see COPYING.TXT
# Copyright (C) 2012 Alexandre Bezroutchko abb@gremwell.com
# ----------------------------------------------------------------------... | grwl/sslcaudit | sslcaudit/core/ThreadingTCPServer.py | Python | gpl-3.0 | 1,002 |
#Bai tap ve nha ngay 3 (20150827)
a = raw_input ("Nhap vao 1 chuoi so:")
#print "So nay:", a
print "So ki tu a la:", a.count("a")
print "So ki tu b la:", a.count("b")
print "So ki tu c la:", a.count("c") | pythonvietnam/pbc082015 | vumanhcuong/Day3/khonghieu.py | Python | gpl-2.0 | 204 |
def f(x, y):
"""
Returns
-------
object
""" | paplorinc/intellij-community | python/testData/intentions/returnTypeInEmptyNumpyDocString_after.py | Python | apache-2.0 | 63 |
# Copyright 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.
import atexit
import collections
import contextlib
import ctypes
import logging
import os
import platform
import re
import socket
import struct
import subpro... | js0701/chromium-crosswalk | tools/telemetry/telemetry/internal/platform/win_platform_backend.py | Python | bsd-3-clause | 14,164 |
"""
Documentation functions
URLS to do:
###/pdf/ <-FILE-> DOC_PDF
###/doc/live/ - WorksheetFile(os.path.join(DOC, name)
###/doc/static/ - DOC/index.html
###/doc/static/reference/ <-FILE-> DOC/reference/
###/doc/reference/media/ <-FILE-> DOC_REF_MEDIA
/src/ - SourceBrowser
/src/<name> - So... | bollu/sagenb | sagenb/flask_version/doc.py | Python | gpl-3.0 | 2,352 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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.
#
# This program is distrib... | Microvellum/Fluid-Designer | win64-vc/2.78/Python/bin/2.78/scripts/addons/game_engine_save_as_runtime.py | Python | gpl-3.0 | 8,665 |
"""
Module containing automated unit tests for PyBroMo.
Running the tests requires `py.test`.
"""
import pytest
import numpy as np
import json
import pybromo as pbm
_SEED = 2345654342
def randomstate_equal(rs1, rs2):
if isinstance(rs1, np.random.RandomState):
rs1 = rs1.get_state()
assert isinstanc... | tritemio/PyBroMo | pybromo/tests/test_diffusion.py | Python | gpl-2.0 | 7,547 |
__verbose_name__ = 'OpenSlides VoteCollector Plugin'
__description__ = 'This plugin connects OpenSlides with the VoteCollector of Voteworks for electronic voting.'
__version__ = '2.0.0-dev'
default_app_config = 'openslides_votecollector.apps.VoteCollectorAppConfig'
| normanjaeckel/openslides-votecollector | openslides_votecollector/__init__.py | Python | mit | 267 |
# coding:utf-8
import os
import logging
import logging.config
log_dir = os.path.dirname(os.path.dirname(__file__))+'/logs'
if not os.path.exists(log_dir):
os.mkdir(log_dir)
log_path = os.path.join(log_dir, 'netease.log')
log_config = {
'version': 1.0,
'formatters': {
'detail': {
'for... | KevinZhouyu/NeteaseCrawler | log.py | Python | apache-2.0 | 1,667 |
from jobman.tools import DD
import numpy as np
"""
Borrowed from
http://vdumoulin.github.io/articles/pylearn2-jobman/.
"""
def extract_everything(train_obj):
dd = DD()
channels = train_obj.model.monitor.channels
for k in channels.keys():
values = channels[k].val_record
dd[k] = values
... | ndronen/pylearnutils | pylearnutils/jobs.py | Python | bsd-3-clause | 941 |
# # -*- coding: utf8 -*-
u"""
решение задачи №1 ДЗ №1 - Частота буквы.
УСЛОВИЕ:
Посчитать процентное соотношение букв в тексте.
Заглавные и строчные приравниваются.
Вывести словарь: ключ - буква, значение - процент (до десятых),
в котором эта буква встречается в тексте.
Текст:
Proin eget tortor risus.
Cras ultrici... | pybursa/homeworks | e_viktoroff/hw4/hw4_solution_1.py | Python | gpl-2.0 | 1,136 |
from SVG import *
from random import random
from math import pi, cos, sin
def eq(a, b):
eps = 10**-6
return abs(a[0] - b[0]) < eps and abs(a[1] - b[1]) < eps
def isIn(line, point):
if eq(line[0], point) or eq(line[1], point):
return False
return (line[0][0] < point[0] < line[1... | BranislavBajuzik/muni | IV122/05/A.py | Python | unlicense | 1,634 |
# #######
# Copyright (c) 2014-2020 Cloudify Platform 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... | cloudify-cosmo/cloudify-gcp-plugin | cloudify_gcp/compute/disk.py | Python | apache-2.0 | 4,178 |
import imdb
import time
import re
import csv
genres = ['Action', 'Adventure', 'Animation', 'Biography', 'Comedy', 'Crime', 'Documentary', 'Drama', 'Family', 'Fantasy', 'Film-Noir', 'History', 'Horror', 'Music', 'Musical', 'Mystery', 'Romance', 'Sci-Fi', 'Sport', 'Thriller', 'War', 'Western', 'Short']
ratings = ['USA:... | Zenohm/CS380-Final-Project | src/Cameron/test.py | Python | apache-2.0 | 1,869 |
#!/usr/bin/env python
# coding: utf-8
# # Simple Model Training Example
#
# This example is the API example for this Ludwig command line example
# (https://ludwig-ai.github.io/ludwig-docs/examples/#image-classification-mnist).
import logging
import shutil
import yaml
from ludwig.api import LudwigModel
from ludwig.da... | uber/ludwig | examples/mnist/simple_model_training.py | Python | apache-2.0 | 1,097 |
from sqlalchemy.orm import joinedload
from clld.db.util import icontains, get_distinct_values
from clld.web.util.htmllib import HTML, literal
from clld.web.util.helpers import map_marker_img
from clld.db.models import common
from clld.web.datatables.base import Col, IdCol, LinkCol, DetailsRowLinkCol, LinkToMapCol
from... | clld/grambank | grambank/datatables.py | Python | apache-2.0 | 12,065 |
# Convenience functions
def ind_max(x):
m = max(x)
return x.index(m)
# Need access to random numbers
import random
# Definitions of bandit arms
from arms.adversarial import *
from arms.bernoulli import *
from arms.normal import *
# Definitions of bandit algorithms
from algorithms.epsilon_greedy.standard import *... | SalemAmeen/BanditsBook | python/core.py | Python | mit | 657 |
import pytest
from xarray.backends.api import _get_default_engine
from . import requires_netCDF4, requires_scipy
@requires_netCDF4
@requires_scipy
def test__get_default_engine():
engine_remote = _get_default_engine("http://example.org/test.nc", allow_remote=True)
assert engine_remote == "netcdf4"
engin... | shoyer/xarray | xarray/tests/test_backends_api.py | Python | apache-2.0 | 569 |
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import FieldDoesNotExist
from django.core.exceptions import ImproperlyConfigured
from django.utils.timezone import now
from model_utils.managers import QueryManager... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/model_utils/models.py | Python | agpl-3.0 | 3,021 |
#!/usr/bin/env python
# Copyright (C) 2016 Swift Navigation Inc.
# Contact: Leith Bade <leith@swift-nav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOU... | mfine/piksi_tools | piksi_tools/settings.py | Python | lgpl-3.0 | 5,503 |
"""
Library for autotest-remote usage.
"""
import sys, os, re, traceback, signal, time, logging, getpass
try:
import autotest.common as common
except ImportError:
import common
from autotest.client.shared.global_config import global_config
require_atfork = global_config.get_config_value(
'AUTOSERV', ... | ColinIanKing/autotest | server/autoserv.py | Python | gpl-2.0 | 8,389 |
"""
Shutterfly Data Sink
"""
import logging
log = logging.getLogger("modules.Shutterfly")
import conduit
import conduit.utils as Utils
from conduit.datatypes import Rid
import conduit.dataproviders.Image as Image
import conduit.Exceptions as Exceptions
import conduit.datatypes.Photo as Photo
Utils.dataprovider_add_di... | GNOME/conduit | conduit/modules/ShutterflyModule/ShutterflyModule.py | Python | gpl-2.0 | 3,019 |
"""
:created: 17.09.2018 by Jens Diemer
:copyleft: 2018 by the django-cms-tools team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
from cms.models import Page
def get_public_cms_app_namespaces():
"""
:return: a tuple() with all cms app namespaces
... | jedie/django-cms-tools | django_cms_tools/fixture_helper/page_utils.py | Python | gpl-3.0 | 1,256 |
from __future__ import absolute_import, unicode_literals
import time
from collections import defaultdict
from django.db import models, connection
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from redis_cache import get_redis_connection
from temba.locations.models import Admin... | reyrodrigues/EU-SMS | temba/values/models.py | Python | agpl-3.0 | 27,551 |
default_app_config = 'iom.apps.IomConfig'
| acaciawater/iom | iom/__init__.py | Python | apache-2.0 | 42 |
###############################################################################
# Name: php.py #
# Purpose: Define PHP syntax for highlighting and other features #
# Author: Cody Precord <cprecord@editra.org> #
... | garrettcap/Bulletproof-Backup | wx/tools/Editra/src/syntax/_php.py | Python | gpl-2.0 | 30,232 |
import warnings
import numpy as np
import numpy.linalg as la
from scipy import sparse
from distutils.version import LooseVersion
from sklearn.utils.testing import assert_almost_equal, clean_warning_registry
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_array_equal... | dhruv13J/scikit-learn | sklearn/preprocessing/tests/test_data.py | Python | bsd-3-clause | 37,957 |
"""image.py - Various image manipulations."""
import gtk
from PIL import Image
from PIL import ImageEnhance
from PIL import ImageOps
from PIL import ImageStat
from preferences import prefs
def fit_in_rectangle(src, width, height, scale_up=False, rotation=0):
"""Scale (and return) a pixbuf so that it fits in a r... | yindian/Comix | src/image.py | Python | gpl-2.0 | 9,023 |
from django.contrib import admin
from .models import Password
admin.site.register(Password)
| bennylope/django-simple-auth | simple_auth/admin.py | Python | bsd-2-clause | 93 |
"""
Django settings for example_site project.
Generated by 'django-admin startproject' using Django 1.8.dev20150302062936.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settin... | furious-luke/django-address | example_site/example_site/settings.py | Python | bsd-3-clause | 3,436 |
from django.contrib import admin
from .models import Staff, Attendance, Team, Bank
admin.site.register(Staff)
admin.site.register(Attendance)
admin.site.register(Team)
admin.site.register(Bank)
| awemulya/fieldsight-kobocat | onadata/apps/staff/admin.py | Python | bsd-2-clause | 195 |
#!/usr/bin/env python
import datetime
import os
import re
from urllib import unquote
from django.conf import settings
from django.db.models import Count
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.utils.timezone import now
from livesettings import config_value
fro... | NUKnightLab/panda | client/views.py | Python | mit | 7,787 |
# encoding: utf-8
# module samba.dcerpc.drsblobs
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/drsblobs.so
# by generator 1.135
""" drsblobs DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class DsCompressedChunk(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs):... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/drsblobs/DsCompressedChunk.py | Python | gpl-2.0 | 1,282 |
# -*- 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
#... | adamhaney/airflow | airflow/operators/python_operator.py | Python | apache-2.0 | 17,890 |
from odoo import models, fields, api, _, exceptions
from odoo.addons.queue_job.job import job
from datetime import datetime, timedelta
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
auto_fatturapa_error = fields.Text(
string='Automatic E-invoice Error'
)
invoice_pec_jobs_id... | Comunitea/CMNT_004_15 | project-addons/auto_pec_it/models/account_invoice.py | Python | agpl-3.0 | 2,769 |
# -*- coding: utf-8 -*-
import math
from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt, ensure_csrf_cookie
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.core.paginator import Paginator
from django.core.paginator import ... | bluedazzle/django-angularjs-blog | app/myblog/views.py | Python | bsd-2-clause | 18,936 |
import csv
#Open a file stream and create a CSV writer object
f = open('test.csv', 'wb')
my_writer = csv.writer(f)
for i in range(1, 100):
my_writer.writerow([i, i-1])
f.flush()
f.close()
#The correct way!
with open('test1.csv', 'wb') as f:
my_writer = csv.writer(f)
for i in range(1, 100):
my_writer.wri... | mcdickenson/python-washu-2014 | day6/csvstuff.py | Python | mit | 922 |
from __future__ import unicode_literals
from fileCatcher import _FileCatcher
from utils.vss import _VSS
import os
class WindowsXPFiles(_FileCatcher):
def __init__(self, params):
super(WindowsXPFiles, self).__init__(params)
drive, p = os.path.splitdrive(self.systemroot)
self.vss = None
... | SekoiaLab/Fastir_Collector | filecatcher/windowsXPFiles.py | Python | gpl-3.0 | 975 |
import argparse
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torch_sparse import SparseTensor
import torch_geometric.transforms as T
from torch_geometric.nn import GCNConv, SAGEConv
from ogb.linkproppred import PygLinkPropPredDataset, Evaluator
from logger import Logger
... | snap-stanford/ogb | examples/linkproppred/collab/gnn.py | Python | mit | 10,548 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# HiPart is a program to analyze the electronic structure of molecules with
# fuzzy-atom partitioning methods.
# Copyright (C) 2007 - 2012 Toon Verstraelen <Toon.Verstraelen@UGent.be>
#
# This file is part of HiPart.
#
# HiPart is free software; you can redistribute it and/... | molmod/hipart | scripts/hi-multipoles.py | Python | gpl-3.0 | 1,074 |
# 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... | RobinQuetin/CAIRIS-web | cairis/cairis/DomainPropertiesDialog.py | Python | apache-2.0 | 3,046 |
from __future__ import unicode_literals
from __future__ import absolute_import
import os
import mock
from tests import unittest
from compose.cli import docker_client
class DockerClientTestCase(unittest.TestCase):
def test_docker_client_no_home(self):
with mock.patch.dict(os.environ):
del os... | bfirsh/fig | tests/unit/cli/docker_client_test.py | Python | apache-2.0 | 648 |
from Orange.data import Table, Variable, DiscreteVariable, ContinuousVariable
from Orange.data.continuizer import DomainContinuizer
from Orange.feature import transformation
import unittest
class Continuizer_Test(unittest.TestCase):
def setUp(self):
Variable._clear_cache()
self.data = Table("test4... | jzbontar/orange-tree | Orange/tests/test_continuizer.py | Python | gpl-3.0 | 16,080 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.