text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""
The MIT License (MIT)
Copyright (c) 2016 Daniele Linguaglossa <d.linguaglossa@mseclab.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation th... | mseclab/PyJFuzz | test/test_pjf_configuration.py | Python | mit | 2,126 | 0.001881 |
# This file is part of MyPaint.
# Copyright (C) 2007-2008 by Martin Renold <martinxyz@gmx.ch>
#
# 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 opt... | achadwick/mypaint | lib/tiledsurface.py | Python | gpl-2.0 | 42,966 | 0.000535 |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject
from otp.speedchat import SpeedChatGlobals
class DistributedScavengerHuntTarget(DistributedObject.DistributedObject):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedScavengerHuntTarget')
def _... | ksmit799/Toontown-Source | toontown/ai/DistributedScavengerHuntTarget.py | Python | mit | 1,518 | 0.001976 |
from __future__ import absolute_import
import os
import shutil
from qgis.PyQt import uic
from qgis.PyQt.QtGui import QIcon, QPixmap
from qgis.PyQt.QtWidgets import QDialog, QMessageBox
from os import path
from . import extra_sources
from .data_source_info import DataSourceInfo
from .data_source_serializer import Data... | nextgis/quickmapservices | src/ds_edit_dialog.py | Python | gpl-2.0 | 10,803 | 0.001574 |
"""log model admin."""
from django.contrib import admin
from django.db import models
from django.forms.widgets import TextInput
from apps.managers.challenge_mgr import challenge_mgr
from apps.managers.log_mgr.models import MakahikiLog
from apps.admin.admin import challenge_designer_site, challenge_manager_site, develop... | yongwen/makahiki | makahiki/apps/managers/log_mgr/admin.py | Python | mit | 1,266 | 0.00237 |
from ni.core.selection import Selection
from ni.core.text import char_pos_to_tab_pos
from ni.core.document import InsertDelta, DeleteDelta
class Action(object):
"""Base class for all view actions."""
def __init__(self, view):
self.grouped = False
self.editor = view.editor
self.view = ... | lerouxb/ni | actions/base.py | Python | mit | 6,191 | 0.002746 |
#!/usr/bin/env python
from glob import glob
from distutils.core import setup
setup( name="mythutils_recfail_alarm",
version="1.0",
description="Autoamtically notify on Recorder Failed via Prowl service",
author="Wylie Swanson",
author_email="wylie@pingzero.net",
url="http://www.pingzero.net",
scripts=glob("bin/... | wylieswanson/mythutils | mythutils_recfail_alarm/setup.py | Python | gpl-3.0 | 441 | 0.054422 |
##
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""
EasyBuild support for xlmpich compiler toolchain (includes IBM XL compilers (xlc, xlf) and MPICH).
@author: Jack Perdue <j-perdue@tamu.edu> - TAMU HPRC - http://sc.tamu.edu... | nesi/easybuild-framework | easybuild/toolchains/xlmvapich2.py | Python | gpl-2.0 | 573 | 0.001745 |
#from django.contrib import admin
from django.contrib.gis import admin
from modeltranslation.admin import TranslationAdmin, TranslationTabularInline
from django.contrib.contenttypes.generic import GenericTabularInline
from cigno.mdtools.models import Connection
from django.utils.translation import ugettext_lazy as _
fr... | CIGNo-project/CIGNo | cigno/metadata/admin.py | Python | gpl-3.0 | 16,379 | 0.01044 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016 CERN.
#
# Invenio 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... | hachreak/invenio-previewer | invenio_previewer/utils.py | Python | gpl-2.0 | 1,963 | 0 |
#########
# Copyright (c) 2014 GigaSpaces Technologies 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... | konradxyz/cloudify-manager | rest-service/manager_rest/test/test_provider_context.py | Python | apache-2.0 | 2,268 | 0 |
# -*- 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
#... | Fokko/incubator-airflow | tests/gcp/hooks/test_text_to_speech.py | Python | apache-2.0 | 2,693 | 0.001857 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .completion import Person
def test_person_suggests_on_all_variants_of_name(write_client):
Person.init(using=write_client)
Person(name='Honza Král', popularity=42).save(refresh=True)
s = Person.search().suggest('t', 'kra', completion={'... | 3lnc/elasticsearch-dsl-py | test_elasticsearch_dsl/test_integration/test_examples/test_completion.py | Python | apache-2.0 | 518 | 0.001938 |
#this module here is to compute the formula to calculate the new means and
#new variance.
def update(mean1, var1, mean2, var2):
new_mean = ((mean1 * var2) + (mean2*var1))/(var1 + var2)
new_var = 1/(1/var1 + 1/var2)
return [new_mean, new_var]
def predict(mean1, var1, mean2, var2):
new_mean = mea... | napjon/moocs_solution | robotics-udacity/2.4.py | Python | mit | 465 | 0.017204 |
"""Access and control log capturing."""
import logging
import os
import re
import sys
from contextlib import contextmanager
from io import StringIO
from pathlib import Path
from typing import AbstractSet
from typing import Dict
from typing import Generator
from typing import List
from typing import Mapping
from typing ... | nicoddemus/pytest | src/_pytest/logging.py | Python | mit | 29,805 | 0.001309 |
#! /usr/bin/env python
"""
this file converts simple html text into a docbook xml variant.
The mapping of markups and links is far from perfect. But all we
want is the docbook-to-pdf converter and similar technology being
present in the world of docbook-to-anything converters. """
from datetime import date
import ma... | rivimey/rwmapmaker | zziplib/docs/zzipdoc/htm2dbk.py | Python | gpl-3.0 | 7,044 | 0.017888 |
# Copyright 2013 Donald Stufft
#
# 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... | sigmavirus24/twine | twine/cli.py | Python | apache-2.0 | 2,154 | 0 |
"""Solvers of systems of polynomial equations. """
from sympy.polys import Poly, groebner, roots
from sympy.polys.polytools import parallel_poly_from_expr
from sympy.polys.polyerrors import (ComputationFailed,
PolificationFailed, CoercionFailed)
from sympy.utilities import postfixes
from sympy.simplify import rcol... | flacjacket/sympy | sympy/solvers/polysys.py | Python | bsd-3-clause | 9,192 | 0.001523 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('rh', '0001_initial'),
('estoque', '0005_auto_20141001_0953'),
('comercial', '0007_auto_20141006_1852'),
... | dudanogueira/microerp | microerp/almoxarifado/migrations/0004_auto_20141006_1957.py | Python | lgpl-3.0 | 6,177 | 0.004371 |
__author__ = "Martin Jakomin, Mateja Rojko"
"""
Classes for boolean operators:
- Var
- Neg
- Or
- And
- Const
Functions:
- nnf
- simplify
- cnf
- solve
- simplify_cnf
"""
import itertools
# functions
def nnf(f):
""" Returns negation normal form """
return f.nnf()
def simplify(f):
""" Simplifies th... | MartinGHub/lvr-sat | SAT/bool.py | Python | bsd-3-clause | 6,053 | 0.000991 |
from time import sleep
from tqdm import tqdm
import requests
url = "http://raw.githubusercontent.com/Alafazam/lecture_notes/master/Cormen%20.pdf"
response = requests.get(url, stream=True)
with open("10MB", "wb") as handle:
total_length = int(response.headers.get('content-length'))/1024
for data in tqdm(response.it... | Alafazam/simple_projects | misc/test_tqdm.py | Python | mit | 615 | 0.011382 |
from mock import patch
from tests import BaseTestCase
from redash.tasks import refresh_schemas
class TestRefreshSchemas(BaseTestCase):
def test_calls_refresh_of_all_data_sources(self):
self.factory.data_source # trigger creation
with patch(
"redash.tasks.queries.maintenance.refresh_s... | alexanderlz/redash | tests/tasks/test_refresh_schemas.py | Python | bsd-2-clause | 934 | 0 |
from pymongo import MongoClient
from passlib.app import custom_app_context as pwd
client = MongoClient( host = "db" )
ride_sharing = client.ride_sharing
users = ride_sharing.users
users.insert_one( {
'username' : 'sid',
'password_hash' : pwd.encrypt( 'test' ),
'role' : 'driver' } )
| sidthakur/simple-user-management-api | user_auth/app/create_db.py | Python | gpl-3.0 | 299 | 0.040134 |
"""This module prints lists that may or may not contain nested lists"""
def print_lol(the_list):
"""This function takes a positional argument: called "the_list", which is any
Python list which may include nested lists. Each data item in the provided lists
recursively printed to the screen on its own line."... | tdean1995/HFPythonSandbox | dist/nester/nester.py | Python | apache-2.0 | 481 | 0.008316 |
import os
import PIL
import math
import PIL
from PIL import Image
class MandelbrotImage:
def __init__(self, folder):
self.folder = folder
self.data_folder = os.path.join(folder, 'data')
self.image_folder = os.path.join(folder, 'image')
if not os.path.isdir(self.image_folder):
os.makedirs(self.image_fo... | alansammarone/mandelbrot | mandelbrot_image.py | Python | gpl-3.0 | 2,037 | 0.025037 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Intangible()
result.template = "object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_durati... | anhstudios/swganh | data/scripts/templates/object/draft_schematic/bio_engineer/bio_component/shared_bio_component_food_duration_2.py | Python | mit | 470 | 0.046809 |
'''
Created on Jan 19, 2013
@author: dsnowdon
'''
import os
import tempfile
import datetime
import json
import logging
from naoutil.jsonobj import to_json_string, from_json_string
from naoutil.general import find_class
import robotstate
from event import *
from action import *
from naoutil.naoenv import make_enviro... | davesnowdon/nao-wanderer | wanderer/src/main/python/wanderer/wanderer.py | Python | gpl-2.0 | 14,410 | 0.005968 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('attivita', '0012_attivita_centrale_operativa'),
]
operations = [
migrations.AddField(
model_name='partecipazione... | CroceRossaItaliana/jorvik | attivita/migrations/0013_partecipazione_centrale_operativa.py | Python | gpl-3.0 | 448 | 0 |
# -*- coding: utf-8 -*-
#
# RERO ILS
# Copyright (C) 2019 RERO
# Copyright (C) 2020 UCLouvain
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program ... | rero/reroils-app | rero_ils/modules/organisations/api.py | Python | gpl-2.0 | 7,019 | 0 |
import numpy as np
from rdkit.Chem import MolFromSmiles
from features import atom_features, bond_features
degrees = [0, 1, 2, 3, 4, 5]
class MolGraph(object):
def __init__(self):
self.nodes = {} # dict of lists of nodes, keyed by node type
def new_node(self, ntype, features=None, rdkit_ix=None):
... | HIPS/neural-fingerprint | neuralfingerprint/mol_graph.py | Python | mit | 3,492 | 0.002864 |
import csv
import operator
import itertools
import math
import logger1
import re
#main piece of code for calculating & wwriting alignments from processed data
def calculateAlignments(utterances, markers, smoothing, outputFile, shouldWriteHeader, corpusType='CHILDES'):
markers = checkMarkers(markers)
groupedUtterance... | langcog/alignment | parsers/alignment.py | Python | gpl-2.0 | 7,365 | 0.035709 |
__all__ = ['deque', 'defaultdict', 'namedtuple', 'UserDict', 'UserList',
'UserString', 'Counter', 'OrderedDict', 'ChainMap']
# For backwards compatibility, continue to make the collections ABCs
# available through the collections module.
from _collections_abc import *
import _collections_abc
__all__... | Orav/kbengine | kbe/src/lib/python/Lib/collections/__init__.py | Python | lgpl-3.0 | 43,096 | 0.003202 |
#!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Test proper accounting with an equivalent malleability clone
#
from test_framework.test_framework im... | wiggi/huntercore | qa/rpc-tests/txn_clone.py | Python | mit | 7,555 | 0.006353 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/modeling/config/initialize_fit.py | Python | mit | 1,745 | 0.005161 |
#!/usr/bin/env python2.7
"""Docker From Scratch Workshop - Level 4: Add overlay FS.
Goal: Instead of re-extracting the image, use it as a read-only layer
(lowerdir), and create a copy-on-write layer for changes (upperdir).
HINT: Don't forget that overlay fs also requires a workdir.
Read more on overlay FS here... | Fewbytes/rubber-docker | levels/04_overlay/rd.py | Python | mit | 5,063 | 0 |
#!usr/bin/env python
# -*- coding: utf-8! -*-
from collections import Counter, OrderedDict
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.cluster.hierarchy import ward, dendrogram
from sklearn.decomposition import PCA
from sklearn.metrics.pairwise import euclidean_distances
from s... | mikekestemont/beckett | code/analysis.py | Python | mit | 6,372 | 0.007062 |
from pycipher import Vigenere
import unittest
class TestVigenere(unittest.TestCase):
def test_encipher(self):
keys = ('GERMAN',
'CIPHERS')
plaintext = ('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz',
'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz... | jameslyons/pycipher | tests/test_vigenere.py | Python | mit | 1,247 | 0.008019 |
import unicodecsv
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.utils.encoding import force_text
from six.moves import map
from oioioi.base.permissions import make_request_condition
from oioioi.base.utils import request_cached
from oioioi.participants.controllers import P... | sio2project/oioioi | oioioi/participants/utils.py | Python | gpl-3.0 | 6,045 | 0.000496 |
"""
Support for Tellstick lights.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.tellstick/
"""
from homeassistant.components import tellstick
from homeassistant.components.light import ATTR_BRIGHTNESS, Light
from homeassistant.components.tellstick... | justyns/home-assistant | homeassistant/components/light/tellstick.py | Python | mit | 3,211 | 0 |
import json
import hashlib
from django.db import models
from django.db.models import Count, Func
from django.contrib.postgres.fields import ArrayField
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
from django.utils.translation import gettext_lazy as _
# from social.apps.django_app.default.mod... | pashinin-com/pashinin.com | src/core/models.py | Python | gpl-3.0 | 22,154 | 0.000045 |
from .widget_svg_layout import SVGLayoutBox
from .widget_fullscreen import FullscreenBox | openseat/ipylayoutwidgets | ipylayoutwidgets/widgets/__init__.py | Python | bsd-3-clause | 88 | 0.011364 |
"""
WSGI config for Bilyric project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` ... | cuongnb14/bilyric | config/wsgi.py | Python | mit | 1,707 | 0 |
# Copyright 2016-2017 Capital One Services, LLC
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
import logging
from botocore.exceptions import ClientError
import mock
from c7n.exceptions import PolicyValidationError
from c7n.executor import MainThreadExecutor
from c7n.resources.aws impo... | capitalone/cloud-custodian | tests/test_ebs.py | Python | apache-2.0 | 25,361 | 0.000789 |
# -*- coding: utf-8 -*-
__all__ = ['host_blueprint']
from datetime import datetime, timedelta
# dateutil
from dateutil.parser import parse as dtparse
# flask
from flask import (
Flask, request, session, g,
redirect, url_for, abort,
render_template, flash, jsonify,
Blueprint, abort,
send_from_direc... | mtasic85/dockyard | host.py | Python | mit | 5,231 | 0.006117 |
# -*- encoding:utf-8 -*-
"""
交易执行代理模块
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from contextlib import contextmanager
from functools import total_ordering
from enum import Enum
import numpy as np
import pandas as pd
from . import ABuTradeDra... | bbfamily/abu | abupy/TradeBu/ABuTradeProxy.py | Python | gpl-3.0 | 14,496 | 0.001752 |
from tabulate import tabulate
class Response():
message = None;
data = None;
def print(self):
if self.message:
if type(self.message) == "str":
print(self.message)
elif type(self.message) == "list":
for message in self.message:
... | mozey/taskmage | taskmage/response.py | Python | mit | 557 | 0.008977 |
import rply
from ..lexer import lexers
__all__ = ('parsers',)
class Parsers(object):
def __init__(self):
self._fpg = None
self._fp = None
self._spg = None
self._sp = None
@property
def fpg(self):
if self._fpg is None:
self._fpg = rply.ParserGenerato... | funkybob/rattle | rattle/parser/__init__.py | Python | mit | 1,048 | 0 |
# -*- coding: utf-8 -*-
# (C) 2017 Muthiah Annamalai
# This file is part of open-tamil examples
# This code is released under public domain
import joblib
# Ref API help from : https://scikit-learn.org
import numpy as np
import random
import string
import time
from sklearn.metrics import accuracy_score
from sklearn.met... | Ezhil-Language-Foundation/open-tamil | examples/classifier/modelprocess2.py | Python | mit | 3,817 | 0.001339 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1beta1/services/vizier_service/transports/grpc_asyncio.py | Python | apache-2.0 | 29,300 | 0.001365 |
"""Response classes used by urllib.
The base class, addbase, defines a minimal file-like interface,
including read() and readline(). The typical response object is an
addinfourl instance, which defines an info() method that returns
headers and a geturl() method that returns the url.
"""
class addbase(object):
""... | lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/python-core-3.3.0/lib/urllib/response.py | Python | lgpl-3.0 | 3,021 | 0.001324 |
import json
from django.db.models import Q, Subquery
from django.core.management.base import BaseCommand
from readthedocs.oauth.models import RemoteRepository
from readthedocs.oauth.services import registry
from readthedocs.oauth.services.base import SyncServiceError
from readthedocs.projects.models import Project
fr... | rtfd/readthedocs.org | readthedocs/oauth/management/commands/reconnect_remoterepositories.py | Python | mit | 4,783 | 0.002091 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Remember to use orm['appname.ModelName'] rather than "from appname.mo... | grnet/synnefo | snf-cyclades-app/synnefo/db/migrations/old/0080_nics_to_ips.py | Python | gpl-3.0 | 20,524 | 0.008234 |
import logging, openravepy, prpy
from prpy.action import ActionMethod
from prpy.planning.base import PlanningError
from contextlib import contextmanager
logger = logging.getLogger('herbpy')
@ActionMethod
def Grasp(robot, obj, manip=None, preshape=[0., 0., 0., 0.],
tsrlist=None, render=True, **kw_args):
... | mharding01/herbpy | src/herbpy/action/grasping.py | Python | bsd-3-clause | 9,013 | 0.005658 |
import pygame
import src.graphics as graphics
import src.colours as colours
import src.config as config
import src.scenes.scenebase as scene_base
from src.minigames.hunt.input_handler import InputHandler
from src.gui.clickable import Clickable
from src.resolution_asset_sizer import ResolutionAssetSizer
from src.tiled_m... | joereynolds/Mr-Figs | src/minigames/hunt/game.py | Python | gpl-3.0 | 2,622 | 0.002288 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import request
from indico.modules.auth.controllers import (RHAccounts, RHAdminImpersonate, RH... | indico/indico | indico/modules/auth/blueprint.py | Python | mit | 2,168 | 0.005996 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.contrib.auth.models import Group, User
def add_moderator_group(apps, schema_editor):
g = Group.objects.create(name="moderators")
g.save()
for user in User.objects.all():
# add any existing... | DemocracyClub/EveryElection | every_election/apps/core/migrations/0001_initial.py | Python | bsd-3-clause | 621 | 0 |
import nuke
import pyblish.api
class ExtractSceneSave(pyblish.api.Extractor):
"""
"""
hosts = ['nuke']
order = pyblish.api.Extractor.order - 0.45
families = ['scene']
label = 'Scene Save'
def process(self, instance):
self.log.info('saving scene')
nuke.scriptSave()
| mkolar/pyblish-kredenc | pyblish_kredenc/plugins/nuke/extract_scene_save.py | Python | lgpl-3.0 | 313 | 0 |
"""Responses."""
from io import StringIO
from csv import DictWriter
from flask import Response, jsonify, make_response
from .__version__ import __version__
class ApiResult:
"""A representation of a generic JSON API result."""
def __init__(self, data, metadata=None, **kwargs):
"""Store input argumen... | jkpr/pma-api | pma_api/response.py | Python | mit | 3,061 | 0 |
# -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
def related_activities(project):
... | akvo/akvo-rsr | akvo/iati/checks/fields/related_activities.py | Python | agpl-3.0 | 1,444 | 0.003463 |
from formatting import print_call
import credentials
import os.path
import re
import xmlrpclib
def _get_ch_params():
# Initialise variables when required
from core.config import FullConfParser
fcp = FullConfParser()
username = fcp.get("auth.conf").get("certificates").get("username")
ch_host = fcp... | ict-felix/stack | modules/resource/orchestrator/src/core/utils/calls.py | Python | apache-2.0 | 6,238 | 0.00016 |
from twisted.internet import reactor,protocol
class EchoClient(protocol.Protocol):
def connectionMade(self):
self.transport.write("hello a ")
def dataReceived(self, data):
print('Server said:',data)
self.transport.loseConnection()
def connectionLost(self, reason):
print('con... | XiaJieCom/change | Demo/days10/EchoClient.py | Python | lgpl-2.1 | 658 | 0.018237 |
# -*- coding: utf-8 -*-
"""The function module of dolfin"""
from dolfin.functions import multimeshfunction
from dolfin.functions import functionspace
from dolfin.functions import function
from dolfin.functions import constant
from dolfin.functions import expression
from dolfin.functions import specialfunctions
from .... | FEniCS/dolfin | site-packages/dolfin/functions/__init__.py | Python | lgpl-3.0 | 827 | 0.001209 |
from pyramid.view import view_config
import logging
@view_config(route_name='hello_json', renderer='json')
def hello_json(request):
logger = logging.getLogger(__name__)
logger.info("Got JSON from name: {n}".format(n = __name__))
request.session['counter'] = request.session.get('counter', 0) + 1
return ... | jgowans/directionFinder_web | directionFinder_web/views/hello_json.py | Python | gpl-2.0 | 400 | 0.0125 |
#!/usr/bin/env python
"""
File: twitter_analyse.py
Author: Me
Email: 0
Github: 0
Description: Analyse tweets. For the detail, please refer to the document
```twitter_analyse.notes```
"""
# System lib
from __future__ import division
import json
import os
from math import log
import numpy
# 3-rd party lib
# import nltk... | mondwan/ProjectRazzies | twitter_analyse.py | Python | mit | 9,448 | 0.004128 |
# coding=utf-8
"""
Impact Layer Merge Dialog.
.. 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.
"""
__... | dynaryu/inasafe | safe/gui/tools/minimum_needs/needs_manager_dialog.py | Python | gpl-3.0 | 33,744 | 0 |
# Copyright 2020 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | stanley-cheung/grpc | src/python/grpcio_tests/tests_aio/unit/_common.py | Python | apache-2.0 | 3,617 | 0 |
# Copyright (c) 2010 Cloud.com, Inc
# Copyright 2012 Cloudbase Solutions Srl
# 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/... | vmturbo/nova | nova/virt/hyperv/vmops.py | Python | apache-2.0 | 48,910 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" cluster.py
Cluster functionality
"""
import os
import time
import logging
import subprocess as sb
from datetime import datetime
from .dax_settings import DAX_Settings
from .errors import ClusterError
__copyright__ = 'Copyright 2013 Vanderbilt University. All Right... | VUIIS/dax | dax/cluster.py | Python | mit | 11,384 | 0 |
import argparse
from cheat_ext.info import info, ls
from cheat_ext.installer import (
install, upgrade, remove
)
from cheat_ext.linker import link, unlink
def _install(args):
install(args.repository)
link(args.repository)
def _upgrade(args):
upgrade(args.repository)
link(args.repository)
def ... | chhsiao90/cheat-ext | cheat_ext/main.py | Python | mit | 1,279 | 0 |
from datetime import datetime
from os.path import abspath, join, dirname
import alabaster
# Alabaster theme + mini-extension
html_theme_path = [alabaster.get_path()]
extensions = ['alabaster', 'sphinx.ext.intersphinx', 'sphinx.ext.doctest']
# Paths relative to invoking conf.py - not this shared file
html_theme = 'al... | mkusz/invoke | sites/shared_conf.py | Python | bsd-2-clause | 1,189 | 0 |
# -*- coding: utf8 -*-
'''
Copyright 2009 Denis Derman <denis.spir@gmail.com> (former developer)
Copyright 2011-2012 Peter Potrowl <peter017@gmail.com> (current developer)
This file is part of Pijnu.
Pijnu is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public Lic... | peter17/pijnu | samples/wikiLine.py | Python | gpl-3.0 | 2,097 | 0.007153 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py | Python | mit | 31,820 | 0.004431 |
# -*- coding: utf-8 -*-
import logging, logging.handlers
from django.conf import settings
def get_logger(name, level=logging.INFO, format='[%(asctime)s] %(message)s', handler=None, filename=None):
new_logger = logging.getLogger(name)
new_logger.setLevel(level)
if not handler:
filename = filename... | leliel12/handy | handy/logger.py | Python | bsd-3-clause | 733 | 0.006821 |
class Solution:
def containVirus(self, grid: List[List[int]]) -> int:
current_set_number = 1
grid_set = [[0 for i in range(len(grid[0]))] for j in range(len(grid))]
set_grid = {}
threaten = {}
def getAdjacentCellsSet(row, col) -> List[int]:
answer = []
... | jianjunz/online-judge-solutions | leetcode/0750-contain-virus.py | Python | mit | 5,673 | 0.000705 |
import copy
from .point import Point
from .misc import *
'''
Line is defined using two point(s).
'''
class Line(object):
_ID_NAME = '_LINE_ID'
_DB_NAME = '_EXISTING_LINES'
def __init__(self, geom, p0, p1):
def check(p):
if geom is None: return p
if isinstance(p, Point):
... | BV-DR/foamBazar | pythonScripts/gmshScript/line.py | Python | gpl-3.0 | 2,331 | 0.014586 |
#!/usr/bin/env python2
# Copyright (C) 2013-2014 Computer Sciences Corporation
#
# 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
#
#... | infochimps-forks/ezbake-common-python | support/django/setup.py | Python | apache-2.0 | 1,200 | 0.000833 |
#!/usr/bin/env python
# encoding: utf-8
"""An example for a function returning a function"""
def surround(tag1, tag2):
def wraps(content):
return '{}{}{}'.format(tag1, content, tag2)
return wraps
def printer(content, transform):
return transform(content)
print printer("foo bar", surround("<a>", ... | prodicus/dabble | python/decorators/decorate_with_tags.py | Python | mit | 381 | 0.010499 |
"""Module containing the logic for our debugging logic."""
from __future__ import print_function
import json
import platform
import setuptools
def print_information(option, option_string, value, parser,
option_manager=None):
"""Print debugging information used in bug reports.
:param o... | vicky2135/lucious | oscar/lib/python2.7/site-packages/flake8/main/debug.py | Python | bsd-3-clause | 2,017 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-01 23:15
import autoslug.fields
import common.utils
import datetime
from django.conf import settings
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
import... | PersonalGenomesOrg/open-humans | private_sharing/migrations/0001_squashed_0034_auto_20160727_2138.py | Python | mit | 14,678 | 0.002861 |
from setuptools import setup, find_packages
setup(
name="simple-crawler",
version="0.1",
url="https://github.com/shonenada/crawler",
author="shonenada",
author_email="shonenada@gmail.com",
description="Simple crawler",
zip_safe=True,
platforms="any",
packages=find_packages(),
i... | shonenada/crawler | setup.py | Python | mit | 359 | 0 |
# -*- mode: python -*-
# -*- coding: iso8859-15 -*-
##############################################################################
#
# Gestion scolarite IUT
#
# Copyright (c) 2001 - 2006 Emmanuel Viennet. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the term... | denys-duchier/Scolar | notes_users.py | Python | gpl-2.0 | 1,115 | 0 |
import numpy as np
from ss_generator import geometry
from . import basic
D_MEAN = 3.81
D_STD = 0.02
THETA_MEAN = np.radians(91.8)
THETA_STD = np.radians(3.35)
TAU_MEAN = np.radians(49.5)
TAU_STD = np.radians(7.1)
def theta_tau_to_rotation_matrix(theta, tau):
'''Get the rotation matrix corresponding to the
bo... | xingjiepan/ss_generator | ss_generator/ca_tracing/alpha_helix.py | Python | bsd-3-clause | 11,909 | 0.005458 |
from common.models import *
from common.localization import txt, verbose_names
@verbose_names
class Patient(models.Model):
# private
first_name = models.CharField(max_length=80)
last_name = models.CharField(max_length=80)
GENDER = (
(txt('M'), txt('male')),
(txt('F'), txt('female'))
... | wesolutki/voter | auth/models.py | Python | gpl-3.0 | 2,125 | 0.000471 |
# Generated by Django 2.2.15 on 2020-11-24 06:44
from decimal import Decimal
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("assignments", "0015_assignmentvote_delegated_user"),
]
operations = [
migrations... | FinnStutzenstein/OpenSlides | server/openslides/assignments/migrations/0016_negative_votes.py | Python | mit | 2,395 | 0.000418 |
# -*- coding: utf-8 -*-
'''
Created on 25 April 2014
@author: Kimon Tsitsikas
Copyright © 2013-2014 Kimon Tsitsikas, Delmic
This file is part of Odemis.
Odemis 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
F... | gstiebler/odemis | src/odemis/acq/test/spot_alignment_test.py | Python | gpl-2.0 | 10,396 | 0.002982 |
#!/usr/bin/env python3
"""
Created on 15 Aug 2016
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
Note: this script uses the Pt1000 temp sensor for temperature compensation.
"""
import time
from scs_core.data.json import JSONify
from scs_core.gas.afe_baseline import AFEBaseline
from scs_core.gas.afe_ca... | south-coast-science/scs_dfe_eng | tests/gas/afe/afe_test.py | Python | mit | 2,350 | 0.000426 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-20 01:22
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0002_auto_20170819_2342'),
]
operations = [
migrations.RemoveField(
... | rcatlin/ryancatlin-info | Api/app/migrations/0003_remove_tag_articles.py | Python | mit | 388 | 0 |
from django.db import models
from django.core.validators import validate_email, validate_slug, validate_ipv46_address
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from ava.core.models import TimeStampedModel
from ava.core_group.models import Group
from ava.core_identi... | cnbird1999/ava | ava/core_identity/models.py | Python | gpl-2.0 | 4,406 | 0.001816 |
# Copyright 2011 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 l... | sebrandon1/nova | nova/tests/unit/test_cinder.py | Python | apache-2.0 | 9,333 | 0.000107 |
# SPDX-License-Identifier: LGPL-3.0-only
"""Base classes and decorators for the doorstop.core package."""
import abc
import functools
import os
from typing import Dict
import yaml
from doorstop import common, settings
from doorstop.common import DoorstopError, DoorstopInfo, DoorstopWarning
log = common.logger(__na... | jacebrowning/doorstop | doorstop/core/base.py | Python | lgpl-3.0 | 11,112 | 0 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'ex48',
'author': 'Zhao, Li',
'url': 'URL to get it at.',
'download_url': 'Where to download it.',
'author_email': 'zhaoace@gmail.com',
'version': '0.1',
'ins... | zhaoace/codecraft | python/projects/learnpythonthehardway.org/ex48/setup.py | Python | unlicense | 434 | 0.002304 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2013 IBM Corp
#
# Author: Tong Li <litong01@us.ibm.com>
#
# 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/LICEN... | tanglei528/ceilometer | ceilometer/tests/dispatcher/test_file.py | Python | apache-2.0 | 3,762 | 0 |
#!/usr/bin/env python
import os
import sys
from optparse import OptionParser
def makeoptions():
parser = OptionParser()
parser.add_option("-v", "--verbosity",
type = int,
action="store",
dest="verbosity",
default=1,
... | strogo/djpcms | runtests.py | Python | bsd-3-clause | 722 | 0.012465 |
import tensorflow as tf
import numpy as np
import cv2
img_original = cv2.imread('jack.jpg') #data.camera()
img = cv2.resize(img_original, (64*5,64*5))
# for positions
xs = []
# for corresponding colors
ys = []
for row_i in range(img.shape[0]):
for col_i in range(img.shape[1]):
xs.append([row_i, col_i])
ys.app... | iamharshit/ML_works | Photo Painter/NN.py | Python | mit | 2,722 | 0.013226 |
from django import forms
from django.core.urlresolvers import reverse
from django.forms.widgets import RadioFieldRenderer
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.utils.safestring import mark_safe
class BootstrapChoiceFieldRenderer(RadioFieldRenderer):
"""... | alirizakeles/tendenci | tendenci/apps/events/widgets.py | Python | gpl-3.0 | 4,968 | 0.00161 |
# Prints exactly what the script is about to do
print "How many keys are there for the swedish alphabet?"
# Prints the amount of the top row
print "The top row has 11 letter keys"
# Assigns a value to top
top = 11.0
# Prints the amount of the middle row
print "The middle row has 11 letter keys"
# Assigns a value to... | seravok/LPTHW | StudyDrillMath.py | Python | gpl-3.0 | 590 | 0 |
import py
import re
from testing.test_interpreter import BaseTestInterpreter
from testing.test_main import TestMain
from hippy.main import entry_point
class TestOptionsMain(TestMain):
def test_version_compare(self, capfd):
output = self.run('''<?php
$versions = array(
'1',
'1.0',
... | xhava/hippyvm | testing/test_options.py | Python | mit | 3,254 | 0.001537 |
"""
Unit tests for the base mechanism class.
"""
import pytest
from azmq.mechanisms.base import Mechanism
from azmq.errors import ProtocolError
@pytest.mark.asyncio
async def test_expect_command(reader):
reader.write(b'\x04\x09\x03FOOhello')
reader.seek(0)
result = await Mechanism._expect_command(reade... | ereOn/azmq | tests/unit/test_mechanisms/test_base.py | Python | gpl-3.0 | 2,577 | 0 |
# -*- coding: utf8 -*-
from phystricks import *
def MBWHooeesXIrsz():
pspict,fig = SinglePicture("MBWHooeesXIrsz")
pspict.dilatation(0.3)
l=4
A=Point(0,0)
B=Point(l,0)
C=Point(l,l)
trig=Polygon(A,B,C)
trig.put_mark(0.2,pspict=pspict)
trig.edges[0].put_code(n=2,d=0.1,l=0.2,pspict=ps... | LaurentClaessens/phystricks | testing/demonstration/phystricksMBWHooeesXIrsz.py | Python | gpl-3.0 | 563 | 0.039146 |
#!/usr/bin/env python3
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | manxueitp/cozmo-test | cozmo_sdk_examples/if_this_then_that/ifttt_gmail.py | Python | mit | 6,646 | 0.003624 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.