code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import builder
main = builder.main | bin3/bobo | bobo/__init__.py | Python | apache-2.0 | 35 |
from audio.io import *
| Curly-Mo/audio | __init__.py | Python | mit | 23 |
__author__ = 'wbtang'
import datetime
import os
folder_src = '../src'
folder_log = '../log'
folder_release = '../release'
folder_final = '../ex_final'
folder_final_ex1 = '%s/%s' % (folder_final, 'ex1')
folder_final_ex2 = '%s/%s' % (folder_final, 'ex2')
folder_final_ex3 = '%s/%s' % (folder_final, 'ex3')
__name_exe ... | iSuneast/p2p_vod | p2p_vod.linux_win/py/log_base.py | Python | mit | 3,229 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
class ValidationError(ValueError):
pass
| HeathKang/flasky | app/exceptions.py | Python | mit | 90 |
import re
from collections import Iterable
from io import StringIO
from itertools import groupby
from typing import List, Tuple, Callable, Any, IO, cast
from smartchangelog import datetools
from smartchangelog.commit import Commit
class Node:
def __init__(self, name: str = None, criterion: property = None, chil... | ngouzy/smartchangelog | smartchangelog/changelog.py | Python | mit | 5,198 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run all infrastructure-related tests."""
import os
import subprocess
import sys
INFRA_BOTS_DIR = os.path.dirname(os.path.realpath(__file__))
SKIA_DIR = os... | HalCanary/skia-hc | infra/bots/infra_tests.py | Python | bsd-3-clause | 1,839 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Module for generating tables used by rungeneric1.py.
The generated tables give the ERT and in brackets the 10th to 90th
percentile range divided by two of 100 simulated runs divided by the
best ERT measured during BBOB-2009 (given in the respective first row)
for diff... | NDManh/numbbo | code-postprocessing/bbob_pproc/pptable.py | Python | bsd-3-clause | 23,192 |
""" Controller for tsl2561 devices. """
import mauzr
from mauzr.serializer import Struct as SS
__author__ = "Alexander Sowitzki"
FMAP = ((0, 0, 0), (0x40, 0x01f2, 0x01be), (0x80, 0x214, 0x2d1),
(0xc0, 0x23f, 0x37b), (0x0100, 0x270, 0x3fe),
(0x0138, 0x16f, 0x1fc), (0x019a, 0xd2, 0xfb), (0x29a, 0x18, 0... | eqrx/mauzr | mauzr/hardware/tsl2561/controller.py | Python | agpl-3.0 | 1,735 |
# listenbrainz-server - Server for the ListenBrainz project.
#
# Copyright (C) 2020 MetaBrainz Foundation Inc.
#
# 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... | Freso/listenbrainz-server | listenbrainz/webserver/views/missing_musicbrainz_data_api.py | Python | gpl-2.0 | 5,227 |
# cloudscope.replica.consensus.tag
# Package that implements tag based consensus consistency.
#
# Author: Benjamin Bengfort <bengfort@cs.umd.edu>
# Created: Tue Mar 08 14:28:05 2016 -0500
#
# Copyright (C) 2016 University of Maryland
# For license information, see LICENSE.txt
#
# ID: tag.py [] benjamin@bengfort.com ... | bbengfort/cloudscope | cloudscope/replica/consensus/tag.py | Python | mit | 27,667 |
#!/usr/bin/python3
# vi:set fileencoding=utf-8 :
"""
Created on 2014-03-22
@author : Laurent Stacul
"""
| stac47/osm-garmin | tests/__init__.py | Python | gpl-2.0 | 106 |
import random
l = [0, 1, 2, 3, 4]
print(random.sample(l, 3))
# [2, 4, 0]
print(type(random.sample(l, 3)))
# <class 'list'>
print(random.sample(l, 1))
# [3]
print(random.sample(l, 0))
# []
# print(random.sample(l, 10))
# ValueError: Sample larger than population or is negative
print(random.sample(('xxx', 'yyy', '... | nkmk/python-snippets | notebook/random_sample.py | Python | mit | 688 |
"""
Unit tests over SQLite backend for Crash Database
"""
from apport.report import Report
import os
from unittest import TestCase
from sqlite import CrashDatabase
class CrashDatabaseTestCase(TestCase):
def setUp(self):
self.crash_base = os.path.sep + 'tmp'
self.crash_base_url = 'file://' + self.... | icandigitbaby/openchange | script/bug-analysis/test_sqlite.py | Python | gpl-3.0 | 9,687 |
#
# File: courseware/capa/inputtypes.py
#
"""
Module containing the problem elements which render into input objects
- textline
- textbox (aka codeinput)
- schematic
- choicegroup (aka radiogroup, checkboxgroup)
- javascriptinput
- imageinput (for clickable image)
- optioninput (for option list)
- filesubmission (... | wwj718/ANALYSE | common/lib/capa/capa/inputtypes.py | Python | agpl-3.0 | 63,613 |
#!/usr/bin/env python
import sys, os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience... | pusateri/vectorformats | setup.py | Python | mit | 1,365 |
# Copyright 2013-2021 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)
from spack import *
class RSquash(RPackage):
"""Color-Based Plots for Multivariate Visualization
Functions for ... | LLNL/spack | var/spack/repos/builtin/packages/r-squash/package.py | Python | lgpl-2.1 | 1,180 |
#!/usr/bin/env python3
# Python primary Helper to generate PWM audio signals to control a servos
# Current setup involves sending a mono audio PWM signal from the left (or right) channel to control a servo
# We use a USB soundcard/default audio jack to output audio waveform, but since it is usually 2V peak DC, we nee... | sunjerry019/photonLauncher | micron/pwmaudio.py | Python | apache-2.0 | 3,911 |
# 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 | rl_metrics_aaai2021/lax_bisimulation.py | Python | apache-2.0 | 3,658 |
import functools
from django.db.models.sql import EmptyResultSet
import commonware.log
from rest_framework.decorators import api_view
from rest_framework.exceptions import ParseError
from rest_framework.mixins import ListModelMixin
from rest_framework.routers import Route, SimpleRouter
from rest_framework.response im... | ingenioustechie/zamboni | mkt/api/base.py | Python | bsd-3-clause | 8,836 |
'''
blockr.io
'''
import logging
from lib import config, util
def get_host():
if config.BLOCKCHAIN_SERVICE_CONNECT:
return config.BLOCKCHAIN_SERVICE_CONNECT
else:
return 'http://twdc.blockr.io' if config.TESTNET else 'http://wdc.blockr.io'
def check():
pass
def getinfo():
result = ut... | Bluejudy/bluejudyd | lib/blockchain/blockr.py | Python | mit | 3,465 |
import random
from django.http import Http404
from django.http.response import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse_lazy
from django.views.generic import View, FormView
from django.views.generic.base import TemplateView
from django_tables2 import R... | michaelbratsch/bwb | staff/views.py | Python | gpl-3.0 | 13,376 |
import pychrono.core as chrono
import pychrono.sensor as sens
import numpy as np
import time
import random
def main():
#------------------
# Create the system
#------------------
mphysicalSystem = chrono.ChSystemNSC()
mphysicalSystem.Set_G_acc(chrono.ChVectorD(0,0,0))
red = chrono.ChVisualMat... | projectchrono/chrono | src/demos/python/sensor/demo_SEN_radar.py | Python | bsd-3-clause | 4,103 |
import config
import lib
from flask import Flask, Request
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_object(config)
app.request_class = lib.Request
db = SQLAlchemy(app)
def format_datetime(value):
return value.strftime("%Y-%m-%d %H:%M:%S %z")
app.jinja_env.filters['datetim... | mutantmonkey/ctfengine | ctfengine/__init__.py | Python | isc | 840 |
from qutebrowser.config.configfiles import ConfigAPI # noqa: F401
from qutebrowser.config.config import ConfigContainer # noqa: F401
config = config # type: ConfigAPI # noqa: F821 pylint: disable=E0602,C0103
c = c # type: ConfigContainer # noqa: F821 pylint: disable=E0602,C0103
from pyconfig import qbv
qbv.c = c
... | jgkamat/dotfiles | qutebrowser/.config/qutebrowser/config.py | Python | gpl-3.0 | 548 |
__project__ = 'ParkFinder'
__version__ = '0.0.0'
VERSION = __project__ + '-' + __version__
| friendlycode/gr-parks | parks/__init__.py | Python | mit | 92 |
#!/usr/bin/env python2
import ringo_config
cfg = ringo_config.RingoConfig()
import pyximport; pyximport.install(build_dir=cfg.pyximport_build())
import argparse
import os
import scj
import file_ops
from model import Genome
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="SCJ algorithms.")
... | pedrofeijao/RINGO | src/ringo/run_scj.py | Python | mit | 1,242 |
#
# Copyright (c) 1996-2000 Tyler C. Sarna <tsarna@sarna.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# not... | EduPepperPDTesting/pepper2013-testing | lms/djangoapps/reportlab/graphics/barcode/__init__.py | Python | agpl-3.0 | 5,911 |
"""
Passing arguments to decorators
------------------------------
Looking back at the example before the one above, you can notice how
redundant the decorators in the example are. 3 decorators(div_decorate,
p_decorate, strong_decorate) each with the same functionality but wrapping
the string with different tags. We ca... | spradeepv/dive-into-python | decorators/passing_args_to_decorators.py | Python | mit | 753 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from generator import Generator
import sys
from lxml import etree
import os.path
class PluginGenerator(Generator):
plugin_id = 0
def __init__(self, xml):
Generator.__init__(self)
if os.path.isfile(xml):
plugin_tree = etree.parse(xml)... | benoitfragit/VOXGenerator | voxgenerator/generator/plugin_generator.py | Python | gpl-2.0 | 3,689 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Flask, render_template, request
app = Flask(__name__)
import ibm_db_dbi as dbi
from itoolkit import *
from itoolkit.db2.idb2call import * #for local jobs
version = tuple(map(int, dbi.__version__.split('.')))
if version < (2, 0, 5, 5):
raise Exce... | Club-Seiden/python-for-IBM-i-examples | non-wheel/flask-example/sample.py | Python | mit | 1,305 |
## Mask generator from MADE: https://github.com/mgermain/MADE
import copy
import theano
import theano.tensor as T
import numpy as np
from theano.sandbox.rng_mrg import MRG_RandomStreams # Limited but works on GPU
from theano.tensor.shared_randomstreams import RandomStreams
# from theano.gpuarray.dnn import GpuDnnSoft... | ajbrock/Neural-Photo-Editor | mask_generator.py | Python | mit | 5,220 |
import _plotly_utils.basevalidators
class IndicesValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="indices", parent_name="pointcloud", **kwargs):
super(IndicesValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/pointcloud/_indices.py | Python | mit | 402 |
# -*- coding: utf-8 -*-
import re
import vim
from orgmode._vim import echom, ORGMODE, realign_tags
from orgmode.menu import Submenu, Separator, ActionEntry
from orgmode.keybinding import Keybinding, Plug, Command
class Hyperlinks(object):
u""" Hyperlinks plugin """
def __init__(self):
u""" Initialize plugin ""... | j-a-m-l/.dot | vim/bundle/vim-orgmode/ftplugin/orgmode/plugins/Hyperlinks.py | Python | mit | 6,337 |
import sys
import os.path
import logging
import ply.yacc
from rightarrow.annotations import *
from rightarrow.lexer import Lexer
logger = logging.getLogger(__name__)
class Parser(object):
tokens = Lexer.tokens
def __init__(self, debug=False, lexer_class=None):
self.debug = debug
self.lexer_... | kennknowles/python-rightarrow | rightarrow/parser.py | Python | apache-2.0 | 6,194 |
def extractPeaTranslation(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
| fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractPeaTranslation.py | Python | bsd-3-clause | 215 |
import numpy as __np__
from numpy import sqrt as __sqrt__
from numpy import cos as __cos__
from numpy import sin as __sin__
import matplotlib.pyplot as __plt__
from matplotlib import cm as __cm__
from matplotlib.ticker import LinearLocator as __LinearLocator__
from matplotlib.ticker import FormatStrFormatter as __Forma... | Sterncat/opticspy | opticspy/test/test_surface2.py | Python | mit | 2,346 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | pwong-mapr/private-hue | desktop/libs/hadoop/src/hadoop/fs/webhdfs.py | Python | apache-2.0 | 24,483 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2014 Star2Billing S.L.
#
# The primar... | tarikgwa/nfd | newfies/dialer_campaign/function_def.py | Python | mpl-2.0 | 7,128 |
""" Sahana Eden Automated Test - HRM001 Create Staff
@copyright: 2011-2012 (c) Sahana Software Foundation
@license: MIT
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... | anubhav929/eden | modules/tests/hrm/create_staff.py | Python | mit | 2,825 |
import types
import vcr
from nose.tools import * # flake8: noqa
# Comment line below prevents unittest from deletion in import optimization
# noinspection PyUnresolvedReferences
import unittest
from osf_api_v2_client.utils import (
DotNotator,
StatusCode400orGreaterError
)
from osf_api_v2_client.session imp... | jamiehand/osf_api_v2_client | tests/test_nodes.py | Python | apache-2.0 | 12,910 |
# 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... | aldian/tensorflow | tensorflow/python/saved_model/function_deserialization.py | Python | apache-2.0 | 20,230 |
#!/usr/bin/env python
#
# Copyright 2015 Google 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... | googleads/googleads-python-lib | examples/ad_manager/v202202/audience_segment_service/populate_first_party_audience_segments.py | Python | apache-2.0 | 2,404 |
#!/usr/bin/env python
import locale
locale.setlocale(locale.LC_ALL, 'C')
import sys, tempfile, os, shutil, imp, time
import unittest, subprocess
import logging
import warnings
from xml.dom import minidom
if sys.version_info[0] > 2:
from io import StringIO, BytesIO
else:
from StringIO import StringIO
BytesIO = String... | linuxmidhun/0install | tests/basetest.py | Python | lgpl-2.1 | 8,927 |
__author__ = "CHANN"
__email__ = "chann@chann.kr"
__version__ = "0.0.0"
import os
import sys
import re
from flask import Flask
from flask import render_template
from flask import url_for
from flask import redirect
from flask import request
from flask import flash
from flask_sqlalchemy import SQLAlchemy
from flask_log... | channprj/uptime-robot | app/__init__.py | Python | mit | 583 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
from argparse import ArgumentParser
from vocab import Vocab
from lmdataset import LMDataset
from lm import NeuralLM
from deepy.dataset import SequentialMiniBatches
from deepy.trainers import SGDTrainer, LearningRateAnnealer
from deepy.layers impor... | zomux/deepy | examples/lm/char_lstm.py | Python | mit | 1,531 |
# -*- coding: utf-8 -*-
"""
pyvisa-py.protocols.rpc
~~~~~~~~~~~~~~~~~~~~~~~
Sun RPC version 2 -- RFC1057
This file is drawn from Python's RPC demo, updated for python 3.
XXX There should be separate exceptions for the various reasons why
XXX an RPC can fail, rather than using RuntimeError for... | andeh575/pyvisa-py | pyvisa-py/protocols/rpc.py | Python | mit | 25,745 |
from __future__ import unicode_literals
from django.contrib.auth.views import logout
from django.core.urlresolvers import NoReverseMatch, reverse_lazy
from django.shortcuts import resolve_url
from django.test import SimpleTestCase, ignore_warnings, override_settings
from django.utils import six
from django.utils.depre... | gannetson/django | tests/resolve_url/tests.py | Python | bsd-3-clause | 3,165 |
class Solution(object):
def numberOfBoomerangs(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
ans = 0
for p in points:
dis_dict = {}
for q in points:
if p == q:
continue
... | YiqunPeng/Leetcode-pyq | solutions/447NumberOfBoomerangs.py | Python | gpl-3.0 | 591 |
#!/usr/bin/env python
##
# @license
# Copyright Neekware Inc. All Rights Reserved.
#
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE file at http://neekware.com/license/MIT.html
###
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETT... | un33k/djangoware | bin/staging/manage.py | Python | mit | 1,185 |
from celery.execute import send_task
from rest_framework import status
from rest_framework import viewsets
from rest_framework.response import Response
from rockit.core import models
from rockit.core import holders
from rockit.core import resolvers
from rockit.core import serializers
class MixesViewSet(viewsets.View... | acreations/rockit-server | rockit/core/views/mixes.py | Python | mit | 6,422 |
#!/usr/bin/python -u
# WARNING: python -u means unbuffered I/O. Without it the messages are
# passed to the parent asynchronously which looks bad in clients.
import sys
import os
import getopt
import rpm
def log(s):
sys.stderr.write("%s\n" % s)
def error_msg(s):
sys.stderr.write("%s\n" % s)
def error_msg_an... | rplnt/abrt | src/plugins/abrt-action-list-dsos.py | Python | gpl-2.0 | 2,759 |
from multiprocessing import Process
from multiprocessing import Lock
from multiprocessing import current_process
from multiprocessing import Value
N = 10
def p(almacen, poner, tomar):
for v in range(N):
print current_process().name, "produciendo", v
poner.acquire()
almacen.value = v
... | tayebzaidi/PPLL_Spr_16 | productor-consumidor/p_c_lock_value_ok.py | Python | gpl-3.0 | 1,070 |
# -*- coding: utf-8 -*-
#
# Kivy documentation build configuration file, created by
# sphinx-quickstart on Wed Jan 21 22:37:12 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable... | woylaski/notebook | graphic/kivy-master/doc/sources/conf.py | Python | gpl-3.0 | 6,263 |
from __future__ import absolute_import, print_function, division
import numpy as np
import numpy
from six.moves import xrange
import theano
from theano.tensor import basic
from theano.tensor import nlinalg # noqa
from theano import gof, scalar
from theano.gof import Generic
from theano import gradient
from theano.gra... | Weihonghao/ECM | Vpy34/lib/python3.5/site-packages/theano/tensor/extra_ops.py | Python | agpl-3.0 | 37,957 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 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 dataclasses import dataclass, field
from datetime import datetime, timedelta
from authlib.oauth2.rfc... | ThiefMaster/indico | indico/core/oauth/models/tokens.py | Python | mit | 3,814 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | mistercrunch/panoramix | superset/datasets/commands/bulk_delete.py | Python | apache-2.0 | 3,375 |
"""
support for presenting detailed information in failing assertions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import six
from _pytest.assertion import rewrite
from _pytest.assertion import truncate
from _pytest.assertion import util... | txomon/pytest | src/_pytest/assertion/__init__.py | Python | mit | 5,171 |
"""
A module container
"""
from NetCatKS.Validators.api.interfaces.message import IMessage
from NetCatKS.Validators.api.interfaces.validators import IValidator, IValidatorResponse
__author__ = 'dimd'
__all__ = [
'IMessage',
'IValidator',
'IValidatorResponse'
]
| dimddev/NetCatKS | NetCatKS/Validators/api/interfaces/__init__.py | Python | bsd-2-clause | 275 |
# coding=utf-8
# Copyright 2022 The Tensor2Robot 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 ... | google-research/tensor2robot | research/vrgripper/mse_decoder.py | Python | apache-2.0 | 1,146 |
"""
Models for User Information (students, staff, etc)
Migration Notes
If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py lms schemamigration student --auto description_of_... | shubhdev/openedx | common/djangoapps/student/models.py | Python | agpl-3.0 | 67,408 |
# -*- coding: utf-8 -*-
"""Tests for the proofreadpage module."""
#
# (C) Pywikibot team, 2015-2019
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, division, unicode_literals
import difflib
import json
import pywikibot
from pywikibot.data import api
from pywikibot.proofr... | PersianWikipedia/pywikibot-core | tests/proofreadpage_tests.py | Python | mit | 31,607 |
#!/usr/bin/env python
# encoding: utf-8
"""
The :class:`~IPython.core.application.Application` object for the command
line :command:`ipython` program.
"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import absolute_import
from __future__ import ... | fzheng/codejam | lib/python2.7/site-packages/IPython/terminal/ipapp.py | Python | mit | 13,800 |
# coding: utf-8
from .base import *
from .compound import *
from .primitive import *
| aromanovich/jsl | jsl/fields/__init__.py | Python | bsd-3-clause | 86 |
'''
Function to load a session created by Django
'''
from django.contrib.sessions.backends.db import SessionStore
def get_session(session_key):
'''
Loads and returns a session form the SessionStore based on the session key
'''
return SessionStore(session_key=session_key)
def is_valid_key(session_ke... | geometalab/geoconverter | OGRgeoConverter/geoconverter/sessionhandler.py | Python | mit | 859 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# NetProfile: Setup and entry points
# Copyright © 2013-2017 Alex Unigovsky
#
# This file is part of NetProfile.
# NetProfile 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 S... | unikmhz/npui | netprofile/netprofile/__init__.py | Python | agpl-3.0 | 5,064 |
from swtk.processors import *
class PassiveVoiceProcessor(Plugin):
help = 'Finds sentences in passive voice.'
run_priority = 160
dictionary = ['is', 'are', 'were', 'was', 'been', 'be']
def __init__(self, dictionary_filename='./data/frequent_words.pickle'):
self.counter = 0
def process_se... | pkorus/swtk | plugins/passive_voice.py | Python | mit | 1,379 |
def main(request, response):
return ([("Content-Type", "text/html")],
"FROM_NETWORK") | UK992/servo | tests/wpt/web-platform-tests/clear-site-data/support/controlled-endpoint.py | Python | mpl-2.0 | 101 |
"""
pygments.lexers.stata
~~~~~~~~~~~~~~~~~~~~~
Lexer for Stata
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, default, include, words
from pygments.token import Comment, Keyword, Name... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/pygments/lexers/stata.py | Python | apache-2.0 | 6,414 |
# DicomDiff.py
"""Show the difference between two dicom files.
"""
# Copyright (c) 2008-2012 Darcy Mason
# This file is part of pydicom, relased under an MIT license.
# See the file license.txt included with this distribution, also
# available at http://pydicom.googlecode.com
from __future__ import print_functio... | njvack/ge-mri-rtafni | upload-host/vendor/dicom/examples/DicomDiff.py | Python | mit | 1,262 |
#!/usr/bin/python
# Util file to import in all of the notebooks to allow for easy code re-use
# Calculate Percent of Attendees that did not speak
def percent_silent(df):
total = len(df)
silent = 0
for row in df.iteritems():
if row[1] == 0:
silent = silent + 1
percent = {}
per... | JesseScott/PolyglotVancouver-Analysis | util.py | Python | gpl-3.0 | 1,542 |
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.urlresolvers import reverse
from jinja2 import Environment
def environment(**options):
env = Environment(**options)
env.globals.update({
'static': staticfiles_storage.url,
'url': reverse
})
return env
| k3nsuk3/webtex | webtex/jinja2.py | Python | gpl-3.0 | 320 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ===============================================================
#
# Filename: report.py
#
# Author: zhangpan
# Email: yunxinyi@gmail.com
# Created: 2015-12-23 13:53:10 CST
# Last-update: 2015-12-23 13:53:10 CST
# Description: ANCHOR
#
# Version: 0.0.1
# Revision: [Non... | oxnz/work-stuff | logparse/proc.py | Python | mit | 4,272 |
from datetime import datetime
from pyramid.threadlocal import get_current_registry
from pytz import timezone
from sqlalchemy import event
from sqlalchemy import sql
from sqlalchemy import orm
from amnesia.modules.content import Content
from amnesia.modules.account import Account
from amnesia.modules.state import St... | silenius/amnesia | amnesia/modules/content/mapper.py | Python | bsd-2-clause | 4,150 |
import unittest
import warnings
from unittest import mock
from django.db import DatabaseError, connection
from django.test import TestCase
@unittest.skipUnless(connection.vendor == 'postgresql', 'PostgreSQL tests')
class Tests(TestCase):
def test_nodb_connection(self):
"""
The _nodb_connection p... | uranusjr/django | tests/backends/postgresql/tests.py | Python | bsd-3-clause | 6,323 |
//codecademy course answer
# Reassign meal on line 7!
meal = 44.50
tax = 0.0675
tip = 0.15
meal = meal + meal * tax
| nurhandipa/python | codecademy/reassign_in_a_single_line.py | Python | gpl-3.0 | 119 |
from django.urls import path
from . import views
urlpatterns = [
path('',
views.AccountView.as_view(),
name='account'),
path('profile/',
views.ProfileUpdateView.as_view(),
name='account_profile'),
path('actions/',
views.ProfileActionsView.as_view(),
na... | liqd/a4-meinberlin | meinberlin/apps/account/urls.py | Python | agpl-3.0 | 345 |
# -*- 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 |
# coding: utf-8
import logger
import service
import common
import core
import tcp
import http
__version__ = '0.0.1'
VERSION = tuple(map(int, __version__.split('.')))
__all__ = [
'logger',
'service',
'common',
'core',
'http',
'tcp',
]
| slin1972/unity | unity/__init__.py | Python | apache-2.0 | 261 |
#!/usr/bin/env python
################################################################################
# bitly.py
# pyanalysis
#
# Created by Brian Baughman on 10/26/11.
# Copyright 2011 Brian Baughman. All rights reserved.
################################################################################
from os imp... | bbaugh/gcn-parser | coordConv.py | Python | gpl-2.0 | 1,818 |
# -*- coding: utf-8 -*-
try:
f1 = open("input.txt","r",encoding="utf-8")
except IOError:
print("Не удалось найти входной файл input.txt")
try:
f2 = open("output.txt","w",encoding="utf-8")
except IOError:
print("Не удалось открыть выходной файл output.txt")
import re # импортируем модуль работы с регу... | dimitrius-brest/katalog-poseleniy-RP | converter-vkwiki2md/convert2md.py | Python | cc0-1.0 | 3,623 |
from flask import abort
from flask import render_template
from flask import request
from flask import url_for
from flask.ext.wtf import Form
from wtforms import validators
from wtforms import IntegerField, RadioField, SelectField, TextField
from logcas.bootstrap import *
# forms
class LogIndexForm(Form):
page =... | yosshy/logcas | logcas/log_index.py | Python | apache-2.0 | 2,715 |
# (c) 2017, Patrick Deelman <patrick@patrickdeelman.nl>
# (c) 2017 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
DOCUMENTATION = """
lookup: passwordstore
vers... | alxgu/ansible | lib/ansible/plugins/lookup/passwordstore.py | Python | gpl-3.0 | 11,134 |
from sgp import SGP
from sgp import SGP2
from sgp import ASGP
__all__ = ['SGP',
'SGP2',
'ASGP']
| dvro/scikit-protopy | protopy/generation/__init__.py | Python | bsd-2-clause | 119 |
# -*- coding: utf-8 -*-
from .core import serialize, json_encode
import datetime
import pandas
from unittest import TestCase
df = pandas.DataFrame([
{'a': 1, 'b': 2, 'c': 3, 't': datetime.datetime(2015, 1, 1), 's': 's1'},
{'a': 2, 'b': 4, 'c': 6, 't': datetime.datetime(2015, 1, 2), 's': 's2'}
])
class CoreT... | albahnsen/pandas-highcharts | pandas_highcharts/tests.py | Python | mit | 4,413 |
import logging
import accounts
import log
import scriptlib
from collections import defaultdict
# noinspection PyUnusedLocal
def main(a, args):
a.timeout = 10
friends = scriptlib.getFriends(a, fields='country')
foll = scriptlib.getFollowers(a, fields='country')
c = defaultdict(int)
for u in frien... | kalinochkind/vkbot | scripts/countries.py | Python | mit | 567 |
# -*- coding: utf-8 -*-
# © <2016> <Moneygrid Project, Lucas Huber, Yannick Buron>
# based on account_wallet by Yannick Buron, Copyright Yannick Buron
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
import exchange_membership
| moneygrid/vertical-exchange | exchange_membership/__init__.py | Python | gpl-3.0 | 249 |
# Copyright 2015 The Kubernetes 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 ap... | sparkprime/helm | expansion/schema_validation_utils.py | Python | apache-2.0 | 3,726 |
from django.core.urlresolvers import reverse
from django.test import Client, TestCase
class LandingViewTestCase(TestCase):
def test_landing(self):
url = reverse('landing')
res = self.client.get(url)
self.assertEqual(200, res.status_code)
class LandingTestCase(TestCase):
def test_no_c... | frewsxcv/lop.farm | app/landing/tests.py | Python | mpl-2.0 | 544 |
# -*- encoding: utf-8 -*-
class SIS(object):
#u, v = 1, 2
#Lambda, Mu = -1./4., 2
def __init__(self):
self._lambda = -1./4.
self._mu = 2
self._u = 1
self._v = 2
@property
def Lambda(self):
return self._lambda
@Lambda.setter
def Lambda(self, n):
self._lambda = n
@property
def mu(se... | ElricleNecro/LibThese | LibThese/Models/SIS.py | Python | lgpl-3.0 | 559 |
# Copyright 2020 Binovo IT Human Project SL
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models, api
class AccountInvoiceRefund(models.TransientModel):
_inherit = 'account.invoice.refund'
@api.multi
def invoice_refund(self):
data_refund = self.read(['filter_re... | factorlibre/l10n-spain | l10n_es_ticketbai/wizard/account_invoice_refund.py | Python | agpl-3.0 | 475 |
# File: ReportingServer.py ; This file is part of Twister.
# version: 2.009
# Copyright (C) 2012-2013 , Luxoft
# Authors:
# Andrei Costachi <acostachi@luxoft.com>
# Andrei Toma <atoma@luxoft.com>
# Cristi Constantin <crconstantin@luxoft.com>
# Daniel Cioata <dcioata@luxoft.com>
# Licensed under the Apa... | twister/twister.github.io | server/ReportingServer.py | Python | apache-2.0 | 22,585 |
############################################################
## Balistic Motion Simulator, organic ##
## V0.5 ##
## function Cleaned ##
## Copyright 2015, Thomas Boudreaux ##
###############... | tboudreaux/BallisticSim | MainBallistic.py | Python | gpl-2.0 | 6,306 |
# _ UnionGen.py ____________________________________________________________________________
# File generated automatically by ATOM3. Graph Grammar Rule
# ___________________________________________________________________________________________
from GGrule import *
from ASG_TypesMetaModel import *
from ModelType... | Balannen/LSMASOMM | atom3/Kernel/TypeModels/UnionGen.py | Python | gpl-3.0 | 20,885 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2011 TUBITAK/UEKAE
#
# 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 ... | Pardus-Linux/buildfarm | buildfarm/pisiinterface.py | Python | gpl-2.0 | 3,559 |
import frappe
from frappe import _
change_icons_map = [
{
"module_name": "Patient",
"color": "#6BE273",
"icon": "fa fa-user",
"doctype": "Patient",
"type": "link",
"link": "List/Patient",
"label": _("Patient")
},
{
"module_name": "Patient Encounter",
"color": "#2ecc71",
"icon": "fa fa-stethoscop... | chdecultot/erpnext | erpnext/patches/v11_0/change_healthcare_desktop_icons.py | Python | gpl-3.0 | 2,450 |
from string import ascii_letters, digits
from django.shortcuts import get_object_or_404
from ngnotifier.settings import API_KEY
from random import choice
from _sha256 import sha224
from datetime import datetime
from uuid import uuid4
from django.core.validators import validate_email
from django.core.exceptions import ... | Dubrzr/NG-Notifier | ngnotifier/api_views.py | Python | mit | 23,722 |
#!/usr/bin/env python
# #
# Copyright 2009-2016 Ghent University
#
# This file is part of hanythingondemand
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
... | boegel/hanythingondemand | hod/subcommands/destroy.py | Python | gpl-2.0 | 4,546 |
# EFILTER Forensic Query Language
#
# Copyright 2015 Google 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
#
# Un... | google/dotty | efilter/transforms/solve.py | Python | apache-2.0 | 30,051 |
from modules.py532lib.NFC import NFC as NFC
print ('Write UID')
#write .UID in current dir
UID_FILE = ".UID"
def write_uid(uid):
f = open(UID_FILE,'w')
print("Write UID : %s"%str(uid))
uid = f.write(str(uid))
f.close
NFC.stop()
def stop(uid):
NFC.stop()
NFC.add_event_detect(N... | belese/luciphone | Luciphone/writeuid.py | Python | gpl-2.0 | 431 |
import uuid
def custom_receiver(sender, **kwargs):
"""
Set `youyouid` field with custom uuid.uuid4() ;)
"""
instance = kwargs['instance']
field_name = instance._base64field_name
if getattr(instance, field_name) in ['', None]:
gen_uuid = str(uuid.uuid4())
sender._default_manag... | Alir3z4/django-base64field | django_base64field/tests/receivers.py | Python | bsd-3-clause | 401 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.