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 -*-
from django.contrib.auth.models import User
from cms.models import Page
from menus.templatetags.menu_tags import show_menu
from django.conf import settings
from cms.tests.base import CMSTestCase
from menus.menu_pool import menu_pool
from cms.tests.util.menu_extender import TestMenu
class NavExt... | dibaunaumh/tikal-corp-website | cms/tests/navextender.py | Python | bsd-3-clause | 3,535 |
#!/usr/bin/env python
import rospy
from python_qt_binding.QtCore import Qt, QSize, QRegExp, Signal, Slot
from python_qt_binding.QtGui import QWidget, QRegExpValidator, QHBoxLayout, QPushButton, QComboBox, QIcon
# widget for topic selection
class QTopicWidget(QWidget):
topic_changed_signal = Signal(str)
def... | TRECVT/vigir_footstep_planning_basics | vigir_footstep_planning_lib/src/vigir_footstep_planning_lib/topic_widget.py | Python | gpl-3.0 | 3,225 |
# -*- coding: utf-8 -*-
import json
from collections import namedtuple
from Exceptions import FieldLengthOverflow
__author__ = '[email protected]'
class Fixed_files(object):
def __init__(self, filejson, obj=False, dic=False, checklength=False):
self.dic = dic
self.checklength = checklength... | flavio-casacurta/File-FixedS | fixed_files.py | Python | mit | 4,849 |
from nose.core import collector, main, run, run_exit, runmodule
# backwards compatibility
from nose.exc import SkipTest, DeprecatedTest
from nose.tools import with_setup
__author__ = 'Jason Pellerin'
__versioninfo__ = (1, 1, 0)
__version__ = '.'.join(map(str, __versioninfo__))
__all__ = [
'main', 'run', 'run_exit... | mozilla/sheriffs | vendor-local/src/python-nose/nose/__init__.py | Python | bsd-3-clause | 404 |
def invert_index(idx):
out = {}
for k,v in idx.iteritems():
out[v] = k
return out
FILE_TYPES = {
'png':'image/png',
'jpg':'image/jpeg',
'gif':'image/gif',
'html':'text/html',
'css':'text/css',
'js':'text/javascript'
}
EXTENSION_TYPES = invert_index(FILE_TYPES)
def extensi... | gagoel/acre | utilities/acp/extension_map.py | Python | apache-2.0 | 1,124 |
"""Create member database
Revision ID: 4beef05c5ec
Revises:
Create Date: 2017-02-05 15:54:06.706073
"""
# revision identifiers, used by Alembic.
revision = '4beef05c5ec'
down_revision = None
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
... | dark-echo/Bay-Oh-Woolph | alembic/versions/4beef05c5ec_create_member_database.py | Python | agpl-3.0 | 629 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 Andrey Antukh <[email protected]>
# Copyright (C) 2014-2016 Jesús Espino <[email protected]>
# Copyright (C) 2014-2016 David Barragán <[email protected]>
# Copyright (C) 2014-2016 Alejandro Alonso <[email protected]>
# This program is free software: you can r... | xdevelsistemas/taiga-back-community | taiga/front/urls.py | Python | agpl-3.0 | 2,292 |
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QProcess
import re, os
import mooseutils
from peacock.base import MooseWidget
from peacock.utils import TerminalUtils
class JobRunner(QObject, MooseWidget):
"""
Actually runs the process. It will read the output and
translate any terminal color codes ... | Chuban/moose | python/peacock/Execute/JobRunner.py | Python | lgpl-2.1 | 4,549 |
"""
This module converts requested URLs to callback view functions.
RegexURLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a tuple in this format:
(view_function, function_args, function_kwargs)
"""
from __future__ import unicode_literals
import re
from threading impo... | postrational/django | django/core/urlresolvers.py | Python | bsd-3-clause | 22,114 |
import re
import logging
from functools import wraps
from flask import render_template
from flask.ext.login import current_user
logger = logging.getLogger('PRG')
def requires_roles(*roles):
def wrapper(f):
@wraps(f)
def wrapped(*args, **kwargs):
for rol in current_user.roles:
... | matibarriento/pririgardus | Pririgardus/helpers.py | Python | gpl-2.0 | 845 |
# Copyright (C) 2016-2020 Free Software 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 3 of the License, or
# (at your option) any later version.
#
# This progr... | mattstock/binutils-bexkat1 | gdb/testsuite/gdb.perf/skip-command.py | Python | gpl-2.0 | 1,259 |
# coding=utf8
# Copyright © 2015-2017 Cask Data, 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 a... | cdapio/cdap-ambari-service | src/main/resources/common-services/CDAP/6.0.0/package/scripts/master.py | Python | apache-2.0 | 4,572 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ContractType(models.Model):
_name = 'hr.contract.type'
_description = 'Contract Type'
name = fields.Char(required=True)
class HrPayrollStructureType(models.Model):
... | jeremiahyan/odoo | addons/hr_contract/models/hr_contract_type.py | Python | gpl-3.0 | 724 |
# -*- coding:utf-8 -*-
# !/usr/bin/env python
import os
import time
from ruia import Spider, Item, TextField, AttrField
from ruia_ua import middleware
os.environ['MODE'] = 'PRO'
from owllook.database.mongodb import MotorBaseOld
class QidianNovelInfoItem(Item):
"""
定义继承自item的Item类
"""
novel_name = T... | howie6879/novels-search | owllook/spiders/qidian_novel_info.py | Python | apache-2.0 | 3,167 |
"""Scraper for the 1st District Court of Appeals
CourtID: ohio
Court Short Name: Ohio
Author: Andrei Chelaru
"""
from juriscraper.opinions.united_states.state import ohio
class Site(ohio.Site):
def __init__(self):
super(Site, self).__init__()
self.court_id = self.__module__
self.court_ind... | brianwc/juriscraper | opinions/united_states/state/ohioctapp_10.py | Python | bsd-2-clause | 390 |
# Copyright 2017 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... | mlperf/training_results_v0.7 | Google/benchmarks/maskrcnn/implementations/maskrcnn-research-TF-tpu-v4-16/object_detection/minibatch_sampler.py | Python | apache-2.0 | 3,226 |
# Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
#
# 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 ... | www220/esp-idf | tools/tiny-test-fw/Utility/LineChart.py | Python | apache-2.0 | 1,681 |
# Copyright 2010 Hakan Kjellerstrand [email protected]
#
# 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 ... | pombredanne/or-tools | examples/python/bus_schedule.py | Python | apache-2.0 | 3,281 |
from datetime import datetime
from itertools import product
import numpy as np
import pytest
from xarray import (
DataArray,
Dataset,
auto_combine,
combine_by_coords,
combine_nested,
concat,
)
from xarray.core import dtypes
from xarray.core.combine import (
_check_shape_tile_ids,
_comb... | shoyer/xarray | xarray/tests/test_combine.py | Python | apache-2.0 | 38,646 |
# Copyright 2016 Pinterest, 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 writi... | yongwen/teletraan | deploy-board/deploy_board/webapp/cluster_view.py | Python | apache-2.0 | 42,506 |
#coding=utf-8
from fontTools.pens.basePen import BasePen
class AbstractShiftPen(BasePen):
"""
Move a glyph’s x and y coordinates by xShift and yShift respectively.
In itself, the pen doesn’t ‘draw’ anything, it just collects coordinates,
adds xShift and yShift, and prints the resulting coordinates f... | loicsander/RobofabPens | examples/shiftPen.py | Python | mit | 2,386 |
#from sys import argv
#script, filename = argv
#txt = open(filename)
#print "Here's your file %r:" % filename
#print txt.read()
cctxt = open("CentralCorridor_text.txt")
print cctxt.read()
| mwweinberg/classgame | sketchpad.py | Python | mit | 194 |
#
# Copyright 2018 Red Hat | Ansible
#
# This file is part of Ansible
#
# Ansible 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.
#
# ... | cryptobanana/ansible | lib/ansible/module_utils/k8s/lookup.py | Python | gpl-3.0 | 7,977 |
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Products.COBAInternship.tests.COBAInternshipTestCase import COBAInternshipTestCase
from Products.CMFCore.WorkflowCore import WorkflowException
import transaction
class TestCOBAInternship(COBAInternshipTestCase):
... | uwosh/COBAInternship | tests/testCOBAInternshipApplication.py | Python | gpl-2.0 | 833 |
# 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/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2019_08_01/aio/operations/_jobs_operations.py | Python | mit | 4,734 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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... | littleq0903/build_pybossa_docker | conf/settings_local.py | Python | mit | 4,934 |
"""Add a column user_id which will be used to persist uuid.
Revision ID: 8608c3fa6d42
Revises: 62010067944d
Create Date: 2020-12-28 18:42:36.142944
"""
# revision identifiers, used by Alembic.
revision = '8608c3fa6d42'
down_revision = '62010067944d'
branch_labels = None
depends_on = None
from alembic import op
impo... | fabric8-analytics/fabric8-analytics-worker | alembic/versions/8608c3fa6d42_add_a_column_user_id_which_will_be_used_.py | Python | gpl-3.0 | 778 |
#!/usr/bin/python
from flask import Flask, request
from flask_debugtoolbar import DebugToolbarExtension
from linode import api as l
from cloudflare import CloudFlare as CF
import os
import yaml
config = yaml.load(open('config.yml'))
app = Flask(__name__)
app.debug = config['DYN_DEBUG'] == '1'
if app.debug:
app.confi... | ashneo76/dynip | app.py | Python | mit | 3,009 |
#!/usr/bin/env python
#
# Author: Qiming Sun <[email protected]>
#
import tempfile
import numpy
import h5py
from pyscf import gto, scf, ao2mo
'''
Integral transformation for irregular operators
'''
mol = gto.M(
verbose = 0,
atom = [
[8 , (0. , 0. , 0.)],
[1 , (0. , -0.757 , 0.587)],
[1 , (... | gkc1000/pyscf | examples/ao2mo/20-eri_grad_hess.py | Python | apache-2.0 | 2,223 |
#!/usr/bin/python
# Copyright (C) Vladimir Prus 2005.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
# Tests that we can build a project when the current directory is outside of
# that project tree, that is 'bjam s... | davehorton/drachtio-server | deps/boost_1_77_0/tools/build/test/out_of_tree.py | Python | mit | 858 |
import cherrypy
import logging
from hqlib.sql.models import Worker
import datetime
from hqmanager import unix_time_millis
class WorkerAPIController(object):
exposed = True
def __init__(self, database):
self.logger = logging.getLogger("hq.manager.api.worker")
self.database = database
@ch... | herqles-io/hq-manager | src/hqmanager/api/worker.py | Python | mit | 2,108 |
'''
Created on Aug 26, 2014
@author: moloyc
'''
import unittest
from sqlalchemy import exc
from jnpr.openclos.dao import Dao
from jnpr.openclos.model import Pod, Device, Interface, InterfaceLogical, InterfaceDefinition
class TestDao(unittest.TestCase):
def setUp(self):
'''Creates Dao with in-mem... | sysbot/OpenClos | jnpr/openclos/tests/unit/test_dao.py | Python | apache-2.0 | 2,662 |
# -*- coding: utf-8 -*-
#
# CampbellSiegert.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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... | mdjurfeldt/nest-simulator | pynest/examples/CampbellSiegert.py | Python | gpl-2.0 | 6,677 |
#Exercise 1.7: Find error(s) in a program
#Author: Andreas Solberg Sagen - University of Oslo
| exTerEX/PrimeOnScientificProgramming | Chapter 1/find_errors_sin1.py | Python | mit | 94 |
# Copyright 2015 Mirantis, 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, s... | mcloudv/fuel-ostf | fuel_health/tests/configuration/test_configuration.py | Python | apache-2.0 | 4,244 |
import bpy
import arm.assets as assets
import arm.utils
import arm.log as log
import arm.make_state as state
import arm.api
callback = None
def add_world_defs():
wrd = bpy.data.worlds['Arm']
rpdat = arm.utils.get_rp()
# Screen-space ray-traced shadows
if rpdat.arm_ssrs:
wrd.world_defs += '_SS... | luboslenco/cyclesgame | blender/arm/make_renderpath.py | Python | lgpl-3.0 | 13,259 |
from django.contrib import admin
from .models import Contact
# Register your models here.
class ContactModelAdmin(admin.ModelAdmin):
list_display = ('from_name', 'to_name', 'date_added')
admin.site.register(Contact)
| howinator/GimmeThat | src/contact/admin.py | Python | gpl-3.0 | 224 |
# Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
# Use, modification and distribution is subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Test all_reduce() collective.
from __future__ import print_functi... | davehorton/drachtio-server | deps/boost_1_77_0/libs/mpi/test/python/all_reduce_test.py | Python | mit | 1,175 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-23 16:19
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('accounts', '0005_user_indeces'),
]
operatio... | ta2-1/pootle | pootle/apps/accounts/migrations/0006_unicode_usernames_are_valid.py | Python | gpl-3.0 | 735 |
#!/usr/bin/env python
# coding=utf-8
#
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
import httplib
import sys
def test(name,A,B):
if A != B:
print "Error :" + name
print "-----Actual--"
print A,"---Expected--"
print B,"-------------"
sys.exit(1)
else:
... | invicnaper/MWF | Utils/t/form_test.py | Python | gpl-2.0 | 10,150 |
import logging, argparse, os, sys, re
import numpy as np
from collections import OrderedDict
from .utils import getWorkDirs, getEnergy4Key
from ..ccsgp.ccsgp import make_panel, make_plot
from ..ccsgp.utils import getOpts
from ..ccsgp.config import default_colors
from decimal import Decimal
import uncertainties.umath as... | tschaume/ccsgp_get_started | ccsgp_get_started/examples/gp_ptspec.py | Python | mit | 10,339 |
#!/usr/bin/env python2
# This is a component of AXIS, a front-end for linuxcnc
# Copyright 2004, 2005, 2006 Jeff Epler <[email protected]>
# and Chris Radek <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GN... | araisrobo/linuxcnc | src/emc/usr_intf/axis/scripts/linuxcnctop.py | Python | lgpl-2.1 | 7,389 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView, ListView
from accounts.views import DashTemplateView
import accounts.views
urlpatterns = [
url(r'^$', login_required(Dash... | davogler/POSTv3 | accounts/urls.py | Python | mit | 676 |
#!/usr/bin/env python
import argparse
import logging
import sys
from Bio import SeqIO, Alphabet
from Bio.Alphabet import IUPAC
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from Bio.SeqFeature import SeqFeature, FeatureLocation
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
def fiveCo... | TAMU-CPT/galaxy-tools | tools/gbk/five_col_to_gbk.py | Python | gpl-3.0 | 3,243 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-05-21 16:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0050_merge'),
]
operations = [
migrations.AlterModelOptions(
... | Alaxe/judgeSystem | judge/migrations/0051_auto_20160521_1932.py | Python | gpl-2.0 | 1,608 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: feature-scale-param.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflecti... | FederatedAI/FATE | python/federatedml/protobuf/generated/feature_scale_param_pb2.py | Python | apache-2.0 | 7,513 |
def b36encode(number, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
"""Converts an integer to a base36 string.
http://en.wikipedia.org/wiki/Base_36#Python_implementation
"""
if not isinstance(number, (int, long)):
raise TypeError('number must be an integer')
base36 = ''
sign = ''
... | okffi/decisions | web/decisions/ahjo/utils.py | Python | bsd-3-clause | 664 |
'''Batch index URLs to tracker items.'''
import argparse
def main():
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('file')
args = arg_parser.parse_args()
batch = set()
category = True
with open(args.file) as f:
for line in f:
name = line.strip().replace(... | ArchiveTeam/yahoo-voices-grab | utils/index2items.py | Python | unlicense | 958 |
from biicode.client.exception import ClientException
from biicode.client.store.sqlite import SQLiteDB, encode_serialized_value, decode_serialized_value
from biicode.common.model.content import ContentDeserializer
from biicode.common.model.cells import CellDeserializer
from biicode.common.utils.bii_logging import logger... | drodri/client | store/localdb.py | Python | mit | 10,218 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-15 14:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('phrasebook', '0010_auto_20170415_1417'),
]
operations ... | DanCatchpole/phrasebook-django | phrasebook/migrations/0011_auto_20170415_1518.py | Python | mit | 538 |
# -*- coding: utf-8 -*-
import re
from .base import BikeShareSystem, BikeShareStation
from . import utils
class Movete(BikeShareSystem):
meta = {
'system': 'Movete',
'company': ['Sistema de Transporte Metropolitano',
'Intendencia de Montevideo']
}
url = 'http://movet... | javnik36/pybikes | pybikes/movete.py | Python | lgpl-3.0 | 1,561 |
import logging
import pickle
import random
from gevent import Greenlet, sleep
from threading import Lock
from app import create_app
from dota_bot import DotaBot
from models import db, DynamicConfiguration, Game, GameStatus, GameVIP
from helpers.general import divide_vip_list_per_type
# Log
logging.basicConfig(format=... | FroggedTV/grenouilleAPI | backend/bot_app.py | Python | gpl-3.0 | 3,850 |
import numpy as np
import pandas as pd
from pipeline_helper_functions import *
from bag_of_words import *
# list of possible vertex metrics
vertex_metrics = ['indegree', 'outdegree', 'degree', 'd_pagerank',
'u_pagerank', 'd_closeness', 'u_closeness',
'd_betweenness', 'u_betweenness... | idc9/law-net | vertex_metrics_experiment/code/get_edge_data.py | Python | mit | 4,783 |
# Copyright (C) 2018-2019 Matthias Klumpp <[email protected]>
#
# Licensed under the GNU Lesser General Public License Version 3
#
# 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, eith... | lkorigin/laniakea | src/rubicon/rubicon/fileimport.py | Python | gpl-3.0 | 6,906 |
import pandas as pd
import datetime
def createTW(df):
def add_tw(x):
minute = x.minute
tw_minute = -1
if minute < 20:
tw_minute = 0
elif minute < 40:
tw_minute = 20
elif minute <= 60:
tw_minute = 40
return x.replace(minute=tw_min... | Superchicken1/SambaFlow | python/traffic-prediction/src/vector_gen/createTW.py | Python | apache-2.0 | 847 |
import urllib
import json
import requests
import time
from collections import namedtuple
from config import CONFIG
class GoogleStreetView(object):
# For passing the parameters to the API
StreetViewParam = namedtuple("StreetViewParam", ["lat", "lng", "heading", "pov", "pitch"])
# the api request address
... | jasonlingo/StreetViewRoadSafety | src/googleStreetView.py | Python | mit | 2,942 |
#!/usr/bin/python
#
#Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import sys
import argparse
import ConfigParser
from provision_dns import DnsProvisioner
from requests.exceptions import ConnectionError
class AddVirtualDns(object):
def __init__(self, args_str = None):
self._args = None... | Juniper/contrail-controller-test | src/dns/scripts/add_virtual_dns.py | Python | apache-2.0 | 4,324 |
""" JSON service providing IEMRE data for a given point """
import os
import datetime
import json
import numpy as np
from paste.request import parse_formvars
from pyiem import iemre
from pyiem.util import ncopen, convert_value
import pyiem.prism as prismutil
def myrounder(val, precision):
"""round a float or giv... | akrherz/iem | htdocs/iemre/daily.py | Python | mit | 5,523 |
# (c) 2012, Jan-Piet Mens <jpmens(at)gmail.com>
# (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: redis_kv
author: Jan-Piet M... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/lookup/redis_kv.py | Python | bsd-3-clause | 2,846 |
# 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 | utils/__init__.py | Python | apache-2.0 | 605 |
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2014 Thomas Perl and the gPodder Team
# Copyright (c) 2011 Neal H. Walfield
#
# gPodder is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... | somini/gpodder | src/gpodder/util.py | Python | gpl-3.0 | 54,845 |
import greengraph
if __name__ == '__main__':
from matplotlib import pyplot as plt
mygraph = greengraph.Greengraph('New York','Chicago')
data = mygraph.green_between(20)
plt.plot(data)
plt.show()
| padraic-padraic/MPHYSG001_CW1 | example.py | Python | gpl-2.0 | 216 |
import numpy as np
class Conversions:
MPH_TO_MS = 1.609/3.6
MS_TO_MPH = 3.6/1.609
KPH_TO_MS = 1./3.6
MS_TO_KPH = 3.6
MPH_TO_KPH = 1.609
KPH_TO_MPH = 1./1.609
KNOTS_TO_MS = 1/1.9438
MS_TO_KNOTS = 1.9438
# Car tecode decimal minutes into decimal degrees, can work with numpy arrays as input
@staticme... | damienstanton/nanodegree | selfdriving_vehicle/openpilot/selfdrive/config.py | Python | mit | 2,706 |
import random
random.seed()
randint = random.randint
def roll2d6():
"""Returns a tuple containing the results of the two d6 rolls"""
return (randint(1,6), randint(1,6))
| ddossett/python-tutorial | scripts/dungeonworld/dwtools.py | Python | mit | 178 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2012 Uwe Hermann <[email protected]>
##
## 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 Li... | robacklin/sigrok | libsigrokdecode/decoders/tlc5620/pd.py | Python | gpl-3.0 | 4,650 |
from itertools import cycle, chain
def fence_pattern(rails, size):
zig_zag = cycle(chain(range(rails), range(rails - 2, 0, -1)))
return zip(zig_zag, range(size))
def encode(msg, rails):
fence = fence_pattern(rails, len(msg))
return ''.join(msg[i] for _, i in sorted(fence))
def decode(msg, rails):
... | rootulp/xpython | exercises/rail-fence-cipher/example.py | Python | mit | 490 |
#!/usr/bin/env python
# Experiments with coefficients of a geometric plane
# Resources:
# http://www.wolframalpha.com/input/?i=plane+through+(1,-2,0),(4,-2,-2),(4,1,4)&lk=3
# ==> 2 x - 6 y + 3 z + 14 == 0
# Translate a point relative to some origin
from __future__ import print_function
def translate(point, ori... | Traumflug/Teacup_Firmware | research/planes.py | Python | gpl-2.0 | 2,998 |
from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParametersCable, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersATSC
from Components.NimManager import nimmanager
def orbpos(pos):
return pos > 3600 and "N/A" or "%d.%d\xc2\xb0%s" % (pos > 1800 and ((3600 - pos) / 10, (3600 - pos) % 10, "W") or... | BlackHole/enigma2-1 | lib/python/Tools/Transponder.py | Python | gpl-2.0 | 12,359 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.ap... | shootstar/novatest | nova/virt/hyperv/hostutils.py | Python | apache-2.0 | 2,964 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SingleSidedBuffer.py
--------------------
Date : August 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
*************... | geopython/QGIS | python/plugins/processing/algs/qgis/SingleSidedBuffer.py | Python | gpl-2.0 | 4,922 |
# -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
DATE_FORMAT = 'j בF Y'
TIME_FORMAT = 'H:i:s'
DATETIME_FORMAT = 'j בF Y H:i:s'
YEAR_MONTH_FORMAT = 'F Y'
MONTH_DAY_FORMAT = 'j בF'
SHORT_DATE_FORMAT = 'd/m/Y'
SHORT_DATETIME_FORMAT = 'd/m/Y H:i:s'
# FIRST_DAY_OF_WEEK = ... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.2/django/conf/locale/he/formats.py | Python | bsd-3-clause | 470 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('branches', '0008_project_change_branch_task_id'),
]
operations = [
migrations.RemoveField(
model_name='project',... | codedbyjay/django-branches | branches/migrations/0009_auto_20151225_0235.py | Python | gpl-2.0 | 565 |
from time import clock
start_time = 0
def start(string):
start_time = clock()
print string
def finish(string):
print string, "\nTime Taken : " + str(clock() - start_time)
| saurv4u/Deep-Learning-for-Content-Retrieval | Code/time_logging.py | Python | mit | 187 |
import lsst.meas.modelfit
import lsst.shapelet
# ==> WARNING <== CModel cannot be run on forcedCcd at the moment
#config.measurement.plugins.names |= ["modelfit_DoubleShapeletPsfApprox", "modelfit_CModel"]
#config.measurement.slots.modelFlux = "modelfit_CModel"
# modelfit_CModel is the default to compute source exten... | LSSTDESC/ReprocessingTaskForce | config/w_2018_07/cfht/forcedPhotCcdConfig.py | Python | gpl-2.0 | 1,047 |
#
# Copyright (c) 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | NervanaSystems/coach | rl_coach/architectures/head_parameters.py | Python | apache-2.0 | 16,531 |
"""activities URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | studentisgss/booking | events/urls.py | Python | gpl-3.0 | 1,541 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Parameter.is_input'
db.delete_column(u'damis_parameter'... | InScience/DAMIS-old | src/damis/migrations/0029_auto__del_field_parameter_is_input__del_field_parameter_is_output.py | Python | agpl-3.0 | 9,408 |
# -*- coding:utf-8 -*-
# @author xupingmao
# @since 2021/12/04 15:36:42
# @modified 2021/12/11 11:10:20
# @filename dbutil.py
from xutils.dbutil_base import *
from xutils.dbutil_table import *
from xutils.dbutil_hash import *
from xutils.dbutil_sortedset import *
def _get_table_no_lock(table_name):
table = LDB_TA... | xupingmao/xnote | xutils/dbutil.py | Python | gpl-3.0 | 1,292 |
#!/usr/bin/python3
# This file is part of NDR.
#
# NDR 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.
#
# NDR is distributed in the ho... | SecuredByTHEM/ndr | ndr/tools/process_message.py | Python | gpl-3.0 | 6,145 |
# 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.
"""Generic utils."""
import codecs
import logging
import os
import pipes
import Queue
import re
import stat
import subprocess
import sys
import tempfile... | coreos/depot_tools | gclient_utils.py | Python | bsd-3-clause | 28,957 |
import json
import logging
from collections import namedtuple
from typing import TYPE_CHECKING, List, Dict
import arrow
import requests
from six import StringIO, BytesIO
from pyEchosign.classes.documents import AgreementDocument
from pyEchosign.exceptions.internal import ApiError
from pyEchosign.utils.ut... | JensAstrup/pyEchosign | pyEchosign/classes/agreement.py | Python | mit | 19,895 |
'''
Created on Apr 6, 2016
@author: Alex Ip, Geoscience Australia
'''
import sys
import netCDF4
import subprocess
import re
from geophys2netcdf import ERS2NetCDF
def main():
assert len(
sys.argv) == 4, 'Usage: %s <root_dir> <file_template> <start_id>' % sys.argv[0]
root_dir = sys.argv[1]
file_tem... | alex-ip/geophys2netcdf | utils/set_ecat_ids.py | Python | apache-2.0 | 1,510 |
#!~/python
import fluidity_tools
import matplotlib as mpl
mpl.use('ps')
import matplotlib.pyplot as plt
import myfun
import numpy as np
from scipy import optimize
import os
import scipy.stats as sp
import scipy
import lagrangian_stats
import advect_functions
import csv
# read offline
print 'reading offline'
#exp = '... | jungla/ICOM-fluidity-toolbox | Detectors/offline_advection/plot_RDinset_fast.py | Python | gpl-2.0 | 5,228 |
# Copyright 2012 Michael Still and Canonical 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
#
# ... | xuweiliang/Codelibrary | nova/virt/configdrive.py | Python | apache-2.0 | 5,826 |
import paho.mqtt.client as mqtt
import time, sys, rrdtool, os
last_topic = ""
last_payload = ""
# main
def on_connect(client, userdata, flags, rc):
print("Connected")
client.is_connected = True
def on_message(client, userdata, message):
''' note: message is a tuple of (topic, payload, qos, retain)'''
... | raspberrypisig/raspberrypisig.github.io | assets/files/mqttSonoff.py | Python | mit | 1,670 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googleapis/google-cloud-php-data-catalog | owlbot.py | Python | apache-2.0 | 2,935 |
"""
django-helpdesk - A Django powered ticket tracker for small enterprise.
The is_helpdesk_staff template filter returns True if the user qualifies as Helpdesk staff.
templatetags/helpdesk_staff.py
"""
import logging
from django.template import Library
from helpdesk.decorators import is_helpdesk_staff
logger = log... | rossp/django-helpdesk | helpdesk/templatetags/helpdesk_staff.py | Python | bsd-3-clause | 591 |
"""
Django settings for openhack project.
Generated by 'django-admin startproject' using Django 1.11.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import o... | horken7/openhack | openhack/settings.py | Python | mit | 3,386 |
from webapp2_extras import i18n
from webapp2_extras.i18n import gettext as _
known_locales = ["en_US", "es"]
def get_preferred_locale(request):
preferred_locale = "en_US"
if request.get("lang"):
preferred_locale = request.get("lang")
elif request.cookies.has_key("language"):
preferred_locale = request.cookies[... | tuomassiren/proofofexistence | translation.py | Python | mit | 2,309 |
short_name = "godot"
name = "Godot Engine"
major = 3
minor = 0
status = "alpha"
| morrow1nd/godot | version.py | Python | mit | 80 |
# Copyright 2014 varnishapi 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 base64
import inspect
import json
import os
import unittest
from feaas import api, plugin, storage
from feaas.managers import ec2
from . import manager... | tsuru/varnishapi | tests/test_api.py | Python | bsd-3-clause | 12,846 |
import datetime
import pytz
from app.models import Match
from app.business.slot_business import create_slot_from_json
from app.util.dota_util import GAME_MODES, LOBBY_TYPES
def create_from_json(match_json):
utc = pytz.UTC
match = Match(
match_id=match_json['match_id'],
match_seq_num=match_jso... | lucashanke/houseofdota | app/business/match_business.py | Python | mit | 2,203 |
__all__ = ['HTTPRequest', 'HTTPConnection', 'HTTPServer',
'SizeCheckWrapper', 'KnownLengthRFile', 'ChunkedRFile',
'MaxSizeExceeded', 'NoSSLError', 'FatalSSLAlert',
'WorkerThread', 'ThreadPool', 'SSLAdapter',
'CherryPyWSGIServer',
'Gateway', 'WSGIGateway', 'WSG... | enddo/HatKey | Lib/web/wsgiserver/__init__.py | Python | gpl-3.0 | 595 |
def linear_search(lst,size,value):
i = 0
while i < size:
if lst[i] == value:
return i
i = i + 1
return -1
def main():
lst = [-31, 0, 1, 2, 2, 4, 65, 83, 99, 782]
size = len(lst)
original_list = ""
value = int(input("\nInput a value to search for: "))
print... | EverythingAbout/Python | Searches/linear_search.py | Python | mit | 775 |
"""
Tools for generating forms based on SQLAlchemy models.
"""
import inspect
from wtforms import fields as f
from wtforms import validators
from wtforms.form import Form
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from wtforms.ext.sqlalchemy.fields import QuerySelectMultipleField
from wtforms.ext.sqlal... | hnakamur/site-alive-checker | wtforms/ext/sqlalchemy/orm.py | Python | mit | 10,723 |
import bpy, inspect, re
from collections import defaultdict
class Documentation:
def __init__(self):
self.is_build = False
self.reset()
def build_if_necessary(self):
if not self.is_build:
self.build()
def build(self):
self.reset()
all_bpy_ty... | kinoraw/kinoraw_repo | external/script_auto_complete/documentation.py | Python | gpl-3.0 | 20,186 |
from troy.interface.base import iBase
import troy.exception
########################################################################
#
#
#
class iScheduler (iBase) :
""" :class:`troy.Scheduler` interface """
############################################################################
#
def ... | andre-merzky/troy_old | troy/interface/scheduler.py | Python | gpl-3.0 | 783 |
# -*- coding: utf-8 -*-
from engine import component
class Collidable(component.Component):
""" Collidable component. """
def __init__(self, *args, **kwargs):
super(Collidable, self).__init__(*args, **kwargs)
self.type = None
self.collided = False
self.collision_dist... | eeneku/baller | src/components/collidable.py | Python | gpl-3.0 | 328 |
# -*- coding: utf8 -*-
from pycraft.common import ImmutableMeta
from .vector import Vector
class Face(metaclass=ImmutableMeta):
DIRECTION = (
Vector(0,0,-1), Vector(0,0,1),
Vector(0,-1,0), Vector(0,1,0),
Vector(-1,0,0), Vector(1,0,0))
properties = 'h v mix'
@staticmethod
de... | nosix/PyCraft | src/pycraft/service/primitive/geometry/face.py | Python | lgpl-3.0 | 1,380 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
from homecon.core.database import get_database, Field
from homecon.core.plugin import Plugin
from homecon.plugins.states import States
from homecon.plugins.websocket import Websocket
from homecon.plugins.pages import Pages
from homecon.plugins.... | BrechtBa/homeconn | homecon/plugins/plugins.py | Python | gpl-3.0 | 8,522 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.