code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import uuid
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUI... | Connexions/cnx-user | cnxuser/_sqlalchemy.py | Python | agpl-3.0 | 1,342 |
from ..models import Post, Category, Tag
from django.db.models.aggregates import Count
from django import template
register = template.Library()
# 最近文章
@register.simple_tag
def get_recent_posts(num=9):
return Post.objects.all().order_by('-modified_time')[:num]
# 按月归档
@register.simple_tag
def archi... | RewrZ/RewrZ | rewrz/blog/templatetags/blog_tags.py | Python | agpl-3.0 | 698 |
"""
Views for the verification flow
"""
import json
import logging
import decimal
from mitxmako.shortcuts import render_to_response
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseRedirect
from django.shortcuts im... | TsinghuaX/edx-platform | lms/djangoapps/verify_student/views.py | Python | agpl-3.0 | 12,961 |
# -*- coding: utf-8 -*-
# Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
from odoo.tools import safe_eval
class DeliveryCarrier(models.Model):
_inherit = 'delivery.carrier'
@api.multi
def get_price_ava... | OCA/carrier-delivery | delivery_price_by_category/models/delivery_carrier.py | Python | agpl-3.0 | 2,275 |
import time
import uuid as uuid
from splinter.browser import Browser
from django.contrib.auth.models import User
from webparticipation.apps.ureporter.models import Ureporter
from webparticipation.apps.ureport_auth.models import PasswordReset
def before_all(context):
context.browser = Browser('chrome')
time.sle... | rapidpro/ureport-web-participation | features/environment.py | Python | agpl-3.0 | 1,127 |
# -*- coding: utf-8 -*-
from nose.tools import raises
from openfisca_core import periods
from openfisca_core.columns import IntCol
from openfisca_core.formulas import CycleError, SimpleFormulaColumn
from openfisca_core.tests import dummy_country
from openfisca_core.tests.dummy_country import Individus, reference_for... | adrienpacifico/openfisca-core | openfisca_core/tests/test_cycles.py | Python | agpl-3.0 | 5,495 |
from django.test import TestCase
from django.views.generic import TemplateView
from django.contrib.contenttypes.models import ContentType
from jsonattrs import models, mixins
from . import factories
class XLangLabelsTest(TestCase):
def test_dict(self):
res = mixins.template_xlang_labels({'en': 'Field 1'... | Cadasta/django-jsonattrs | tests/test_mixins.py | Python | agpl-3.0 | 6,431 |
import json as json_
# Template for code 200 requests so data can easily be added
def ok(d=None, *, json=True):
code = {'code': 200, 'status': 'OK', 'data': d}
if json:
code = json_.dumps(code)
return code
# The 400 codes shouldn't require any special aruments.
def invalid_request(*, json=True):... | TacticAlpha/basic-lan-webserver | server/status.py | Python | agpl-3.0 | 938 |
"""URLs to run the tests."""
try:
from django.urls import include
except ImportError:
from django.conf.urls import include
from django.conf.urls import url
from django.contrib import admin
admin.autodiscover()
urlpatterns = (
url(r'^admin/', admin.site.urls),
url(r'^status', include('server_status.url... | mitodl/django-server-status | server_status/tests/urls.py | Python | agpl-3.0 | 328 |
from django.conf import settings
def posthog_configurations(request):
return {
'POSTHOG_API_KEY': settings.POSTHOG_API_KEY,
'POSTHOG_API_URL': settings.POSTHOG_API_URL,
}
| pythonprobr/pythonpro-website | pythonpro/analytics/context_processors.py | Python | agpl-3.0 | 197 |
"""Add replies column
Revision ID: 3b0d1321079e
Revises: 1e2d77a2f0c4
Create Date: 2021-11-03 23:32:15.720557
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "3b0d1321079e"
down_revision = "1e2d7... | cgwire/zou | zou/migrations/versions/3b0d1321079e_.py | Python | agpl-3.0 | 799 |
"""Monitor the transaction log for changes that should be synced back to the
account backend.
TODO(emfree):
* Track syncback failure/success state, and implement retries
(syncback actions may be lost if the service restarts while actions are
still pending).
* Add better logging.
"""
import gevent
from sqlalche... | rmasters/inbox | inbox/transactions/actions.py | Python | agpl-3.0 | 3,454 |
# -*- coding: utf-8 -*-
#
# 2016-05-07 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add realm dropdown
# 2016-04-06 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add time dependency in policy
# 2016-02-22 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add RADI... | jalr/privacyidea | privacyidea/lib/policy.py | Python | agpl-3.0 | 57,193 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Bezleputh
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your opt... | frankrousseau/weboob | modules/explorimmo/pages.py | Python | agpl-3.0 | 7,242 |
"""
Django module container for classes and operations related to the "Course Module" content type
"""
import logging
from cStringIO import StringIO
from lxml import etree
from path import Path as path
from pytz import utc
import requests
from datetime import datetime
from lazy import lazy
from xmodule import course_m... | nttks/edx-platform | common/lib/xmodule/xmodule/course_module.py | Python | agpl-3.0 | 61,092 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-bom | csv_setup_inventory_delta/delta.py | Python | agpl-3.0 | 7,673 |
# -*- coding: utf-8 -*-
# Copyright 2018, Esther Cisneros
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import timedelta
from openerp import _, api, fields, models
from openerp.exceptions import UserError
class AccountInvoice(models.Model):
_name = 'account.invoice'
_inh... | Gebesa-Dev/Addons-gebesa | account_invoice_replace/models/account_invoice_replace.py | Python | agpl-3.0 | 12,245 |
import functools
from itertools import combinations
from bears.c_languages.ClangBear import clang_available, ClangBear
from bears.c_languages.codeclone_detection.ClangCountingConditions import (
condition_dict)
from bears.c_languages.codeclone_detection.ClangCountVectorCreator import (
ClangCountVectorCreator)... | refeed/coala-bears | bears/c_languages/codeclone_detection/ClangFunctionDifferenceBear.py | Python | agpl-3.0 | 8,616 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.conf import se... | suutari/shoop | shuup/notify/models/notification.py | Python | agpl-3.0 | 4,222 |
# Copyright 2014-2017 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# Copyright 2018-2019 Sergio Teruel <sergio.teruel@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.fields import first
class StockPicking(models.Model):
_inherit = 'stock... | Vauxoo/stock-logistics-workflow | stock_picking_show_return/models/stock_picking.py | Python | agpl-3.0 | 1,320 |
import shutil
from pprint import pprint
import pandas as pd
import csv
import pickle
import inspect, os
import requests
from os import listdir
import numpy as np
import subprocess
from luigi import six
from sklearn.decomposition import NMF
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
fro... | felipegerard/arte_mexicano_antiguo | montactuaria/Analisis_access_log/luigi/ functions/functions.py | Python | agpl-3.0 | 362 |
# -*- coding: utf-8 -*-
# Copyright 2015-2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import mock
from odoo.addons.connector_carepoint.models import account_invoice_line
from ..common import SetUpCarepointBase
model = 'odoo.addons.connector_carepoint.models.account_invoice... | laslabs/odoo-connector-carepoint | connector_carepoint/tests/models/test_account_invoice_line.py | Python | agpl-3.0 | 19,528 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# 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
#... | MostlyOpen/odoo_addons | myo_person_mng/models/person_mng.py | Python | agpl-3.0 | 3,872 |
""" Form widget classes """
from __future__ import absolute_import
from django.conf import settings
from django.forms.utils import flatatt
from django.forms.widgets import CheckboxInput
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.u... | ESOedX/edx-platform | openedx/core/djangoapps/api_admin/widgets.py | Python | agpl-3.0 | 1,985 |
# -*- coding: utf-8 -*-
import pandas as pd
import sys
from builtins import str as text
from utils import find_zipcode, str2date
header_mapping = {
'origin': 'ORIGIN',
'company_name': 'LABO',
'lastname_firstname': 'BENEF_PS_QUALITE_NOM_PRENOM',
'address': 'BENEF_PS_ADR',
'job': 'BENEF_PS_QUALIFIC... | regardscitoyens/sunshine-data | scripts/format_pharmaciens.py | Python | agpl-3.0 | 1,072 |
# coding: utf-8
# maposmatic, the web front-end of the MapOSMatic city map generation system
# Copyright (C) 2009 David Decotigny
# Copyright (C) 2009 Frédéric Lehobey
# Copyright (C) 2009 Pierre Mauduit
# Copyright (C) 2009 David Mentré
# Copyright (C) 2009 Maxime Petazzoni
# Copyright (C) 2009 Thomas Petazzoni... | hholzgra/maposmatic | www/maposmatic/views.py | Python | agpl-3.0 | 26,128 |
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from pathlib import Path
from flask import (Flask, session, redirect, url_for, flash, g, request,
render_template)
from flask_assets import Environment
from flask_babel import gettext
from flask_wtf.csrf import CSRFProtect, CSRFError
... | conorsch/securedrop | securedrop/journalist_app/__init__.py | Python | agpl-3.0 | 8,230 |
class Beer(object):
def sing(self, first, last=0):
verses = ''
for number in reversed(range(last, first + 1)):
verses += self.verse(number) + '\n'
return verses
def verse(self, number):
return ''.join([
"%s of beer on the wall, " % self._bottles(number).... | mscoutermarsh/exercism_coveralls | assignments/python/beer-song/example.py | Python | agpl-3.0 | 1,182 |
# GUI Application automation and testing library
# Copyright (C) 2006 Mark Mc Mahon
#
# This library 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 2.1
# of the License, or (at your opti... | airelil/pywinauto-64 | pywinauto/unittests/test_common_controls.py | Python | lgpl-2.1 | 33,312 |
#!/usr/bin/env python
import analyze_conf
import sys
import datetime, glob, job_stats, os, subprocess, time
import operator
import matplotlib
# Set the matplotlib output mode from config if it exists
if not 'matplotlib.pyplot' in sys.modules:
try:
matplotlib.use(analyze_conf.matplotlib_output_mode)
except NameE... | ubccr/tacc_stats | analyze/process_pickles/miss_vs_stall.py | Python | lgpl-2.1 | 5,040 |
# -*- coding: utf-8 -*-
from pysignfe.xml_sped import *
from .Rps import IdentificacaoPrestador, IdentificacaoRps
import os
DIRNAME = os.path.dirname(__file__)
class MensagemRetorno(XMLNFe):
def __init__(self):
super(MensagemRetorno, self).__init__()
self.Codigo = TagCaracter(nome=u'Codigo', tama... | thiagopena/PySIGNFe | pysignfe/nfse/bhiss/v10/ConsultarSituacaoLoteRps.py | Python | lgpl-2.1 | 5,547 |
# Written by Andrea Reale
# see LICENSE.txt for license information
from Tribler.Core.Subtitles.MetadataDomainObjects.SubtitleInfo import SubtitleInfo
from Tribler.Core.Subtitles.MetadataDomainObjects.MetadataDTO import MetadataDTO
from Tribler.Core.CacheDB.SqliteCacheDBHandler import BasicDBHandler
import threading
f... | egbertbouman/tribler-g | Tribler/Core/CacheDB/MetadataDBHandler.py | Python | lgpl-2.1 | 40,875 |
__author__ = 'fpena'
import numpy as np
import lda
import lda.datasets
def run():
# document-term matrix
X = lda.datasets.load_reuters()
print("type(X): {}".format(type(X)))
print("shape: {}\n".format(X.shape))
# the vocab
vocab = lda.datasets.load_reuters_vocab()
print("type(vocab): {}... | melqkiades/yelp | source/python/topicmodeling/external/lda_testing.py | Python | lgpl-2.1 | 2,284 |
#####################################################################
# linktest_rsp_header.py
#
# (c) Copyright 2021, Benjamin Parzella. All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free... | bparzella/secsgem | secsgem/hsms/linktest_rsp_header.py | Python | lgpl-2.1 | 1,587 |
#! /bin/env python
import sys, time, os
import pymedia.muxer as muxer
import pymedia.video.vcodec as vcodec
import pymedia.audio.acodec as acodec
import pymedia.audio.sound as sound
if os.environ.has_key( 'PYCAR_DISPLAY' ) and os.environ[ 'PYCAR_DISPLAY' ]== 'directfb':
import pydfb as pygame
YV12= pygame.PF_YV12
... | pymedia/pymedia | examples/video_bench_ovl.py | Python | lgpl-2.1 | 2,778 |
##############################################################################
# Copyright (c) 2013-2017, 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... | lgarren/spack | var/spack/repos/builtin/packages/r-protgenerics/package.py | Python | lgpl-2.1 | 1,699 |
#
# Copyright (C) 2008 Cournapeau David <cournape@gmail.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# ... | cournape/audiolab | audiolab/soundio/play.py | Python | lgpl-2.1 | 4,020 |
#!/usr/bin/env python
## \file config.py
# \brief python package for config
# \author T. Lukaczyk, F. Palacios
# \version 3.2.9 "eagle"
#
# SU2 Lead Developers: Dr. Francisco Palacios (Francisco.D.Palacios@boeing.com).
# Dr. Thomas D. Economon (economon@stanford.edu).
#
# SU2 Developers: Prof.... | chenbojian/SU2 | SU2_PY/SU2/io/config.py | Python | lgpl-2.1 | 30,110 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
# Author: Milton Woods <milton.woods@bom.gov.au>
# Date: March 22, 2017
# Author: George Hartzell <hartzell@alerce.com>
... | rspavel/spack | var/spack/repos/builtin/packages/perl/package.py | Python | lgpl-2.1 | 14,548 |
import http.server
import urllib.parse
class BaseServer(http.server.BaseHTTPRequestHandler):
pass
HTTPServer = http.server.HTTPServer
urllib_urlparse = urllib.parse.urlparse
| cslarsen/vev | vev/server_py3.py | Python | lgpl-2.1 | 180 |
# -*- coding: utf-8 -*-
"""
An x11 bridge provides a secure/firewalled link between a desktop application and the host x11 server. In this case, we use XPRA to do the bridging.
::.
------------- -------------
|desktop app| <--/tmp/.X11-unix--> |xpra server| Untrusted
------------- ... | subuser-security/subuser | subuserlib/classes/subuserSubmodules/run/x11Bridge.py | Python | lgpl-3.0 | 14,679 |
"""
Contains functionality relate to interfacing wiggly and puq
"""
import binascii,os,re
import numpy as np
import matplotlib.pyplot as plt
import shapely.geometry
import CrispObjects,FuzzyObjects,fuzz,utilities
import _distributions as distributions
import puq
class ObjectManager(object):
"""
Manages Wiggly ... | zoidy/wiggly | objectmanager.py | Python | lgpl-3.0 | 60,303 |
#Created by Dmytro Konobrytskyi, 2013 (github.com/Akson)
import logging
import json
import struct
import numpy as np
def ParseBinaryData(binaryData, binaryDataFormat, dimensions):
elementSize = struct.calcsize(binaryDataFormat)
elementsNumber = len(binaryData) / elementSize
#Single element case
if... | Akson/RemoteConsolePlus3 | RemoteConsolePlus3/RCP3/DefaultParser.py | Python | lgpl-3.0 | 2,359 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-04 19:14
from __future__ import unicode_literals
import archives.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migra... | phith0n/mooder | archives/migrations/0004_postimage.py | Python | lgpl-3.0 | 1,192 |
# Copyright 2017 The Tangram Developers. See the AUTHORS file at the
# top-level directory of this distribution and at
# https://github.com/renatoGarcia/tangram/blob/master/AUTHORS.
#
# This file is part of Tangram.
#
# Tangram is free software: you can redistribute it and/or modify
# it under the terms of the GNU Less... | renatoGarcia/tangram | tangram/recipes/__init__.py | Python | lgpl-3.0 | 927 |
#!/usr/bin/env python2.7
# Uploads Scrypt mining farm status to CouchDB database for detailed logging.
# Written by Vishakh.
# https://github.com/vishakh/valkyrie
# Based on open source code by etkeh <https://github.com/setkeh>
import datetime
import json
import logging
import socket
import subprocess
import sys
impo... | vishakh/valkyrie | valkyrie.py | Python | lgpl-3.0 | 6,166 |
# coding=utf8
from __future__ import print_function
import re
import sys
import socket
from untwisted.mode import Mode
from untwisted.network import Work
from untwisted.event import DATA, BUFFER, FOUND, CLOSE, RECV_ERR
from untwisted.utils import std
from untwisted.utils.common import append, shrug
from untwisted.ma... | joodicator/PageBot | page/chess.py | Python | lgpl-3.0 | 2,574 |
#Hecho en python 3.5
from gutenberg.acquire import load_etext
from gutenberg.cleanup import strip_headers
librosCodigo = {"Francés":[13735,13808],"Español":[24925,15027],"Portugés":[14904,16384],"Inglés":[10422,1013]}
dic_idiomas={}
#hola dos
for idioma in librosCodigo.keys():
diccionario_largo_palabras={}
f... | DiplomadoACL/problemasenclase | Problema2/problema2crocha.py | Python | lgpl-3.0 | 1,040 |
by_ext = [
('py.png', 'py'),
('python.png', 'pyc'),
('page_white_text_width.png', ['md', 'markdown', 'rst', 'rtf']),
('page_white_text.png', 'txt'),
('page_white_code.png', ['html', 'htm', 'cgi']),
('page_white_visualstudio.png', ['asp', 'vb']),
('page_white_ruby.png', 'rb'),
('page_code... | klen/pyserve | pyserve/icons.py | Python | lgpl-3.0 | 2,305 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2017 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | jH0ward/psi4 | psi4/driver/molutil.py | Python | lgpl-3.0 | 10,050 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from common_processing import *
import tarfile
import sys
import glob
def untar(ftp_link, out_folder):
tar = tarfile.open(out_folder + ftp_link.split("/")[-1])
tar.extractall(path=out_folder)
tar.close()
def process_nodes_dmp(out_fo... | TurkuNLP/CAFA3 | sequence_features/process_NCBI_Taxonomy.py | Python | lgpl-3.0 | 3,092 |
# -*- coding: utf-8 -*-
# This file is part of Knitlib.
#
# Knitlib is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ... | fashiontec/knitlib | src/knitlib/plugins/dummy_plugin.py | Python | lgpl-3.0 | 1,842 |
"""This module holds the common test code.
.. seealso:: `pytest good practices
<https://pytest.org/latest/goodpractices.html>`__ for why this module exists.
"""
import os
import sys
# sys.path makes knittingpattern importable
HERE = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(HERE, "../.."))
__builtin... | AllYarnsAreBeautiful/knittingpattern | knittingpattern/test/conftest.py | Python | lgpl-3.0 | 339 |
#
# uchroma - Copyright (C) 2021 Stefanie Kondik
#
# This program 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, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WIT... | cyanogen/uchroma | uchroma/client/dbus_client.py | Python | lgpl-3.0 | 2,107 |
"""
WSGI config for CongCards project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
os.en... | SoftButterfly/CongCards | CongCards/wsgi.py | Python | lgpl-3.0 | 430 |
#!/home/toppatch/Python-2.7.5/bin/python2.7
"""An RFC 2821 smtp proxy.
Usage: %(program)s [options] [localhost:localport [remotehost:remoteport]]
Options:
--nosetuid
-n
This program generally tries to setuid `nobody', unless this flag is
set. The setuid call will fail if this program is not ... | vFense/vFenseAgent-nix | agent/deps/rpm6/Python-2.7.5/bin/smtpd.py | Python | lgpl-3.0 | 18,564 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hischool.settings")
# Add the "core" and "extensions" folders to the path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "extensions"))
sys.path.insert(0, os.path.join(os.... | HiSchoolProject/BackSchool | manage.py | Python | lgpl-3.0 | 1,016 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of nmaptocsv.
#
# Copyright (C) 2012, 2019 Thomas Debize <tdebize at mail.com>
# All rights reserved.
#
# nmaptocsv is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# ... | maaaaz/nmaptocsv | nmaptocsv.py | Python | lgpl-3.0 | 24,214 |
import os, sys
origin_dir = 'del_201304now/'
new_dir = 'freq_event_state/'
files = os.listdir(origin_dir)
state_dir = {}
country_dir = {}
for file in files:
with open(origin_dir + file) as f:
event_dir = {}
for line in f:
tmp_content = line.split('\t')
code = tmp_content[4]
... | moment-of-peace/EventForecast | association_rule/event_frequent.py | Python | lgpl-3.0 | 1,535 |
"""
Exim SES Transport Entry Points
"""
# Copyright 2013, Jayson Vantuyl <jvantuyl@gmail.com>
#
# This file is part of exim_ses_transport.
#
# exim_ses_transport 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 Fou... | jvantuyl/exim_ses_transport | exim_ses_transport/run.py | Python | lgpl-3.0 | 880 |
import django
from django.db import models
from pytigon_lib.schdjangoext.fields import *
from pytigon_lib.schdjangoext.models import *
import pytigon_lib.schdjangoext.fields as ext_models
from pytigon_lib.schtools import schjson
from django.utils.translation import gettext_lazy as _
from django.contrib import admin
... | Splawik/pytigon | pytigon/prj/scheditor/sched/models.py | Python | lgpl-3.0 | 531 |
from gen_data_from_rbprm import *
from hpp.corbaserver.rbprm.tools.com_constraints import get_com_constraint
from hpp.gepetto import PathPlayer
from hpp.corbaserver.rbprm.state_alg import computeIntermediateState, isContactCreated
from numpy import matrix, asarray
from numpy.linalg import norm
from spline import bez... | pFernbach/hpp-rbprm-corba | script/scenarios/sandbox/siggraph_asia/chair/bezier_traj.py | Python | lgpl-3.0 | 22,357 |
import os
import sys
import time
import inspect
from pyo import *
# To automate audio output validation, every random has to be properly
# seeded for the examples to be determinitic.
def play_example(cls, dur=5, toprint=True, double=False):
"""
Execute the documentation example of the object given as an argum... | belangeo/pyo | tests/play_all_manual_examples.py | Python | lgpl-3.0 | 3,067 |
#!/usr/bin/env python
from __future__ import unicode_literals
# Allow direct execution
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import io
import re
import string
from youtube_dl.extractor import YoutubeIE
from youtube_dl.utils import compa... | riking/youtube-dl | test/test_youtube_signature.py | Python | unlicense | 4,167 |
'''
Find the median element in an unsorted array
'''
import heapq
def find_median(arr):
# O(n)
heapq.heapify(arr)
num_elements = len(arr)
if num_elements % 2 != 0:
return arr[(num_elements + 1)/2 - 1]
else:
return (arr[num_elements/2 - 1] + arr[num_elements/2 + 1 - 1])/2.0
assert f... | amitsaha/learning | python/search/find_median.py | Python | unlicense | 401 |
"""Suit + values are ints"""
from random import shuffle
class Card:
suits = ("spades", "hearts", "diamonds", "clubs")
values = (None, None, '2', '3',
'4', '5', '6', '7',
'8', '9', '10',
'Jack','Queen',
'King', 'Ace')
def __init__(self, v, s):
... | Frikeer/LearnPython | exc15/lib.py | Python | unlicense | 1,360 |
__author__ = 'ralmn'
| ralmn/CMAsk | cmask/__init__.py | Python | unlicense | 21 |
# Advent of Code Solutions: Day 6, part 2
# https://github.com/emddudley/advent-of-code-solutions
import re
def twinkle_lights(instruction, lights):
tokens = re.split(r'(\d+)', instruction)
operation = tokens[0].strip()
if operation == 'turn on':
twinkle = lambda x: x + 1
elif operation == 't... | emddudley/advent-of-code-solutions | 2015/day-6/advent-day-6-2.py | Python | unlicense | 914 |
import os
import sys
# Import the Flask Framework
from flask import Flask, request, render_template
isDev = os.environ["SERVER_SOFTWARE"].find('Development') == 0
app = Flask( __name__ )
# Note: We don't need to call run() since our application is embedded within
# the App Engine WSGI application server.
@app.route... | nick-jonas/static-jspm-boiler | main.py | Python | unlicense | 662 |
sum = 1
curr = 3
for width in xrange(3,1002,2):
inc = width - 1
sum = sum + curr #bottom right
curr = curr + inc
sum = sum + curr #bottom left
curr = curr + inc
sum = sum + curr #top left
curr = curr + inc
sum = sum + curr #top right
curr = curr + inc + 2
print sum
| kbrose/project_euler | p20-29/p28.py | Python | unlicense | 304 |
# -*- coding: utf-8 -*-
import sys
import time
def make(session):
session.execute("make (%(rnd_name.0)s)")
a_guid = session.message()[1][-1]
assert(session.message() is None)
return(a_guid)
def link(session, a, l, b):
session.execute("make %s -[%s]> %s" % (a, l, b))
assert(session.message() i... | locaweb/leela | try/src/try_leela/helpers.py | Python | apache-2.0 | 1,592 |
"""Helpers that help with state related things."""
import asyncio
import datetime as dt
import json
import logging
from collections import defaultdict
from types import TracebackType
from typing import ( # noqa: F401 pylint: disable=unused-import
Awaitable, Dict, Iterable, List, Optional, Tuple, Type, Union)
from... | PetePriority/home-assistant | homeassistant/helpers/state.py | Python | apache-2.0 | 8,174 |
'''
Created on Oct 3, 2012
Copyright © 2013
The Board of Trustees of The Leland Stanford Junior University.
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.apa... | daStrauss/subsurface | src/expts/paramSplitFieldBoth.py | Python | apache-2.0 | 1,344 |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import dataclasses
import inspect
import json
from dataclasses import dataclass
from enum import Enum
from typing import Any, Callable, Dict, Generic, L... | jsirois/pants | src/python/pants/help/help_info_extracter.py | Python | apache-2.0 | 19,574 |
"""
WSGI config for meetingroom 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_APPLICATIO... | jasonperk/meetingroom | meetingroom/wsgi.py | Python | apache-2.0 | 1,144 |
"""
Implementation of hooks and APIs for outputting log messages.
"""
import sys
import traceback
import inspect
import json as pyjson
from threading import Lock
from functools import wraps
from io import IOBase
from pyrsistent import PClass, field
from . import _bytesjson as bytesjson
from zope.interface import Int... | ScatterHQ/eliot | eliot/_output.py | Python | apache-2.0 | 15,228 |
# --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2016 by Contributors
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Modified by Zheng Zhang
# --------------------------------------------------------
impor... | deepinsight/Deformable-ConvNets | deeplab/function/test_deeplab.py | Python | apache-2.0 | 3,137 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import json
import logging
import re
from collections import defaultdict
from dataclasses import dataclass
from typing import DefaultDict
from pants.ba... | benjyw/pants | src/python/pants/backend/shell/dependency_inference.py | Python | apache-2.0 | 8,271 |
import logging
import tarfile
import tempfile
import os
import fabric.api
import fabric.operations
import cloudenvy.envy
class Dotfiles(cloudenvy.envy.Command):
def _build_subparser(self, subparsers):
help_str = 'Upload dotfiles from your local machine to an Envy.'
subparser = subparsers.add_pa... | sysbot/cloudenvy | cloudenvy/commands/dotfiles.py | Python | apache-2.0 | 1,933 |
import pycparser
def main_eg():
parser = pycparser.CParser()
buf = '''
int main( int argc, char** argv ) {
j = p && r || q;
return j;
}
'''
t = parser.parse( buf, 'x.c' )
return t
if __name__ == "__main__":
t = main_eg()
t.show()
| quenette/COMPASS-I | t/scripts/test_pycparser.py | Python | apache-2.0 | 289 |
# -*- coding: utf-8 -*-
#
# Nablarch解説書 documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 08 09:45:59 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... | koyi2016/sample | conf.py | Python | apache-2.0 | 9,767 |
# Copyright 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, softwa... | google/vulkan_test_applications | gapid_tests/synchronization_tests/vkDeviceWaitIdle_test/vkDeviceWaitIdle_test.py | Python | apache-2.0 | 1,043 |
__author__ = 'juan'
import json
from termcolor import colored
import mysql.connector
import time
config = {
'user': 'elec',
'password': 'elec',
'host': 'thor.deusto.es',
'database': 'eu_test2',
}
class database:
def __init__(self):
self.con = mysql.connector.connect(**config)
def in... | aitoralmeida/eu-elections | analyzer/remote_database.py | Python | apache-2.0 | 9,695 |
from .column_pair_values_equal import ColumnPairValuesEqual
from .column_pair_values_greater import ColumnPairValuesAGreaterThanB
from .column_pair_values_in_set import ColumnPairValuesInSet
| great-expectations/great_expectations | great_expectations/expectations/metrics/column_pair_map_metrics/__init__.py | Python | apache-2.0 | 191 |
import copy
import datetime
import logging
import math
import operator
import traceback
from collections import namedtuple
from typing import Any, Dict, Optional, Tuple
from pyparsing import (
CaselessKeyword,
Combine,
Forward,
Group,
Literal,
ParseException,
Regex,
Suppress,
Word,
... | great-expectations/great_expectations | great_expectations/core/evaluation_parameters.py | Python | apache-2.0 | 17,237 |
# Copyright 2018 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... | tensorflow/benchmarks | scripts/tf_cnn_benchmarks/mlperf_test.py | Python | apache-2.0 | 7,794 |
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... | DataONEorg/d1_python | test_utilities/src/d1_test/instance_generator/tests/test_person.py | Python | apache-2.0 | 1,335 |
"""A collection of ORM sqlalchemy models for Caravel"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import re
import functools
import json
import logging
import re
import textwrap
from collections import namedtuple... | wbsljh/caravel | caravel/models.py | Python | apache-2.0 | 73,950 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | datacommonsorg/tools | stat_var_renaming/stat_var_renaming_constants.py | Python | apache-2.0 | 13,060 |
#!/usr/bin/env python
# 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... | appium/python-client | test/unit/webdriver/device/remote_fs_test.py | Python | apache-2.0 | 3,434 |
################################################################################
# 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... | greghogan/flink | flink-python/pyflink/fn_execution/aggregate.py | Python | apache-2.0 | 22,865 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 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/... | russellb/nova | nova/tests/test_compute_utils.py | Python | apache-2.0 | 4,385 |
class Vehicle(object):
def __init__(self, make, model, year):
self.make = make
self.model = model
self.year = year
def foo(self, a, b, c):
print 'does some work'
print a, b, c
class Car(Vehicle):
def __init__(self, doors, *args):
Vehicle.__init__(self, ... | NMTHydro/SWACodingMeeting | homework/for_meeting_3/vehicles_David.py | Python | apache-2.0 | 930 |
"""The tests for the logbook component."""
# pylint: disable=protected-access,invalid-name
import collections
from datetime import datetime, timedelta
import json
import unittest
import pytest
import voluptuous as vol
from homeassistant.components import logbook, recorder
from homeassistant.components.alexa.smart_hom... | GenericStudent/home-assistant | tests/components/logbook/test_init.py | Python | apache-2.0 | 61,935 |
# Copyright 2016 Cisco Systems, Inc. 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 requir... | Gitweijie/first_project | networking_cisco/backwards_compatibility.py | Python | apache-2.0 | 5,581 |
"""Code to handle a Hue bridge."""
import asyncio
from functools import partial
from aiohttp import client_exceptions
import aiohue
import async_timeout
import slugify as unicode_slug
import voluptuous as vol
from homeassistant import core
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.he... | postlund/home-assistant | homeassistant/components/hue/bridge.py | Python | apache-2.0 | 8,552 |
from __future__ import division, print_function
import os, json
from glob import glob
import numpy as np
from scipy import misc, ndimage
from scipy.ndimage.interpolation import zoom
import keras
from keras import backend as K
from keras.layers.normalization import BatchNormalization
from keras.utils.data_utils import... | VadimMalykh/courses | deeplearning1/nbs/vgg16.py | Python | apache-2.0 | 4,286 |
from __future__ import print_function, absolute_import
import re
class CNFParser(object):
"""Stream parser for DIMACS format"""
def __init__(self, file_object):
self.file_object = file_object
self.var_count = 0
self.clauses = []
self.remove_doubles = re.compile(r'\s\s+')
... | kunalarya/simple-sat-solver | satsolver/parser.py | Python | apache-2.0 | 2,344 |
# -*- coding: utf-8 -*-
from . import app, db
from flask import request, g, session, redirect
from Lotus.model.user import User
from hashlib import md5
from Lotus.lib.msg_code import Msg
import json
@app.route('/user/login', methods=['POST'])
def user_login():
email = request.form.get('email', None)
psw = req... | Jayin/Lotus | Lotus/controller/user.py | Python | apache-2.0 | 2,550 |
import os
import sys
import numpy as np
sys.path.insert(0, os.getcwd() + '/../../tools/')
import lstm
import wb
import wer
def rescore_all(workdir, nbestdir, config):
for tsk in ['nbestlist_{}_{}'.format(a, b) for a in ['dt05', 'et05'] for b in ['real', 'simu']]:
print('process ' + tsk)
nbest_txt... | wbengine/SPMILM | egs/chime4/run_lstm.py | Python | apache-2.0 | 2,187 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.