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 _plotly_utils.basevalidators
class TicklenValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="ticklen", parent_name="layout.ternary.caxis", **kwargs
):
super(TicklenValidator, self).__init__(
plotly_name=plotly_name,
parent_n... | plotly/python-api | packages/python/plotly/plotly/validators/layout/ternary/caxis/_ticklen.py | Python | mit | 507 |
# -*- coding: utf-8 -*-
__about__ = """
This project takes the account_project and adds profiles and notifications.
It is a foundation suitable for many sites that have user accounts with
profiles.
"""
| kansanmuisti/datavaalit | web/__init__.py | Python | agpl-3.0 | 203 |
def distinct_prime_factors(n):
i = 2
factors = set()
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.add(i)
if n > 1:
factors.add(n)
return factors
def is_ruth_aaron(pair):
return sum(distinct_prime_factors(pair[0])) == sum(di... | marcardioid/DailyProgrammer | solutions/235_Easy/solution.py | Python | mit | 588 |
"""
"""
import sys, os, pdb
import numpy as np
import numpy.linalg as npl
from scipy.stats import t as t_dist
sys.path.append(os.path.join(os.path.dirname(__file__), "./"))
from glm_func import *
def t_stat(data, X_matrix):
"""
Return the estimated betas, t-values, degrees of freedom,
and p-values for t... | timothy1191xa/project-epsilon-1 | code/utils/functions/t_stat.py | Python | bsd-3-clause | 1,887 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Γ adimensional?
adi = False
#Γ para salvar as figuras(True|False)?
save = True
#Caso seja para salvar, qual Γ© o formato desejado?
formato = 'jpg'
#Caso seja para salvar, qual Γ© o diretΓ³rio que devo salvar?
dircg = 'fig-sen'
#Caso seja para salvar, qual Γ© o nome do arquivo... | asoliveira/NumShip | scripts/plot/acel-v-zz-plt.py | Python | gpl-3.0 | 2,332 |
from ..osid import managers as osid_managers
from ..osid import sessions as osid_sessions
class AuthenticationProcessProfile(osid_managers.OsidProfile):
"""The ``AuthenticationProcessProfile`` describes the interoperability among authentication process services."""
def get_authentication_record_types(self):... | birdland/dlkit-doc | dlkit/authentication_process/managers.py | Python | mit | 4,032 |
# This test directory is for tests that _must_ test external domains
# Stay away from google.com and yahool.com without specifying localization becuase you'll
# hit a forward
from windmill.bin import admin_lib
import windmill
import os, sys
from windmill.dep import wsgi_fileserver
def setup_module(module):
wind... | windmill/windmill | test/internet_tests/__init__.py | Python | apache-2.0 | 615 |
# 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 field 'Problem.summary'
db.add_column(u'problem', 'summary', self.gf('django.db.models.fields.Cha... | maxwward/SCOPEBak | askbot/migrations/0077_transplant_summary_1.py | Python | gpl-3.0 | 26,853 |
# Copyright 2015 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... | aam-at/tensorflow | tensorflow/python/framework/tensor_shape.py | Python | apache-2.0 | 39,643 |
from django.conf.urls import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'app.views.home', name='home'),
# url(r'^app/', include('app.fo... | hdknr/django-mediafiles | sample/web/app/urls.py | Python | mit | 930 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
##===-----------------------------------------------------------------------------*- Python -*-===##
##
## S E R I A L B O X
##
## This file is distributed under terms of BSD license.
## See LICENSE.txt for more information.
##
##===----------... | havogt/serialbox2 | examples/python/example-03-slice.py | Python | bsd-2-clause | 3,042 |
from cms.utils.compat.dj import python_2_unicode_compatible
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
from cms.plugins.vzaar import settings
from os.path import basename
@python_2_unicode_compatible
class Vzaar(CMSPlugin):
# Vzaar player s... | newmanbrad/djangocms-vzaar-widget | vzaar/models.py | Python | bsd-3-clause | 1,563 |
#!/usr/bin/env python2
import sys
import plyj.parser
import plyj.model as m
p = plyj.parser.Parser()
tree = p.parse_file(sys.argv[1])
print('declared types:')
for type_decl in tree.type_declarations:
print(type_decl.name)
if type_decl.extends is not None:
print(' -> extending ' + type_decl.extends.na... | RealTimeWeb/program-analyzer | example/symbols.py | Python | apache-2.0 | 2,057 |
#!/usr/bin/env python
"""
create a directory in the FileCatalog
"""
import os
import DIRAC
from DIRAC.Core.Base import Script
from COMDIRAC.Interfaces import critical
from COMDIRAC.Interfaces import DSession
from COMDIRAC.Interfaces import createCatalog
from COMDIRAC.Interfaces import pathFromArguments
if __name__... | pigay/COMDIRAC | Interfaces/scripts/dmkdir.py | Python | gpl-3.0 | 1,488 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
import re
import json
from datetime import date, datetime
from bs4 import BeautifulSoup
import itertools
from couchpotato.core.logger import CPLog
from couchpotato.core.media._base.providers.och.base import OCHProvider
log = CPLog(__name__)
class Base(OCHProvider... | seppi91/CouchPotatoServer | couchpotato/core/media/_base/providers/och/bestmovies.py | Python | gpl-3.0 | 10,000 |
# Django settings for mypublisher project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Laxmikant', 'laxmikant@sofycomps.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '/ho... | laxmikantG/mypublisher | mypublisher/settings.py | Python | mit | 5,715 |
# coding=utf-8
"""Definitions relating to layer keywords."""
from safe.definitions.extra_keywords import all_extra_keywords_name
from safe.utilities.i18n import tr
__copyright__ = "Copyright 2016, The InaSAFE Project"
__license__ = "GPL version 3"
__email__ = "info@inasafe.org"
__revision__ = '$Format:%H$'
# Base M... | inasafe/inasafe | safe/definitions/keyword_properties.py | Python | gpl-3.0 | 10,095 |
from djangosnippets.settings.base import * # noqa: F403
DEBUG = True
SECRET_KEY = "abcdefghijklmnopqrstuvwxyz0123456789"
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
CACHE_BACKEND = "dummy://"
INSTALLED_APPS = INSTALLED_APPS
| django/djangosnippets.org | djangosnippets/settings/development.py | Python | bsd-3-clause | 251 |
import gevent
import grequests
import requests
from random import random
BAD_URL_NETWORK_PROBLEM = 'Bad url or network problem.'
COOK_COUNTY_JAIL_INMATE_DETAILS_URL = \
'http://www2.cookcountysheriff.org/search2/details.asp?jailnumber='
_STD_INITIAL_SLEEP_PERIOD = 0.1
_STD_NUMBER_ATTEMPTS = 5
_STD_SLEEP_PERIODS... | sc3/cookcountyjail | scraper/http.py | Python | gpl-3.0 | 1,707 |
from .Contest import CodechefContest as Contest
from .Problem import CodechefProblem as Problem
from .Testcase import CodechefTestcase as Testcase
__all__ = ['Contest', 'Problem', 'Testcase']
| termicoder/termicoder | termicoder/judges/codechef/models/__init__.py | Python | mit | 194 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your op... | pculture/unisubs | apps/externalsites/urls.py | Python | agpl-3.0 | 1,803 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Lars JΓΈrgen Solberg <supersolberg@gmail.com> 2014
#
class Formatter(object):
"""
A Formatter creates a string of unicode characters and escape
codes that it shows a picture when viewed in the correct context,
usually a terminal emulator.
This is ... | marado/shellpic | shellpic/formatter.py | Python | gpl-3.0 | 1,650 |
# vi: ts=4 expandtab
#
# Copyright (C) 2009-2010 Canonical Ltd.
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
#
# Author: Scott Moser <scott.moser@canonical.com>
# Author: Juerg Haefliger <juerg.haefliger@hp.com>
#
# This program is free software: you can redistribute it and/or modify
# ... | racker/cloud-init-debian-pkg | cloudinit/config/cc_puppet.py | Python | gpl-3.0 | 5,166 |
version_info = (4, 0, 1)
__version__ = '.'.join(map(str, version_info))
| boompieman/iim_project | project_python2/lib/python2.7/site-packages/nbformat/_version.py | Python | gpl-3.0 | 72 |
# Extract the artist name from songs with filenames in this format:
# (number) - (artist) - (title).mp3
# and add the artists name to songs with filenames in this format:
# (number)..(title).mp3
# to make filenames in this format:
# (number)..(artist)..(title).mp3
#
# eg.: 14 - 13th Floor Elevators -... | daveinnyc/various | utilities/transform_mp3_filenames.py | Python | mit | 1,700 |
import unittest
class CircularList(list):
'''
A list that wraps around instead of throwing an index error.
Works like a regular list:
>>> cl = CircularList([1,2,3])
>>> cl
[1, 2, 3]
>>> cl[0]
1
>>> cl[-1]
3
>>> cl[2]
3
Except wraps around:
... | ytc301/autodock | circularlist.py | Python | mit | 1,215 |
# flake8: noqa
from .client import BidiSession
| scheib/chromium | third_party/wpt_tools/wpt/tools/webdriver/webdriver/bidi/__init__.py | Python | bsd-3-clause | 48 |
from rip.request import Request
def get_request(data=None,
user=None,
request_params=None,
context_params= None):
request_params = request_params or {}
context_params = context_params or {'api_name': 'api',
'api_version': ... | Aplopio/rip | tests/request_factory.py | Python | mit | 683 |
#!/bin/env python2.7
# -*- coding: utf-8 -*-
# This file is part of AT-Platform.
#
# EPlatform 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 ... | bjura/EPlatform | spellerPuzzle.py | Python | gpl-3.0 | 24,523 |
#!/usr/bin/env python
#
# redirect_tests.py: Test ra_dav handling of server-side redirects
#
# Subversion is a tool for revision control.
# See http://subversion.apache.org for more information.
#
# ====================================================================
# Licensed to the Apache Software Foundation ... | centic9/subversion-ppa | subversion/tests/cmdline/redirect_tests.py | Python | apache-2.0 | 7,232 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('activities', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='activity',
name='neg... | virgilio/timtec | activities/migrations/0002_auto_20160923_1847.py | Python | agpl-3.0 | 631 |
# Copyright 2018 Open Source Robotics Foundation, 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... | ros2/launch | launch/test/launch/launch_description_source/test_python_launch_description_source.py | Python | apache-2.0 | 1,818 |
###
###
import os
import ConfigParser
from safebrowsing import Lookup
import re
import supybot.conf as conf
import supybot.utils as utils
from supybot.commands import *
import supybot.ircmsgs as ircmsgs
import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.callbacks as callbacks
import ... | kg-bot/SupyBot | plugins/Goog/plugin.py | Python | gpl-3.0 | 3,090 |
import pytest
from forte import Symmetry
def test_symmetry():
"""Test the Symmetry class"""
sym = Symmetry('D2H')
assert sym.point_group_label() == 'D2H'
assert sym.irrep_labels() == ['Ag', 'B1g', 'B2g', 'B3g', 'Au', 'B1u', 'B2u', 'B3u']
# test in and out of bounds
assert sym.irrep_label(4)... | evangelistalab/forte | tests/pytest/symmetry/test_symmetry.py | Python | lgpl-3.0 | 1,097 |
# Copyright (c) 2015 - present. Boling Consulting Solutions, BCSW.net
#
# 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 ... | cboling/SDNdbg | linux/switch.py | Python | apache-2.0 | 2,483 |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Violin Memory, 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
#
# ... | rlucio/cinder-violin-driver-icehouse | cinder/volume/drivers/violin/vxg/vshare/iscsi.py | Python | apache-2.0 | 4,690 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import numpy as np
import os
controllerList = ['FController', 'GController', 'JController',\
'LSSController', 'PIFeedbackController']
print('Regimefile Generator (Modification of M)')
print('Choose one of the following controller: (0-4)')
print(controllerLis... | cklb/PyMoskito | pymoskito/examples/ballbeam/utils/regimeGeneratorB2.py | Python | bsd-3-clause | 1,950 |
from __future__ import absolute_import, print_function
import io
import os
from setuptools import find_packages, setup
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8'),
) as fp:
return fp.read()
readm... | graingert/dockhand | setup.py | Python | apache-2.0 | 1,769 |
"""Support for monitoring the state of Vultr Subscriptions."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_MONITORED_CONDITIONS, CONF_NAME, DATA_GIGABYTES
import homeassistant.helpers.config_validation as cv
from homeassistan... | tchellomello/home-assistant | homeassistant/components/vultr/sensor.py | Python | apache-2.0 | 3,277 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'BIOMD0000000177.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/BIOMD0000000177 | BIOMD0000000177/model.py | Python | cc0-1.0 | 427 |
#!/usr/bin/env python
import sys
import os
import glob
import json
import re
from argparse import ArgumentParser
from argparse import RawDescriptionHelpFormatter
def init_report_dir(metadata_dir, report_name):
report_dir = metadata_dir + '/reports/' + report_name
if not os.path.exists(report_dir):
os... | ICGC-TCGA-PanCancer/pancancer-sandbox | pcawg_metadata_parser/pc_report-embl-dkfz_summary_counts.py | Python | gpl-2.0 | 8,651 |
import copy
import json
import os
import StringIO
import yaml
from fabric.api import cd, put, settings, sudo, env
from fabric.context_managers import shell_env
from fabric.contrib.files import exists
from shuttle.services.cron import (
add_crontab_section,
remove_crontab_section,
CronSchedule,
CronJob... | mvx24/fabric-shuttle | shuttle/services/snowplow.py | Python | mit | 7,274 |
"""Filter for detecting HDR images.
We focus on detecting images that have a very noticeable or bad
HDR effect. Several features based on experimentation are looked
for in images. As the objective of high-dynamic-range imaging is
to reproduce a greater dynamic range of luminance, we look at the
luminance of the image ... | vismantic-ohtuprojekti/qualipy | qualipy/filters/hdr.py | Python | mit | 7,727 |
"""
Package module for the expression parser tests.
Copyright 2017 Leon Helwerda
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 ... | lhelwerd/expression-parser | tests/__init__.py | Python | apache-2.0 | 10,813 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/extended_prefix/tlvs/__init__.py | Python | apache-2.0 | 14,078 |
###
# This file is part of Soap.
#
# Soap 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, version 2.
#
# Soap is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the imp... | luaduck/suds | __init__.py | Python | gpl-2.0 | 1,811 |
# coding: utf-8
# https://www.raspberrypi.org/learning/getting-started-with-picamera/worksheet/
# #Β Previsualitzant
# In[ ]:
# 10 segons de vΓdeo.
from picamera import PiCamera
from time import sleep
camera = PiCamera()
camera.start_preview(alpha=200)
sleep(10)
camera.stop_preview()
# # Guardant una imatge
#... | eloipuertas/TallerRaspi | IoT_Camera.py | Python | gpl-3.0 | 4,584 |
from django.db import models
from django.utils import timezone
class Post(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=200)
text = models.TextField()
created_date = models.DateTimeField(
default=timezone.now)
published_date = models.DateTime... | LEDS/Exemplos-Python-Django | django_bootstrap/blog/models.py | Python | gpl-3.0 | 637 |
__all__ = [
'ArchiveTypes',
'Compressors',
'assert_command_exist',
'check_command_exist',
'export_path',
'get_url_path',
'guess_archive_type',
'guess_compressor',
'remove_archive_suffix',
]
import enum
import logging
import os
import shutil
import urllib.parse
from pathlib import Pa... | clchiou/garage | py/g1/scripts/g1/scripts/utils.py | Python | mit | 2,637 |
from database import *
from filtercomputation import *
class InvFBFilter(object):
def getAllMessage(self):
db = Database()
sql = "select message from filter_el"
lst = db.select_inv_fbfiler(sql)
str = ''
i = 0;
for x in lst:
if i%2 == 0:
... | chaluemwut/fbserver | investfbfilter.py | Python | apache-2.0 | 1,989 |
"""
=============================================
Using an automated approach to coregistration
=============================================
This example shows how to use the coregistration functions to perform an
automated MEG-MRI coregistration via scripting.
.. warning:: The quality of the coregistration depends ... | drammock/mne-python | tutorials/forward/25_automated_coreg.py | Python | bsd-3-clause | 3,790 |
"""FTDs to VPNs Class."""
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
import logging
class FTDS2SVPNs(APIClassTemplate):
"""The FTDS2SVPNs Object in the FMC."""
VALID_JSON_DATA = [
"id",
"name",
"type",
"ipsecSettings",
"endpoints",
"ikeSe... | daxm/fmcapi | fmcapi/api_objects/policy_services/ftds2svpns.py | Python | bsd-3-clause | 1,141 |
from .group import Group, GroupManager
from .match import Match, MatchManager
from .picture import Picture
from .profile import UserProfile
from .restaurant import Restaurant
| GFynbo/GoudaTime | swiper/models/__init__.py | Python | mit | 175 |
# -*- coding: utf-8 -*-
# Copyright (C) 2016 Matthias Luescher
#
# Authors:
# Matthias Luescher
#
# This file is part of edi.
#
# edi is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of... | erickeller/edi | edi/lib/__init__.py | Python | lgpl-3.0 | 757 |
with open('level1_4.in') as f:
lines = f.readlines()
latitud = []
longitud = []
timestamp = []
altitud = []
for l in lines[1:]:
l = l.split(',')
timestamp.append(int(l[0]))
latitud.append(round(float(l[1]), 5))
longitud.append(round(float(l[2]), 5))
altitud.append(round(float(l[3]), 5))
prin... | MariaSG98/Competitive-programming | Coding Contest abr-2020/level1/level1.py | Python | mit | 500 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import argparse
import fileinput
_log = logging.getLogger("UI patcher")
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
arg_parser = argparse.ArgumentParser("UI patcher")
arg_parser.add_argument("ui")
args = arg_parser... | unrza72/qplotutils | qplotutils/ui/patch_ui.py | Python | mit | 599 |
"""Statistical Language Processing tools. (Chapter 22)
We define Unigram and Ngram text models, use them to generate random text,
and show the Viterbi algorithm for segmentatioon of letters into words.
Then we show a very simple Information Retrieval system, and an example
working on a tiny sample of Unix manual pages... | andres-root/AIND | Therm1/Planning/Project/aimacode/text.py | Python | mit | 13,554 |
from nose.tools import assert_raises
import relations
def test_a_relation_has_a_heading():
employees = relations.Relation('employee_name', 'dept_name')
assert employees.heading == set(['employee_name', 'dept_name'])
def test_a_relation_has_cardinality():
employees = relations.Relation('employee_name', ... | zacharyvoase/relations | test/test_relation.py | Python | unlicense | 3,771 |
# -*- coding: utf-8 -*-
'''
Tests for the supervisord state
'''
# Import python lins
from __future__ import absolute_import
import os
import time
import subprocess
# Import Salt Testing libs
from salttesting import skipIf
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt li... | stephane-martin/salt-debian-packaging | salt-2016.3.3/tests/integration/states/supervisord.py | Python | apache-2.0 | 8,751 |
# peppy Copyright (c) 2006-2009 Rob McMullen
# Licenced under the GPLv2; see http://peppy.flipturn.org for more info
"""Vala programming language editing support.
Major mode for editing Vala files.
Supporting actions and minor modes should go here only if they are uniquely
applicable to this major mode and can't be u... | robmcmullen/peppy | peppy/major_modes/vala.py | Python | gpl-2.0 | 1,680 |
ο»Ώthink(0)
from library import turn_right, turn_around
def clear_row():
while object_here():
take()
while front_is_clear():
move()
while object_here("leaf"):
take()
def go_to_next_row():
turn_left()
move()
turn_left()
while not wall_in_front():
... | code4futuredotorg/reeborg_tw | test/src/storm3_en.py | Python | agpl-3.0 | 674 |
from .schema import ModelSchema
| mathewmarcus/marshmallow-pynamodb | marshmallow_pynamodb/__init__.py | Python | mit | 32 |
from django.conf.urls import patterns
from django.conf.urls import include
from django.conf.urls import url
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
config_pattern = r'^service/configuration/(?P<configuration_id>\d+)'
filter_pattern = config_pattern + r'/filter/(?P<filte... | lizardsystem/flooding | flooding_base/urls.py | Python | gpl-3.0 | 3,143 |
import os
import fcntl
DATA_FOLDER = '/home/pi/thesenseproject/data/'
def lockFile(lockfile):
fd = os.open(lockfile, os.O_CREAT | os.O_TRUNC | os.O_WRONLY)
try:
fcntl.lockf(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError:
return False
return True
def unlockFile(lockfile):
f... | psanders/thesenseproject | lib/common.py | Python | mit | 465 |
from __future__ import unicode_literals
import redis
from rq import Connection, Queue, Worker
from frappe.utils import cstr
from collections import defaultdict
import frappe
import MySQLdb
import os, socket, time
default_timeout = 300
queue_timeout = {
'long': 1500,
'default': 300,
'short': 300
}
def enqueue(metho... | drukhil/frappe | frappe/utils/background_jobs.py | Python | mit | 4,779 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import warnings
import uuid
from django.utils.importlib import import_module
from django.utils.six import string_types
from django.utils.translation import ugettext as _
from pybb import compat
from pybb.compat import get_username_field, get_u... | skolsuper/pybbm | pybb/util.py | Python | bsd-2-clause | 5,824 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2013 ErpAndCloud All Rights Reserved
# https://github.com/jmesteve
# https://github.com/escrichov
# ... | jmesteve/saas3 | openerp/addons_extra/account_balance_extend/__openerp__.py | Python | agpl-3.0 | 1,828 |
from __future__ import unicode_literals
import tempfile
import hashlib
import shutil
import pkgutil
import csv
import tarfile
import time
import filecmp
import xdg.BaseDirectory
import requests
import atexit
from contextlib import closing, contextmanager
from urlparse import urlparse
from six import BytesIO
from even... | chrissorchard/malucrawl | malware_crawl/scan/wine.py | Python | mit | 4,913 |
"""
Given an array and a value, remove all instances of that value in place and
return the new length.
Do not allocate extra space for another array, you must do this in place with
constant memory.
The order of elements can be changed. It doesn't matter what you leave beyond
the new length.
Example:
Given input ... | ufjfeng/leetcode-jf-soln | python/027_remove_element.py | Python | mit | 1,387 |
# Youtube (Videos)
#
# @website https://www.youtube.com/
# @provide-api yes (https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list)
#
# @using-api no
# @results HTML
# @stable no
# @parse url, title, content, publishedDate, thumbnail, embedded
from functools import reduce
f... | jcherqui/searx | searx/engines/youtube_noapi.py | Python | agpl-3.0 | 3,211 |
# encoding: utf-8
"""
Mappings from the ISO/IEC 29500 spec or inferred from PowerPoint application
behavior
"""
from __future__ import absolute_import
from pptx.enum.shapes import MSO_SHAPE
GRAPHIC_DATA_URI_CHART = (
'http://schemas.openxmlformats.org/drawingml/2006/chart'
)
GRAPHIC_DATA_URI_TABLE = (
'htt... | biggihs/python-pptx | pptx/spec.py | Python | mit | 29,541 |
# -*- coding: utf-8 -*-
"""
Created by Fuoco on 05.04.2015 for intelligeman
"""
__author__ = 'Fuoco'
__credits__ = ["Fuoco"]
__license__ = "GPL"
__version__ = "0.0.1"
__email__ = "recyger@gmail.com"
from .init import app, Tool, abort
from db import db_session, select, Truck_Model, Truck_Status, Truck
@app.post('/tru... | recyger/intelligent-orders | app/truck.py | Python | gpl-2.0 | 2,652 |
"""
byceps.permissions.shop_shop
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from ..util.authorization import create_permission_enum
ShopPermission = create_permission_enum(
'shop',
[
'create',
'update',
... | homeworkprod/byceps | byceps/permissions/shop.py | Python | bsd-3-clause | 638 |
import logging
from keyword import iskeyword
from inspect import formatargspec
from tokenize import (NAME, NL, NEWLINE, TokenError, generate_tokens,
untokenize, ERRORTOKEN, INDENT, DEDENT)
from .fixer import fix, sanitize_encoding
from .scope import get_scope_at
from .evaluator import infer
def get_scope_names(sc... | baverman/supplement | supplement/assistant.py | Python | mit | 10,284 |
#MenuTitle: Build rand Feature
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Build rand (random) feature from .cvXX or another (numbered) suffix.
"""
import vanilla
def getRootName(glyphName):
if "." in glyphName:
dotIndex = glyphName.find(".")
return glyph... | mekkablue/Glyphs-Scripts | Features/Build rand Feature.py | Python | apache-2.0 | 10,201 |
#!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2005
# Author: Dan Smith <danms@us.ibm.com>
#
# Test that the library and ramdisk are working to the point
# that we can start a DomU and read /proc
#
from XmTestLib import *
import re
domain = XmTestDomain()
try:
console = domain.start(... | YongMan/Xen-4.3.1 | tools/xm-test/tests/_sanity/01_domu_proc.py | Python | gpl-2.0 | 630 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jason Power
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of con... | Nirvedh/CoarseCoherence | configs/tutorial/simple.py | Python | bsd-3-clause | 3,883 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hpe.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lic... | openstack/designate | designate/api/v2/controllers/floatingips.py | Python | apache-2.0 | 3,261 |
import codecs
import contextlib
import copy
from decimal import Decimal
from django.apps.registry import Apps
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.utils import six
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_delete_table = "DROP TABLE %(table)s"
sql_c... | KrzysztofStachanczyk/Sensors-WWW-website | www/env/lib/python2.7/site-packages/django/db/backends/sqlite3/schema.py | Python | gpl-3.0 | 13,930 |
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import camera
import time
class Display(object):
# Inheritrance convinience functions
def init(self): pass
def close(self): pass
def mouse(self, mouseButton, buttonState, x, y): pass
def mouseMotion(self, x, y, dx, dy): pass
def pa... | Alex4913/PyOpenGL-Boilerplate | src/display.py | Python | mit | 3,803 |
from .python.harness import Harness
from .python import ext
__version__ = "0.1.0"
__all__ = ['Harness'] | tonyfast/tidy-harness | harness/__init__.py | Python | bsd-3-clause | 104 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | fengbeihong/tempest_automate_ironic | tempest/common/glance_http.py | Python | apache-2.0 | 14,477 |
"""distutils.ccompiler
Contains CCompiler, an abstract base class that defines the interface
for the Distutils compiler abstraction model."""
# This module should be kept compatible with Python 2.1.
__revision__ = "$Id: ccompiler.py,v 1.1.1.1 2006/05/30 06:04:30 hhzhou Exp $"
import sys, os, re
from types import *
... | kontais/EFI-MIPS | ToolKit/cmds/python/Lib/distutils/ccompiler.py | Python | bsd-3-clause | 52,124 |
from oauth2app.authorize import Authorizer, MissingRedirectURI, AuthorizationException
from oauth2app.authorize import UnvalidatedRequest, UnauthenticatedUser, InvalidRequest, RESPONSE_TYPES
from oauth2app.lib.uri import add_parameters, add_fragments, normalize
from oauth2app.models import Client, AccessRange, AccessTo... | HumanDynamics/openPDS-RegistryServer | registryServer/apps/oauth2/authorization.py | Python | mit | 6,855 |
# -*- coding: utf-8 -*-
"""
pygments.styles.sourcerer
~~~~~~~~~~~~~~~~~~~~~~~
ββββββ ββββββ ββ ββ ββββββ βββββ βββββ ββββββ βββββ ββββββ
ββββββ βββββββββββ ββββββββββββββββββ ββββββββββββββββββββββββββββββ
βββββββ βββ ββββββ βββ βββ βββββ ββ ββββββββ βββ ββββββββββ βββ ββ
ββββββββββ... | danalec/dotfiles | pygments/usr/lib/python3.5/site-packages/pygments/styles/sourcerer.py | Python | mit | 6,232 |
title = 'Using Tk option database to configure Pmw megawidgets'
# Import Pmw from this directory tree.
import sys
sys.path[:0] = ['../../..']
import Tkinter
import Pmw
class Demo:
def __init__(self, parent):
self.parent = parent
header = Tkinter.Label(parent, text = 'Select some Tk option ' +
... | CasataliaLabs/biscuit_drishtiman | Pmw-2.0.0/build/lib.linux-x86_64-2.7/Pmw/Pmw_1_3_3/demos/Resources_Pmw.py | Python | gpl-3.0 | 3,554 |
from django.contrib.admin.sites import site
from django.template import Context
from django.template.base import Template
from cms.api import add_plugin
from cms.models import StaticPlaceholder, Placeholder, UserSettings
from cms.tests.test_plugins import PluginsTestBaseCase
from cms.utils.urlutils import admin_rever... | divio/django-cms | cms/tests/test_static_placeholder.py | Python | bsd-3-clause | 8,467 |
# -*- coding: utf-8 -*-
# Copyright Β© 2017 Artyom Goncharov
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, mod... | m4yers/crutch | crutch/core/repl/prompt.py | Python | mit | 3,239 |
from prismriver.plugin.common import Plugin
from prismriver.struct import Song
class LyricsHuddlePlugin(Plugin):
ID = 'lyricshuddle'
def __init__(self, config):
super(LyricsHuddlePlugin, self).__init__('LyricsHuddle', config)
def search_song(self, artist, title):
to_delete = ['!', '?', '... | anlar/prismriver | prismriver/plugin/lyricshuddle.py | Python | mit | 1,334 |
# DEVELOPMENT - local_settings.py
# - This file should be copied to ~/hydroshare/hydroshare/local_settings.py
# - The iRODS specific contents of this file contain username and password informaiton
# that is used for an xDCIShare proxy user
import redis
import os
from kombu import Queue, Exchange
from kombu.... | RENCI/xDCIShare | hydroshare/local_settings.py | Python | bsd-3-clause | 5,851 |
import gpxpy, os, sys, math
# GEO utils
# Uses gpxpy formulas
def geo_distance(point, previous):
if point.elevation and previous.elevation:
distance = gpxpy.geo.distance(point.latitude, point.longitude, point.elevation, previous.latitude, previous.longitude, previous.elevation)
else:
distance =... | lfcipriani/commutemate | commutemate/utils.py | Python | apache-2.0 | 3,371 |
#!/usr/bin/python
#
# Copyright 2014 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 required b... | dietrichc/streamline-ppc-reports | examples/dfp/v201405/creative_set_service/update_creative_set.py | Python | apache-2.0 | 2,945 |
import collections
import unittest
import cfnparams.exceptions
import cfnparams.resolution
BotoCfnStack = collections.namedtuple(
'BotoCfnStack',
['stack_id', 'stack_name', 'outputs', 'tags']
)
StackOutput = collections.namedtuple('Output', ['key', 'value'])
class MockStrategy(object):
def __init__(se... | expert360/cfn-params | tests/test_resolution.py | Python | mit | 2,629 |
import ipaddress
import docker.types
def init():
pass
def get_next_cidr(client):
networks = client.networks.list()
last_cidr = ipaddress.ip_network("10.0.0.0/24")
for network in networks:
if (network.attrs["IPAM"] and network.attrs["IPAM"]["Config"]
and len(network.attrs["IPA... | puffinrocks/puffin | puffin/core/network.py | Python | agpl-3.0 | 1,606 |
from django.test import TestCase
import factory
import pytest
from fbp.people import models
from . import factories
class TestPerson(TestCase):
def test_create_person(self):
factories.PersonFactory(name='Bob')
assert models.Person.objects.filter(name='Bob').count() == 1
def test_LOTS_OF_PE... | paulcollinsiii/factory_boy_presentation | code/tests/test_people/test_notpainful.py | Python | mit | 1,137 |
#!/usr/bin/python
# Script to Check the difference in 2 files
# 1 fevereiro de 2015
# https://github.com/thezakman
file1 = raw_input('[file1:] ')
modified = open(file1,"r").readlines()[0]
file2 = raw_input('[file2:] ')
pi = open(file2, "r").readlines()[0] # [:len(modified)]
result... | thezakman/CTF-Scripts | Differ.py | Python | artistic-2.0 | 631 |
# coding: utf-8
from setuptools import setup, find_packages
setup(
name='tc_aws',
version='2.0.7',
description='Thumbor AWS extensions',
author='Thumbor-Community & William King',
author_email='willtrking@gmail.com',
zip_safe=False,
include_package_data=True,
packages=find_packages(),
... | voxmedia/aws | setup.py | Python | mit | 625 |
from sympy.vector.coordsysrect import CoordSysCartesian
from sympy.vector.dyadic import Dyadic
from sympy.vector.vector import Vector, BaseVector
from sympy.vector.scalar import BaseScalar
from sympy import sympify, diff, integrate, S, simplify
def express(expr, system, system2=None, variables=False):
"""
Glo... | NikNitro/Python-iBeacon-Scan | sympy/vector/functions.py | Python | gpl-3.0 | 16,442 |
#!/usr/bin/python
# Copyright (C) 2014-2016 Miquel SabatΓ© SolΓ <mikisabate@gmail.com>
# This file is licensed under the MIT license.
# See the LICENSE file.
def partition(ary, left, right):
pivot = ary[left]
store = left
ary[left], ary[right] = ary[right], ary[left]
for i in range(left, right):
... | mssola/programs | algorithms/sorting/quicksort/quicksort.py | Python | mit | 776 |
#
# AnTrak - Activity and location data analysis
#
# Copyright (C) 2017-2018 by Artur Wroblewski <wrobell@riseup.net>
#
# 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 Li... | wrobell/antrak | antrak/dao/map.py | Python | gpl-3.0 | 1,396 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.