code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# coding=utf-8
# --------------------------------------------------------------------------
# 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/network/azure-mgmt-network/azure/mgmt/network/v2021_05_01/aio/operations/_vpn_sites_configuration_operations.py | Python | mit | 8,266 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Proxy models for augmenting our source data tables with methods useful for processing.
"""
from __future__ import unicode_literals
from django.utils.text import get_text_list
# Models
from django.db.models import Count
from opencivicdata.elections.models import (
E... | california-civic-data-coalition/django-calaccess-processed-data | calaccess_processed_elections/proxies/opencivicdata/elections/elections.py | Python | mit | 11,031 |
#-------------------------------------------------------------------------------
# dump.py
# Dump binary files into C arrays.
#-------------------------------------------------------------------------------
Version = 3
import os.path
import yaml
import genutil
#--------------------------------------------------... | floooh/yakc | fips-files/generators/dump.py | Python | mit | 3,142 |
# 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 Disktype(MakefilePackage):
"""A fork of the disktype disk and disk image format detection ... | LLNL/spack | var/spack/repos/builtin/packages/disktype/package.py | Python | lgpl-2.1 | 741 |
#!/usr/bin/env python
#
# This file is part of Flap.
#
# Flap 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.
#
# Flap is distributed ... | fchauvel/flap | flap/latex/macros/inlining.py | Python | gpl-3.0 | 3,335 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-sql/azure/mgmt/sql/operations/databases_operations.py | Python | mit | 77,141 |
#!/usr/bin/env python
import math
import sys
inFile = open(sys.argv[1])
alnLine = inFile.readline()
vals = alnLine.split()
query = vals[16]
aln = vals[17]
target= vals[18]
i = 0
hplen = 6
nPATIns = 0
nPATDel = 0
nDel = query.count('-')
nIns = target.count('-')
nMismatch = 0
while (i < len(query)):
if (aln[i... | yunlongliukm/chm1_scripts | one_off/SummarizeM5Alignment.py | Python | mit | 1,973 |
import json
import os
import cloudstorage
from google.appengine.api import app_identity
import webapp2
import instagram
import taxonomy
BUCKET_NAME = os.environ.get(
'BUCKET_NAME', app_identity.get_default_gcs_bucket_name())
JSON_OUT = '/%s/birds.json' % BUCKET_NAME
cloudstorage.set_default_retry_params(
... | tonygentilcore/nerdbirder | scripts/regenerate_json_web.py | Python | gpl-3.0 | 1,044 |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from broadcasts.models import BroadcastMessage
from broadcasts.forms import BroadcastMessageForm
class BroadcastAdmin(admin.ModelAdmin):
"""Admin class for the broadcast messages"""
form = BroadcastMessageForm
list_d... | Natgeoed/django-broadcasts | broadcasts/admin.py | Python | mit | 1,181 |
import random
import time
import shelve
import math
import os
"""
IRC codes:
bold
4 hp red text
5 brown - Strength
11 dexterity
"""
channel = "#sunfields"
levels = [2,3,5,15,19,25,34,70,95,106,135,150,200,300,400,1000,100000]
heroes = {}
traits = ["spiky","cunning","burly","strong","ablaze","skilled","smart",... | Sebsebeleb/Sungod | libs/arena.py | Python | gpl-2.0 | 26,381 |
#www.stuffaboutcode.com
#Raspberry Pi, Minecraft Snake
#import the minecraft.py module from the minecraft directory
import minecraft
#import minecraft block module
import block
#import time, so delays can be used
import time
#import random module to create random number
import random
HOUSEWIDTH=6
HOUSEHEIGHT=2
def... | martinohanlon/minecraft-houses | minecraft-house-follow.py | Python | mit | 2,760 |
"""
This module contains base functions to parse different layouts
of the excel files produced by the TECAN infinite pro.
"""
import re
import datetime
import xlrd
import numpy as np
from ..curves import Curve
def parse_tecan(filename, sheet_index=None, info=False):
""" Parses a .xlsx file from a cinetic exp... | ibis-inria/wellFARE | wellfare/parsing/tecan.py | Python | lgpl-3.0 | 7,472 |
import os
import re
import gtk
import gio
import gobject
import pango
from xdg import BaseDirectory as base
from xdg import DesktopEntry as desktop
from kupfer import config, pretty, utils, icons, version
from kupfer import scheduler, kupferstring
from kupfer.core import settings, plugins, relevance, sources
from ku... | cjparsons74/kupfer | kupfer/ui/preferences.py | Python | gpl-3.0 | 30,515 |
""" Dummy Service is a service for testing new dirac protocol
This file must be copied in FrameworkSystem/Service to run tests
"""
__RCSID__ = "$Id$"
import six
from DIRAC import S_OK
from DIRAC.Core.DISET.RequestHandler import RequestHandler
# You need to copy ../DB/UserDB in DIRAC/FrameworkSystem/DB
from DIRAC.... | ic-hep/DIRAC | tests/Integration/TornadoServices/Services/UserDiracHandler.py | Python | gpl-3.0 | 1,849 |
# -*- coding: utf-8 -*-
"""
Implements the TwoSteps class
"""
from xfv.src.custom_functions.custom_function import CustomFunction
class TwoSteps(CustomFunction):
"""
This class defines a 2 constant steps function
.. image:: two_steps.png
:scale: 75 %
:align: center
"""
def __init_... | hippo91/XVOF | xfv/src/custom_functions/two_steps.py | Python | gpl-3.0 | 813 |
from datetime import datetime, tzinfo
try:
import pytz
except ImportError:
pytz = None
from django.template import Node
from django.template import TemplateSyntaxError, Library
from django.utils import six
from django.utils import timezone
register = Library()
# HACK: datetime is an old-style class, create... | edisonlz/fruit | web_project/base/site-packages/django/templatetags/tz.py | Python | apache-2.0 | 5,624 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
# Copyright 2020 MongoDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limit... | platformio/platformio-core | platformio/builder/tools/compilation_db.py | Python | apache-2.0 | 8,017 |
#!/bin/env python
# -*- coding: utf-8 -*
# vim: set sw=4:
import sys
import os
import logging
import time
import re
import random
import common
logger = logging.getLogger(__name__)
#
# Import python-uinput
#
version = "%d.%d" % sys.version_info[0:2]
uinput_include_path = "uinput/dst/lib64/python%s/site-packages/" %... | sdoumbouya/ovirt-node | tests/igor/libs/common/input.py | Python | gpl-2.0 | 5,460 |
'''
Created on 24.02.2017
@author: steinorb
'''
import unittest.mock
import read_arduino
import globvar
class ReadArduinoTest(unittest.TestCase):
def setUp(self):
globvar.measure0 = 0
@unittest.mock.patch('read_arduino.serial.Serial')
def testCorrectResult(self, mock_Serial):
... | tropi-frutti/facharbeit-fhg | multimeter/test/test_read_arduino.py | Python | mit | 1,728 |
#!/usr/bin/env python
import os
import sys
import subprocess
import shlex
import argparse
import random
import platform
CONFIG_PATH = os.path.expanduser('~/.config/wallpaperchanger.conf')
if sys.version_info.major == 2:
import ConfigParser as configparser
import Tkinter as tk
else: # major version == 3
im... | cocuh/WallpaperChanger | wallpaperchanger.py | Python | apache-2.0 | 10,701 |
import random, keras
import numpy as np
from keras.preprocessing import sequence
from scipy.spatial.distance import cosine
from keras.models import Model, Sequential
from keras.layers import Input, Dense, Dropout, Activation, Flatten, Merge, Embedding
from keras.layers import LSTM
#read Embedding if the word is in word... | jerrynlp/AutoSum | classification/cf_data.py | Python | mit | 8,761 |
#!/usr/bin/env python
'''
thermo_calc.py:
Calculate thermodynamic stability (minimum free energy (mfe) structures)
<Energy>
(1)miRNA seed region vs TargetRNA seed region
-------- miRNA(8nt_seed)
||||||||
-------- TargetRNA(8nt_seed)
(2)mature miRNA vs candidate target site (the same length)
-----------... | Naoto-Imamachi/MIRAGE | scripts/module/analysis/thermo_calc.py | Python | mit | 8,126 |
"""The :mod:`pyts.multivariate.utils` module includes utility tools."""
# Author: Johann Faouzi <johann.faouzi@gmail.com>
# License: BSD-3-Clause
from sklearn.utils import check_array
def check_3d_array(X):
"""Check that the input is a three-dimensional array.
Parameters
----------
X : array-like
... | johannfaouzi/pyts | pyts/multivariate/utils/utils.py | Python | bsd-3-clause | 589 |
"""A high-speed, production ready, thread pooled, generic HTTP server.
Simplest example on how to use this module directly
(without using CherryPy's application machinery)::
from cherrypy import wsgiserver
def my_crazy_app(environ, start_response):
status = '200 OK'
response_headers = [('Cont... | paolodoz/timesheet | cherrypy/wsgiserver/wsgiserver2.py | Python | gpl-2.0 | 88,589 |
#! /usr/bin/env python3
from ws.interactive import edit_interactive
from ws.client import API
from ws.utils import dmerge
from ws.parser_helpers.title import canonicalize
from ws.ArchWiki import lang
import mwparserfromhell
def page_language(page):
return lang.detect_language(page["title"])[1]
def edit(api: AP... | lahwaacz/wiki-scripts | localize-templates.py | Python | gpl-3.0 | 3,177 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, tools, _
from odoo.exceptions import UserError
class FleetVehicleCost(models.Model):
_name = 'fleet.vehicle.cost'
_descript... | dfang/odoo | addons/fleet/models/fleet.py | Python | agpl-3.0 | 35,182 |
# -*- coding: utf-8 -*-
from setuptools import setup, Command
name = "suitable"
description = "Suitable is a thin wrapper around the Ansible API."
def get_long_description():
with open('README.rst') as readme_file:
for line in readme_file.readlines():
if description in line:
... | seantis/suitable | setup.py | Python | gpl-3.0 | 1,752 |
# -*- coding: utf-8 -*-
import re
import os
import shutil
from expects import expect
from mamba import describe, context, before, after
from spec.ui._ipod_helpers import *
from spec.ui._fixture import update_environment
with describe('ipodio pull') as _:
@before.all
def setup_all():
update_environ... | jvrsantacruz/ipodio | spec/ui/pull_spec.py | Python | bsd-3-clause | 3,160 |
#!/usr/bin/python
# coding= utf-8
class Repubblica:
def __init__(self, file_frequenze):
self.massima_frequenza=0
self.dizionario_frequenze={}
self.dizionario_cumulato={}
self.calcola_frequenze (file_frequenze)
def calcola_frequenze(self, file_frequenze):
with open(file_frequenze, 'r') as f:
for l... | ellepannitto/Tesi | Repubblica.py | Python | gpl-3.0 | 691 |
"""AutoComplete.py - An IDLE extension for automatically completing names.
This extension can complete either attribute names of file names. It can pop
a window with all available names, for the user to select from.
"""
import os
import sys
import string
from idlelib.configHandler import idleConf
# This s... | Jeff-Tian/mybnb | Python27/Lib/idlelib/AutoComplete.py | Python | apache-2.0 | 9,194 |
import json
import oauth2 as oauth
import os
import urllib
import config
from resource import SharedResourceHandler
class TwitterAPI(object):
def __init__(self, env_settings):
self.rest_api = TwitterRestAPI(env_settings)
def get_resource(self, resource, params):
"""
Calls the Twitte... | celiala/twitter | client/twitter.py | Python | mit | 6,272 |
from env_checker_error import EnvCheckerError
class WritablePathError(Exception):
def __init__(self, path):
self.path = path
def resolve(self):
# TODO: Actually attempt to resolve this?
raise EnvCheckerError(
"Ice requires write access too `%s` to run." %
self.path)
| rdoyle1978/Ice | src/ice/error/writable_path_error.py | Python | mit | 303 |
#!/usr/bin/python
__author__="Paulo Victor Maluf"
__date__ ="$27/10/2014 13:35:12$"
from connection import Connect;
class Postgres(object):
def __init__(self, dsn=None):
self.dsn = dsn
self.connect()
def connect(self):
conn = Connect(self.dsn)
self.cursor = conn.cur()
... | pmaluf/pgzabbix | classes/postgres.py | Python | mit | 461 |
"""
Example 3: Saving all minima found to an xyz file
"""
from pygmin.systems import LJCluster
from pygmin.utils.xyz import write_xyz
natoms = 12
niter = 100
system = LJCluster(natoms)
db = system.create_database()
bh = system.get_basinhopping(database=db)
bh.run(niter)
with open("lowest", "w") as fout:
for mini... | js850/PyGMIN | examples/basinhopping/3_savelowest.py | Python | gpl-3.0 | 869 |
from collections import namedtuple
PurchasedItem = namedtuple('PurchasedItem',
'name, quantity, price, currency, sku')
class RedirectNeeded(Exception):
pass
class PaymentError(Exception):
pass
class ExternalPostNeeded(Exception):
pass
| artursmet/django-payments | payments/__init__.py | Python | bsd-3-clause | 281 |
controller = {
'leds': 16,
'neopixel_gpio_pin': 18,
'neopixel_frequency': 800000,
'neopixel_dma': 5,
'neopixel_invert': False,
'neopixel_brightness': 255,
'neopixel_channel': 0,
'neopixel_strip': 0x00081000
}
| bradcornford/Neopixel-Controller | neopixelcontroller/example.config.py | Python | mit | 241 |
'''
Module written by "mmrdns_write_python_slm_norm_fit_eqns.m". Fitting functions for searations constants of gravitatioal purterbations of Kerr.
'''
# Import useful things
from numpy import log,exp
# Domain map jf --> kappa( x =def [jf,l,m] ).
# NOTE that the function below MUST be consistent with the domain_map o... | llondon6/kerr_public | kerr/formula/ksm2_slm_norm.py | Python | mit | 2,772 |
# 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 David Mentré
# Copyright (C) 2009 Maxime Petazzoni
# Copyright (C) 2009 Thomas Petazzoni
# Copyright (C) 2009 Gaël Utard
# ... | wonderchook/MapOSMatic | www/maposmatic/context_processors.py | Python | agpl-3.0 | 1,602 |
# Copyright 2013 University of Chicago
class EEAgentParameterException(Exception):
def __init__(self, message):
Exception.__init__(self, message)
class EEAgentUnauthorizedException(Exception):
pass
class EEAgentSupDException(Exception):
def __init__(self, message):
Exception.__init_... | ooici/eeagent | eeagent/eeagent_exceptions.py | Python | apache-2.0 | 337 |
# Copyright 2011 Justin Santa Barbara
#
# 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... | CloudServer/cinder | cinder/tests/unit/test_utils.py | Python | apache-2.0 | 68,624 |
#
#
# Copyright (C) 2007, 2008, 2010, 2012 Google Inc.
# 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 notice,
# this list ... | apyrgio/ganeti | lib/http/__init__.py | Python | bsd-2-clause | 28,992 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-cognitiveservices-search-entitysearch/tests/test_entity_search.py | Python | mit | 2,330 |
#!/usr/bin/python
import server
import config
def main(server_class=server.MultiThreadedHTTPServer, handler_class=server.RequestHandler):
# set up the server socket based on values in config.py
server_address = (config.address, config.port)
# create the server object bound to the server socket
httpd = ... | nettux443/pywebframe | start.py | Python | bsd-2-clause | 686 |
#!/usr/bin/env python3
# Copyright (c) 2018-2019 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 wallet group functionality."""
from test_framework.test_framework import BitcoinTestFramework
fro... | OmniLayer/omnicore | test/functional/wallet_groups.py | Python | mit | 3,669 |
"""
WSGI config for ctlibre 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`` ... | dellsystem/ctlibre.com | ctlibre/wsgi.py | Python | agpl-3.0 | 1,422 |
#!/usr/bin/env python3
import gi
gi.require_version('LibvirtGObject', '1.0')
from gi.repository import LibvirtGObject
from gi.repository import Gio
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
LibvirtGObject.init_object_check(None)
conn = LibvirtGObject.Connection(uri="test:///default")
canc = Gio... | libvirt/libvirt-glib | examples/conn-test.py | Python | lgpl-2.1 | 1,252 |
##############################################################################
#
# Copyright (C) 2021 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Jonathan Guerne <guernej@compassion.ch>
#
# The licence is in the file __manifest__.py
#
################... | CompassionCH/compassion-switzerland | partner_communication_switzerland/wizards/onboarding_settings.py | Python | agpl-3.0 | 1,263 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Draft'
db.create_table('draft_draft', (
('id', self.gf('django.db.models.field... | platypus-creation/django-draft | draft/migrations/0001_initial.py | Python | mit | 1,137 |
from typing import Optional
from fastapi import FastAPI
from pydantic import BaseModel, EmailStr
app = FastAPI()
class UserIn(BaseModel):
username: str
password: str
email: EmailStr
full_name: Optional[str] = None
# Don't do this in production!
@app.post("/user/", response_model=UserIn)
async def ... | tiangolo/fastapi | docs_src/response_model/tutorial002.py | Python | mit | 363 |
"""
This is an example settings/local.py file.
These settings overrides what's in settings/base.py
"""
import logging
# To extend any settings from settings/base.py here's an example:
#from . import base
#INSTALLED_APPS = base.INSTALLED_APPS + ['debug_toolbar']
DATABASES = {
'default': {
'ENGINE': 'djang... | blorenz/SEO | mnms/settings/local-dist.py | Python | bsd-3-clause | 2,867 |
# Copyright (c) 2019 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
class ModuleDocFragment(object):
# Windows shell documentation fragment
# FIXME: set_module... | privateip/ansible | lib/ansible/plugins/doc_fragments/shell_windows.py | Python | gpl-3.0 | 1,460 |
import unittest
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from pyramid import testing
from .models import Session
DEFAULT_WAIT = 5
SCREEN_DUMP_LOCATION = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'screendumps'
)
class TestMyV... | recombinators/snapsat | app/app/tests.py | Python | mit | 3,083 |
#
# Copyright (C) 2009 Aaron C Spike
# 2010 Martin Owens
#
# 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 vers... | danieljabailey/inkscape_experiments | share/extensions/Barcode/Ean5.py | Python | gpl-2.0 | 1,528 |
#!/usr/bin/env python
from __future__ import print_function
import logging
import os
import six
import radiomics
from radiomics import featureextractor, getFeatureClasses
# Get some test data
# Download the test case to temporary files and return it's location. If already downloaded, it is not downloaded again,
#... | Radiomics/pyradiomics | examples/helloRadiomicsWithSettings.py | Python | bsd-3-clause | 1,904 |
#!/usr/bin/evn python
"""
Senty Project
Copyright(c) 2017 Senty.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful... | Kamalheib/senty | senty/packages/rdmacm/__init__.py | Python | gpl-2.0 | 790 |
# website/context_processors.py
from django.conf import settings
def ga_tracking_id(request):
return {'ga_tracking_id': settings.GA_TRACKING_ID}
def use_google_analytics(request):
return {'use_google_analytics': settings.USE_GA}
| ItsCalebJones/SpaceLaunchNow-Server | spacelaunchnow/context_processor.py | Python | apache-2.0 | 241 |
import pytest
import sys
from _pytest.skipping import MarkEvaluator, folded_skips, pytest_runtest_setup
from _pytest.runner import runtestprotocol
class TestEvaluator:
def test_no_marker(self, testdir):
item = testdir.getitem("def test_func(): pass")
evalskipif = MarkEvaluator(item, 'skipif')
... | JonathonSonesen/pytest | testing/test_skipping.py | Python | mit | 27,803 |
import statsmodels.api as sm
from load_macrodata import dta
cf_cycles, cf_trend = sm.tsa.filters.cffilter(dta[["infl", "unemp"]])
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
cf_cycles.plot(ax=ax, style=['r--', 'b-'])
| statsmodels/statsmodels.github.io | v0.11.1/plots/cff_plot.py | Python | bsd-3-clause | 233 |
from distutils.core import setup
try:
import sys
doc = ""
if "sdist" in sys.argv:
import threadio
doc = threadio.__doc__
while "[HIDE]" in doc:
a, _, c = doc.partition("[HIDE]")
doc = a + c.partition("[/HIDE]")[2]
except ImportError:
pass
setup(
name... | EcmaXp/threadio | setup.py | Python | mit | 870 |
saturday = True
sunday = False
if saturday or sunday:
print("Ok, you can sleep in")
team = input("Enter your favourite hockey team; ").upper()
sport = input("Enter your favourite sport: ").upper()
if sport == "FOOTBALL" and team == "BARCELONA":
print("putu amo")
elif team == "MADRID" or team =="ATLETICO":
... | aesquis/Introduccion-a-la-programacion-con-Python | 07-Decisiones-complejas-con-codigo/examples3or.py | Python | gpl-2.0 | 367 |
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
from openerp.osv import expression
from openerp.tools import float_is_zero
from openerp.tools import float_compare, float_round
from openerp.tools.misc import formatLang
from openerp.exceptions import UserError, ValidationError
import time
import math... | web30s/odoo-9.0c-20160402 | hello/templates/openerp/addons/account/models/account_bank_statement.py | Python | gpl-3.0 | 47,259 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# TrinityX documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 25 14:04:29 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
# a... | clustervision/trinityX | doc/conf.py | Python | gpl-2.0 | 9,991 |
# Natural Language Toolkit: Third-Party Contributions
# Contributions from the Massachusetts
# Institute of Technology
#
# Copyright (C) 2004 The original contributors
# URL: <http://nltk.sf.net>
#
# $Id: __init__.py,v 1.1 2004/03/09 05:06:28 stevenbird Exp $
"""
Contributions to NLTK made by students at Massachusetts... | ronaldahmed/SLAM-for-ugv | neural-navigation-with-lstm/MARCO/nltk_contrib/mit/__init__.py | Python | mit | 349 |
# This file is distributed under the terms of the GNU General Public license.
# Copyright (C) 2019 Erik Ogenvik (See the file COPYING for details).
import server
from atlas import Operation, Entity, Oplist
from physics import Vector3D, Quaternion
from world.utils import Usage
def shoot_in_direction(direction, insta... | worldforge/cyphesis | data/rulesets/deeds/scripts/world/objects/tools/Wand.py | Python | gpl-2.0 | 2,978 |
#
# 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 us... | mxm/incubator-beam | sdks/python/apache_beam/transforms/window.py | Python | apache-2.0 | 17,782 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import arating
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.db import ... | hzlf/openbroadcast.org | website/apps/abcast/models/basemodels.py | Python | gpl-3.0 | 8,118 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/xccdf_1_2/NoticeType.py | Python | gpl-3.0 | 1,060 |
from datetime import datetime
from decimal import Decimal
import os
from django import forms
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.forms.formsets import formset_factory
import commonware.log
import happyforms
from quieter_formset.formset import B... | SuriyaaKudoIsc/olympia | apps/addons/forms.py | Python | bsd-3-clause | 27,845 |
#!/usr/bin/env python
from functools import wraps
# DATABASE INTERACTION FUNCTIONS
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = connect_db()
return db
@app.teardown_appcontext
def close_connection(exception):
db = getattr(g, '_database', None)
if db ... | petr-tik/chess_app | app/database_funcs.py | Python | mit | 1,195 |
""" DIRAC DirectoryTree base class """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
__RCSID__ = "$Id$"
import six
import time
import threading
import os
import stat
from DIRAC import S_OK, S_ERROR, gLogger
from DIRAC.DataManagementSystem.DB.FileCatalogC... | ic-hep/DIRAC | src/DIRAC/DataManagementSystem/DB/FileCatalogComponents/DirectoryManager/DirectoryTreeBase.py | Python | gpl-3.0 | 46,573 |
#!/usr/bin/env python3
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.0')
from gi.repository import Gtk
from gi.repository import WebKit2 as WebKit
from src.Utils import Browser
COOKIES_TEXT = 0
COOKIES_SQLITE = 1
class MLBrowser():
def __init__(self):
self.window = Gtk.Window()... | fdibaldassarre/mload | src/Utils/Browser.py | Python | gpl-3.0 | 1,525 |
"""
owtf.lib.exceptions
~~~~~~~~~~~~~~~~~~~
Declares the framework exceptions and HTTP errors
"""
try:
from http.client import responses
except ImportError:
from httplib import responses
import tornado.web
class FrameworkException(Exception):
def __init__(self, value):
self.parameter = value
... | owtf/owtf | owtf/lib/exceptions.py | Python | bsd-3-clause | 2,149 |
import discord
from discord.ext import commands
from discord.ext.commands import Group, Paginator
import difflib
import itertools
# Use DefaultHelpCommand?
class HelpCommand(commands.HelpCommand):
'''Custom Help Command'''
def __init__(self, **options):
attrs = options.setdefault("command_attrs", {})
attrs... | Harmon758/Harmonbot | Discord/utilities/help_command.py | Python | mit | 12,533 |
# -*- coding: utf-8 -*-
import os
import sys
import shutil
from django.core.management.base import AppCommand
from django.core.management.color import color_style
from django_extensions.management.utils import _make_writeable, signalcommand
class Command(AppCommand):
help = "Creates a Django jobs command direct... | neilpelow/wmap-django | venv/lib/python3.5/site-packages/django_extensions/management/commands/create_jobs.py | Python | gpl-3.0 | 2,426 |
import ldap
import ldap.modlist
import collections
import random
# Example:
# with provision("ldap://localhost", "cn=admin,dc=nodomain", "foobar") as p:
# c = p.container(attr={"description":"foo"})
# l = p.leaf(c, attr={"description":"bar"})
def salt():
rng = random.SystemRandom()
return rng... | rootmos/ldapy | test/provisioning.py | Python | gpl-3.0 | 4,529 |
"""custom command to build doc.zip file"""
#=============================================================================
# imports
#=============================================================================
# core
import os
from distutils import dir_util
from distutils.cmd import Command
from distutils.errors impor... | cgstudiomap/cgstudiomap | main/eggs/passlib-1.6.5-py2.7.egg/passlib/_setup/docdist.py | Python | agpl-3.0 | 3,109 |
'''
development-py (c) University of Manchester 2017
development-py is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.
@author: neilswainston
'''
# pylint: disable=too-few-public-methods
import sys
import cobra
from cobra.util.solver import linear_reacti... | neilswainston/development-py | synbiochemdev/fba/analyse.py | Python | mit | 2,258 |
def main() -> None:
"""This is the entry point of the application!
Raises:
:class:`KeyboardInterrupt`, :class:`SystemExit`
"""
pass
| icgood/continuous-docs | docpkg/main.py | Python | unlicense | 160 |
#! /usr/bin/env python
###############################################################################
#
# simulavr - A simulator for the Atmel AVR family of microcontrollers.
# Copyright (C) 2001, 2002 Theodore A. Roth
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of th... | zouppen/simulavr | regress/test_opcodes/test_ANDI.py | Python | gpl-2.0 | 3,274 |
"""Contains the DeviceTypeParser class, for parsing reg-*.bld files."""
import os
import fnmatch
import logging
from bioloid.device_type import DeviceTypes, DeviceType
from bioloid.register import get_register_class
from bioloid.parse_utils import parse_int
DEBUG = True
class DeviceTypeParser(object):
"""Parse... | dhylands/Bioloid | bioloid/device_type_parser.py | Python | mit | 6,252 |
"""Tango Sphinx extension to automatically generate documentation
from a HLAPI Tango Device class."""
# Imports
from importlib import import_module
from sphinx.util import force_decode
from sphinx.application import Sphinx
from sphinx.ext.autodoc import ClassDocumenter, AttributeDocumenter
from sphinx.ext.autodoc impo... | vxgmichel/python-tango-devicedoc | devicedoc/devicedoc.py | Python | gpl-3.0 | 9,087 |
#!/usr/bin/env python
#
# Copyright 2008,2010,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your ... | iohannez/gnuradio | gr-wavelet/python/wavelet/qa_classify.py | Python | gpl-3.0 | 5,378 |
# -*- coding: utf-8 -*-
import os
import mock
import unittest
from flask import Flask
from nose.tools import * # noqa (PEP8 asserts)
import datetime
from tests.base import OsfTestCase
from tests.factories import RegistrationFactory
from framework.routing import Rule, json_renderer
from framework.utils import secure_... | petermalcolm/osf.io | tests/test_utils.py | Python | apache-2.0 | 16,788 |
# Patch transplanting extension for Mercurial
#
# Copyright 2006, 2007 Brendan Cully <brendan@kublai.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
'''command to transplant changesets from another branch
This extension allo... | joewalnes/idea-community | plugins/hg4idea/testData/bin/hgext/transplant.py | Python | apache-2.0 | 22,790 |
# ==================================================================================================
# Copyright 2014 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | rgs1/zktraffic | zktraffic/__init__.py | Python | apache-2.0 | 924 |
from django.apps import AppConfig
class FoodsConfig(AppConfig):
name = 'foods'
| chiara-paci/baskerville | baskervilleweb/foods/apps.py | Python | gpl-3.0 | 85 |
#!/usr/bin/env python
__author__ = "Vivek <vivek.balasubramanian@rutgers.edu>"
__copyright__ = "Copyright 2014, http://radical.rutgers.edu"
__license__ = "MIT"
__use_case_name__ = "'Gromacs + LSDMap' simulation-analysis proof-of-concept (ExTASY)."
from radical.ensemblemd import Kernel
from radic... | radical-cybertools/ExTASY | examples/grlsd-on-stampede/extasy_gromacs_lsdmap.py | Python | mit | 13,334 |
import sys
if sys.platform[:3]=='win':
try:
from setuptools import setup
from setuptools import Extension
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
else:
from distutils.core import setup
from Cython.Build import c... | Nassehk/Dilatometry-analysis | dilatometry/Cython tools/setup_master_fitter_utils.py | Python | gpl-3.0 | 524 |
import os
import re
from . import Helper
class BLSItem:
def __init__(self, blsName, srcDir):
if srcDir:
self.srcDir = srcDir
self.name = os.path.splitext(blsName.lower())[0]
self.blsFullName = os.path.join(srcDir, blsName)
else:
self.srcDir = Helper.getWorkingDirForFile(blsName) + '\\SOURCE'
self.n... | rusiv/BSScript | bsscript/BLSItem.py | Python | mit | 1,298 |
import os
# Run all tests in package for '-m unittest <test_package>'
def load_tests(loader, standard_tests, pattern):
this_dir = os.path.dirname(__file__)
if pattern is None:
pattern = "test*"
package_tests = loader.discover(start_dir=this_dir, pattern=pattern)
standard_tests.addTests(package_... | bitdancer/dinsd | src/test_support.py | Python | apache-2.0 | 1,123 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import commands
import filecmp
import logging
import os
import shutil
import sys
import tempfile
import urllib
import pyauto_funct... | zcbenz/cefode-chromium | chrome/test/functional/downloads.py | Python | bsd-3-clause | 22,621 |
# Lint as: python3
# Copyright 2020 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 ... | tensorflow/lingvo | lingvo/core/gshard_utils.py | Python | apache-2.0 | 16,840 |
import unittest
from os.path import join, dirname
try:
from unittest import mock
except ImportError:
import mock
from binstar_client.utils.notebook import Downloader
files = {'files': [
{'basename': 'notebook', 'version': '1'},
{'basename': 'notebook', 'version': '2'},
{'basename': 'data', 'versi... | GiovanniConserva/TestDeploy | venv/Lib/site-packages/binstar_client/utils/notebook/tests/test_downloader.py | Python | bsd-3-clause | 1,802 |
import _plotly_utils.basevalidators
class ColorsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="colors", parent_name="funnelarea.marker", **kwargs):
super(ColorsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/funnelarea/marker/_colors.py | Python | mit | 406 |
from flask import Blueprint
from flask_restful import Api, Resource, reqparse, inputs
from splice.queries.distribution import get_possible_distributions
from splice.web.api.tile_upload import artifacts_upload
dist_bp = Blueprint('api.distributions', __name__, url_prefix='/api')
api = Api(dist_bp)
arg_parser = reqpar... | ncloudioj/splice | splice/web/api/distribution.py | Python | mpl-2.0 | 1,877 |
"""Testing for K-Medoids"""
import warnings
import numpy as np
from unittest import mock
from scipy.sparse import csc_matrix
import pytest
from sklearn.datasets import load_iris, fetch_20newsgroups_vectorized
from sklearn.metrics.pairwise import PAIRWISE_DISTANCE_FUNCTIONS
from sklearn.metrics.pairwise import euclidea... | scikit-learn-contrib/scikit-learn-extra | sklearn_extra/cluster/tests/test_k_medoids.py | Python | bsd-3-clause | 14,171 |
import numpy as np
import cv2
import rospy
from cv_bridge import CvBridge, CvBridgeError
import math
import vision_utils
from sub_vision.msg import TrackObjectFeedback
from sensor_msgs.msg import Image
from sub_vision.msg import feedback
def angle_cos(p0, p1, p2):
d1, d2 = (p0-p1).astype('float'), (p2-p1).asty... | RoboticsClubatUCF/RoboSub | ucf_sub_catkin_ros/src/sub_vision/src/gatefinder.py | Python | mit | 4,674 |
from bs4 import BeautifulSoup
from datetime import datetime
from scraper import *
from general import General
import traceback
def get_arrival_time(arrival_time_str):
arrival_time_strip = arrival_time_str.split(' ')[0]
time = datetime.strptime(arrival_time_strip, '%H:%M:%S').time()
now = datetime.now()
... | yosh778/OG-Bot | ogbot/scraping/movement.py | Python | mit | 4,623 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | asomya/test | horizon/dashboards/nova/dashboard.py | Python | apache-2.0 | 1,315 |
from datetime import datetime, timedelta, timezone
from email.headerregistry import Address
import signal
from typing import Optional
import attr
from eletter import BytesAttachment
import pytest
from pytest_mock import MockerFixture
from daemail import util
from daemail.message import DraftMessage
from daemail.reporte... | jwodder/daemail | test/test_reporter.py | Python | mit | 28,357 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.