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: utf8 -*-
#
# Copyright (C) 2014 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# 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,... | odoousers2014/odoo-addons-supplier_price | web_action_target_popup/__openerp__.py | Python | agpl-3.0 | 1,827 |
"""
XX. Proxy model inheritance
Proxy model inheritance across apps can result in syncdb not creating the table
for the proxied model (as described in #12286). This test creates two dummy
apps and calls syncdb, then verifies that the table has been created.
"""
import os
import sys
from django.conf import settings,... | adviti/melange | thirdparty/google_appengine/lib/django_1_2/tests/modeltests/proxy_model_inheritance/tests.py | Python | apache-2.0 | 1,255 |
#
# Copyright (C) 2013-2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo 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... | KaiSzuttor/espresso | samples/lj_liquid_structurefactor.py | Python | gpl-3.0 | 5,794 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013 H.M.Guenther & K.Poppenhaeger. See Licence.rst for details.
'''Generate an atlas of YSOVAR lightcurves
This module collects all procedures that are required to make the
atlas. This starts with reading in the csv file from the YSOVAR2
database and includes the calculation of... | YSOVAR/YSOVAR | YSOVAR/atlas.py | Python | gpl-3.0 | 52,453 |
"""
33. get_or_create()
``get_or_create()`` does what it says: it tries to look up an object with the
given parameters. If an object isn't found, it creates one with the given
parameters.
"""
from django.db import models
class Person(models.Model):
first_name = models.CharField(max_length=100)
last_name = m... | LethusTI/supportcenter | vendor/django/tests/modeltests/get_or_create/models.py | Python | gpl-3.0 | 608 |
from ceph_deploy import cli
from ceph_deploy.tests import util
class FakeLogger(object):
def __init__(self):
self._calls = []
self._info = []
def _output(self):
return '\n'.join(self._calls)
def _record(self, level, message):
self._calls.append(message)
method = ... | shenhequnying/ceph-deploy | ceph_deploy/tests/unit/test_cli.py | Python | mit | 1,315 |
from django.core.paginator import Paginator
from django.http import Http404
from django.shortcuts import get_object_or_404, render
from wagtail.admin.forms.choosers import (
AnchorLinkChooserForm, EmailLinkChooserForm, ExternalLinkChooserForm, PhoneLinkChooserForm)
from wagtail.admin.forms.search import SearchFor... | mikedingjan/wagtail | wagtail/admin/views/chooser.py | Python | bsd-3-clause | 12,302 |
# -*- coding: utf-8 -*-
#
# 2015-01-06 Cornelius Kölbel <cornelius@privacyidea.org>
# The Password reset functions
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
# License as published by the Free Software Foundation; eith... | privacyidea/privacyidea | privacyidea/lib/passwordreset.py | Python | agpl-3.0 | 5,495 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 team1@course_bigdata, Saint Joseph's University
#
# 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/li... | sacrefies/csc643_bigdata | project1/src/queries.py | Python | apache-2.0 | 7,595 |
"""
Code to manage the creation and SQL rendering of 'where' constraints.
"""
import collections
import datetime
from itertools import repeat
from django.conf import settings
from django.db.models.fields import DateTimeField, Field
from django.db.models.sql.datastructures import EmptyResultSet, Empty
from django.db.m... | rogerhu/django | django/db/models/sql/where.py | Python | bsd-3-clause | 16,829 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-18 14:02
from __future__ import unicode_literals
import autoslug.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependenci... | bodedev/prospera | plataforma/migrations/0001_initial.py | Python | mit | 11,028 |
import os
import math
user_name = 'root'
ip_addr = '172.31.238.165'
pwd = 'gust'
def get_data_to_tmp(path_from, path_tmp, i):
path_tmp_i = path_tmp + 'tmp' + str(i) + '/'
if not os.path.exists(path_tmp_i.replace('\\', '')):
os.mkdir(path_tmp_i.replace('\\', ''))
remote_cmd = '"python /home/l... | FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code | lianwenbiao/Remote_call/merge_for_txt.py | Python | apache-2.0 | 2,880 |
#!/usr/bin/python
import apt
import apt.progress
import apt_pkg
import logging
import re
import sys
logging.basicConfig(filename1='/var/log/supervisor/rps.log',
format='%(asctime)s %(levelname)s: deb_install: %(message)s',
level=logging.INFO)
logging.getLogger().setLevel(logging.INFO)
class control_p... | bioothod/zbuilder | conf.d/deb_install_build_deps.py | Python | apache-2.0 | 3,249 |
lexicon_list = [('direction', 'north'),
('direction', 'south'),
('direction', 'east'),
('direction', 'west'),
('verb', 'go'),
('verb', 'kill'),
('verb', 'eat'),
('noun', 'bear'),
('noun', 'pri... | maxiee/LearnPythonTheHardWayExercises | projects/ex48/ex48/parser.py | Python | gpl-2.0 | 3,413 |
import apt
import unittest
from tests.utils import (
setup_test_env,
)
setup_test_env()
from softwarecenter.cmdfinder import CmdFinder
class TestCmdFinder(unittest.TestCase):
""" tests the CmdFinder class """
def setUp(self):
cache = apt.Cache()
self.cmd = CmdFinder(cache)
def test_... | sti-lyneos/shop | tests/test_cmdfiner.py | Python | lgpl-3.0 | 737 |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
###############################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://www.vauxoo.com>).
# All Rights Reserved
############# Credits ######################... | 3dfxsoftware/cbss-addons | partner_products/__openerp__.py | Python | gpl-2.0 | 1,863 |
#! /usr/bin/env python
import numpy
import sys
fileName = 'test_pairs.txt';
tests = numpy.loadtxt(fileName, dtype=int)
bytes = int(sys.argv[1])
initcode = ''
initcode = initcode + ' pattern.resize(' + str(bytes*8) + ');';
initcode = initcode + '\n'
for i in range(bytes*8):
x1, y1, x2, y2 = tests[i, :]
in... | laurentkneip/rbrief | src/matlab_data/generate_code.py | Python | bsd-2-clause | 1,706 |
#
# Copyright 2015 by Justin MacCallum, Alberto Perez, Ken Dill
# All rights reserved
#
import unittest
from meld.system import protein, builder, ConstantTemperatureScaler, LinearTemperatureScaler
from meld.system import GeometricTemperatureScaler, RunOptions
from meld.system.system import ParmTopReader
class TestCr... | laufercenter/meld | meld/test/functional/test_system.py | Python | mit | 10,297 |
# -*- coding: utf-8 -*-
author = 'John Doe'
title = u"Sigal test gallery ☺"
source = 'pictures'
thumb_suffix = '.tn'
thumb_size = (200, 150)
keep_orig = True
links = [('Example link', 'http://example.org'),
('Another link', 'http://example.org')]
plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright',... | cbosdo/sigal | tests/sample/sigal.conf.py | Python | mit | 628 |
"""
Support for iCloud connected devices.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.icloud/
"""
import logging
import re
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers.event import track_utc_t... | instantchow/home-assistant | homeassistant/components/device_tracker/icloud.py | Python | mit | 2,954 |
"""
Copyright (C) 2010 - 2013 TopCoder Inc., All Rights Reserved.
This module defines the Parser class and the ParserError class. See their
documentation below for details.
@version 1.0 (Healthcare Fraud Prevention - Query Parsing and Query Generation)
@author: TCSASSEMBLER
"""
from query.parser_config import Parser... | NASA-Tournament-Lab/CoECI-CMS-Healthcare-Fraud-Prevention | partnerclient/hfppnetwork/partner/query/parser.py | Python | apache-2.0 | 14,663 |
#!/usr/bin/env python
'''Test that font.Text alignment works with multiple lines.
Three labels will be rendered at the top-left, center and bottom-right of the
window. Resize the window to ensure the alignment is as specified.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import unittest
from pygl... | infowantstobeseen/pyglet-darwincore | tests/font/ALIGN_MULTILINE.py | Python | bsd-3-clause | 1,475 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (C) 2014-2022 GEM Foundation
#
# OpenQuake 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 Licen... | gem/oq-engine | openquake/hazardlib/gsim/boore_atkinson_2011.py | Python | agpl-3.0 | 1,703 |
from django.db import models
from xmodule_django.models import CourseKeyField
# Create your models here.
class CourseGlobalSetting(models.Model):
"""
This model represents settings of global course.
The Global course is course that all of the user to enroll.
"""
course_id = CourseKeyField(max_len... | nttks/jenkins-test | common/djangoapps/course_global/models.py | Python | agpl-3.0 | 1,051 |
"""
The model of Johannes, Lochstoer and Mou (2061)
The JLM consumption process is
ln(C_{t+1}/C_t) = mu(X_{t+1}) + sigma(X_{t+1}) xi_{t+1}
where {xi_t} is IID and N(0, 1), while X_t follows a two state Markov
chain.
"""
import numpy as np
from numpy.random import rand, randn
from numba import jit, njit, prang... | jstac/recursive_utility_code | python/markov_switching/src/markov_switching.py | Python | mit | 3,108 |
#!/usr/bin/env python
# -*- coding: ISO-8859-15 -*-
#
# Copyright (C) 2005-2007 David Guerizec <david@guerizec.net>
#
# Last modified: 2006 Sep 17, 10:57:12 by david
#
# 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... | OutOfOrder/sshproxy | lib/mysql_db/config.py | Python | gpl-2.0 | 1,185 |
#!/usr/bin/env python
from config import config
import pycurl, cStringIO
buf = cStringIO.StringIO()
fields = {
'token': config['api_token'],
'content': 'metadata',
'format': 'json'
}
ch = pycurl.Curl()
ch.setopt(ch.URL, config['api_url'])
ch.setopt(ch.HTTPPOST, fields.items())
ch.setopt(ch.WRITEFUNCTION... | KevinDufendach/VandAID | resources/redcap-api-examples-python/export_metadata.py | Python | apache-2.0 | 391 |
# Copyright (C) 2014 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc import settings
if getattr(settings, 'MEMCACHE_MECHANISM', False) is T... | prasannav7/ggrc-core | test/integration/ggrc/memcache/__init__.py | Python | apache-2.0 | 507 |
#!/usr/bin/python
# Copyright (c) 2016 Pason System Corporation
#
# This module 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.
#
# Thi... | emersonsoftware/ansiblefork | lib/ansible/modules/cloud/openstack/os_quota.py | Python | gpl-3.0 | 16,160 |
import os
import peru.runtime as runtime
import shared
class RuntimeTest(shared.PeruTest):
def test_find_peru_file(self):
test_dir = shared.create_dir({
'a/find_me': 'junk',
'a/b/c/junk': 'junk',
})
result = runtime.find_project_file(
os.path.join(test... | oconnor663/peru | tests/test_runtime.py | Python | mit | 466 |
#!/usr/bin/python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
f = open(sys.argv[1], 'wb')
f.write('Hello from bare.py\n')
f.close()
| nawawi/wkhtmltopdf | webkit/Source/ThirdParty/gyp/test/actions-bare/src/bare.py | Python | lgpl-3.0 | 258 |
import os
from . import os_const
from ua.core.utils.os.ua_os_base import UaOsBase
class UaOsOsx (UaOsBase):
FILE_SEPARATOR = os_const.FILE_SEPARATOR_LINUX
NEWLINE = os_const.NEWLINE_LINUX
OS_NAME = 'OS X'
PATH_SEPARATOR = os_const.PATH_SEPARATOR_LINUX
USER_DIR_VAR = 'HOME'
USER_APP_SUBDIR ... | toconn/Python3-Core | Source/ua/core/utils/os/ua_os_osx.py | Python | gpl-3.0 | 1,395 |
if __name__ == '__main__': # 当我们脚本是主入口的时候
# 这里虽然pylint报错了,其实我们可以这样操作的
import dir_same # 对于同级目录,我们python脚本可以直接引入
import a.dir_child # 对于子目录,我们可以通过加目录点的方式引入
import a.b.dir_child_child # 同理对于更深的子目录
print(dir_same.add(0, 4))
print(a.dir_child.add(0, 5))
print(a.b.dir_child_child.add(0, 6))
... | GuLiPing-Hz/PL | py/module_test/module/start1.py | Python | gpl-3.0 | 1,151 |
import os, sys, shutil
# change back to the build dir
if os.path.dirname( sys.argv[0] ) != "":
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
scramble_lib = os.path.join( "..", "..", "..", "lib" )
sys.path.append( scramble_lib )
import get_platform # fixes fat python 2.5
from ez_setup import use_set... | volpino/Yeps-EURAC | scripts/scramble/scripts/generic.py | Python | mit | 1,149 |
import enum
import inspect
import pydoc
import unittest
from collections import OrderedDict
from enum import Enum, IntEnum, EnumMeta, unique
from io import StringIO
from pickle import dumps, loads, PicklingError, HIGHEST_PROTOCOL
# for pickle tests
try:
class Stooges(Enum):
LARRY = 1
CURLY = 2
... | IronLanguages/ironpython3 | Src/StdLib/Lib/test/test_enum.py | Python | apache-2.0 | 57,750 |
# Copyright 2008 VIFF Development Team.
#
# This file is part of VIFF, the Virtual Ideal Functionality Framework.
#
# VIFF is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License (LGPL) as
# published by the Free Software Foundation, either version 3 of the
... | ang-st/viff | viff/test/test_memory.py | Python | gpl-3.0 | 1,877 |
#!/usr/bin/env python
# encoding: utf-8
## {{{ http://code.activestate.com/recipes/543270/ (r1)
#!python
#
# Disk space usage displayed as a tree - duTree.py
#
# Run program without arguments to see its usage.
import string, sys, os, getopt
from os.path import *
boolStrings = ['off', 'on']
class Options:
"""Hol... | cwoebker/relo | relo/local/statistics/disk-space copy.py | Python | bsd-3-clause | 10,156 |
# Copyright 2014 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 collections
import logging
import os
import tempfile
import types
from pylib import cmd_helper
from pylib import constants
from pylib.utils import de... | CTSRD-SOAAP/chromium-42.0.2311.135 | build/android/pylib/utils/md5sum.py | Python | bsd-3-clause | 2,402 |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import editorScene
class editorViewClass(QGraphicsView):
def __init__(self, parend=None):
super(editorViewClass, self).__init__()
self.setDragMode(QGraphicsView.RubberBandDrag)
#self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
... | Skaper/RMCStudio | interface/editorView.py | Python | apache-2.0 | 1,476 |
"""Test the National Weather Service (NWS) config flow."""
import json
from homeassistant import config_entries, setup
from homeassistant.components.metoffice.const import DOMAIN
from .const import (
METOFFICE_CONFIG_WAVERTREE,
TEST_API_KEY,
TEST_LATITUDE_WAVERTREE,
TEST_LONGITUDE_WAVERTREE,
TEST_... | sdague/home-assistant | tests/components/metoffice/test_config_flow.py | Python | apache-2.0 | 4,185 |
# -*- coding: utf-8 -*-
def rate_error():
"""Throws Twitter rate limit error"""
print("Error! Twitter rate limit reach. Wait 15 mins and try again.")
def tweepy_sourcing_error():
"""Throws general sourcing error"""
print("Error! Unable to retrieve tweets.")
| jhole89/twitterAnalyser | src/exceptions/sourcing.py | Python | gpl-3.0 | 278 |
from decimal import Decimal as D
from django.test import TestCase
import mock
from oscar.apps.checkout import calculators
from oscar.apps.shipping import methods
from oscar.core import prices
class TestOrderTotalCalculator(TestCase):
def setUp(self):
self.calculator = calculators.OrderTotalCalculator()... | itbabu/django-oscar | tests/unit/checkout/calculator_tests.py | Python | bsd-3-clause | 1,515 |
from __future__ import print_function
import fcl
import os
import matplotlib
import matplotlib.pyplot as plt
from os.path import abspath, join, dirname
from fcl import kmeans
from fcl.datasets import load_sector_dataset, load_usps_dataset
def plot_overall_duration_subplot(ax, algorithm_results):
# create subplot sh... | thomas-bottesch/fcl | examples/python/kmeans/plotting/calculations_evaluation.py | Python | mit | 3,784 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | cnn_quantization/tf_cnn_benchmarks/test_data/create_cifar10_test_data.py | Python | apache-2.0 | 2,409 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#--------------------------------------------------------------------------------------------------
# Program Name: Lychee
# Program Description: MEI document manager for formalized document control
#
# Filename: lychee/converters/mei_to_ly.py
# ... | nCoda/lychee | lychee/converters/outbound/lilypond.py | Python | gpl-3.0 | 12,619 |
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NIN... | centaurialpha/ninja-ide | ninja_ide/gui/actions.py | Python | gpl-3.0 | 5,530 |
"""Text wrapping and filling.
"""
# Copyright (C) 1999-2001 Gregory P. Ward.
# Copyright (C) 2002, 2003 Python Software Foundation.
# Written by Greg Ward <gward@python.net>
__revision__ = "$Id: textwrap.py 2847 2004-11-13 13:45:38Z fwiemann $"
import string, re
import types
# Do the right thing with boolean values... | google-code-export/django-hotclub | libs/external_libs/docutils-0.4/extras/textwrap.py | Python | mit | 13,921 |
#!/usr/bin/python
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2014 VictorOps, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to de... | charlie-vo/victorops-sonos | info.py | Python | mit | 1,898 |
import random
import gevent
from requests import Response
from pytest import fixture
from freezegun import freeze_time
from inbox.models.namespace import Namespace
from inbox.test.util.base import (add_generic_imap_account, add_fake_thread, add_fake_message,
add_fake_calendar, add_fak... | nylas/sync-engine | inbox/test/general/test_namespace.py | Python | agpl-3.0 | 15,861 |
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from datetime import datetime
import json
import random
from hashlib import sha512
from base64 import b64encode
from typing import Optional
import requests
from UM.i18n import i18nCatalog
from UM.Logger import Logger
from... | Patola/Cura | cura/OAuth2/AuthorizationHelpers.py | Python | lgpl-3.0 | 6,434 |
from time import time
def countdown(n):
if n < 101:
if n < 1:
return 0
else:
return countdown(n - 1)
else:
countdown(100)
return countdown(n - 100)
countdown(10000)
countdown(10000)
countdown(10000)
countdown(10000)
start = int(time() * 1000)
countdown(... | cesquivias/mumbler | benchmark/countdown/countdown.py | Python | gpl-3.0 | 397 |
# Copyright Aaron Smith 2009
#
# This file is part of Gity.
#
# Gity 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.
#
# Gity is dis... | gngrwzrd/gity | python/unsetconfig.py | Python | gpl-3.0 | 1,399 |
# coding=utf-8
"""
PayPalResponse parsing and processing.
"""
import logging
from pprint import pformat
from vendor.paypalapi.compat import is_py3
if is_py3:
#noinspection PyUnresolvedReferences
from urllib.parse import parse_qs
else:
# Python 2.6 and up (but not 3.0) have urlparse.parse_qs, which is cop... | AlphaCluster/NewsBlur | vendor/paypalapi/response.py | Python | mit | 4,173 |
#!/usr/local/bin/python
import gtk
from net_api import scanWifiBssid, connectToSsid
wpa_supplican = "/etc/wpa_supplicant.conf"
class Authentication:
def button(self):
cancel = gtk.Button(stock=gtk.STOCK_CANCEL)
cancel.connect("clicked", self.close)
connect = gtk.Button(stock=gtk.STOCK_CO... | desktopbsd/networkmgr | src/authentication.py | Python | bsd-3-clause | 3,905 |
# -*- coding: utf-8 -*-
import sys
import os
import unittest
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__)) + "/../../"))
import utils.typeutils
__version__ = 0.1
__author__ = 'weldpua2008@gmail.com'
class TestUtilsTypeClass(unittest.TestCase):
def tearDown(self):
import glo... | theadviceio/executer | tests/utils/test_utils_typeutils.py | Python | apache-2.0 | 5,452 |
from .hu_psi_constraints import HuPsiConstraints
| simvisage/oricreate | oricreate/hu/__init__.py | Python | gpl-3.0 | 50 |
plugin_name = r"""getInfoValues"""
plugin_description = r"""Get Info About Client Info.nfo file"""
plugin_type = r"""remote"""
plugin_source = r"""
values = open(os.path.join(os.path.dirname(sys.argv[0]), 'info.nfo'), 'r').read()
val = ast.literal_eval(values)
mprint = '''
# KEYLOGGER<br>
keylogger status = %s<br>
k... | Swordf1sh/Moderat | plugins/getInfoValues.py | Python | gpl-2.0 | 686 |
class Solution(object):
def validWordSquare(self, words):
"""
:type words: List[str]
:rtype: bool
"""
if words is None or len(words) == 0:
return True
ls = len(words)
for i in range(ls):
for j in range(1, len(words[i])):
... | qiyuangong/leetcode | python/422_Valid_Word_Square.py | Python | mit | 805 |
import json
import sys
import urllib
import urllib2
import time
from urllib2 import HTTPError
# static variables for reuse purpose
# This is the private token used to create the merge request and validate it.
http_header = {'PRIVATE-TOKEN': 'DDDDD'}
base_url_gitlab_api = 'http://<GITLAB_URL>:<GITLAB_PORT>/api/v3/{}'... | artpick/gitlab-mergerequest-policy | src/merge_request.py | Python | mit | 11,126 |
import os
import sys
import codecs
from contextlib import contextmanager
from itertools import repeat
from functools import update_wrapper
from .types import convert_type, IntRange, BOOL
from .utils import make_str, make_default_short_help, echo
from .exceptions import ClickException, UsageError, BadParameter, Abort, ... | tommo/gii | lib/3rdparty/common/click/core.py | Python | mit | 69,593 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('reports', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='fin... | jjpsos/buddy-books | accounting/apps/reports/migrations/0002_auto_20150128_1458.py | Python | mit | 864 |
import unittest
from testproject.tests.core import CoreTestCase
from testproject.tests.flatpages import FlatpagesTestCase
from testproject.tests.templates import TemplateTestCase
def suite():
# this must be changed!! and tests must happen for multiple configurations!
s = unittest.TestSuite()
s.addTest(uni... | ojii/django-multilingual-ng | tests/testproject/tests/__init__.py | Python | mit | 558 |
#!/usr/bin/env python
import json, os, csv
import argparse, sys, unicodedata
from pprint import pprint
import requests
from server_messenger import ServerMessenger
def main():
connectToServer();
collections = [];
# Iterate through the database
url = 'jobs/?format=json';
while(True):
... | emCOMP/visualization | src/python/collection_list.py | Python | mit | 1,564 |
# This is a simple example of how to provision an OpenStack Server using Heat
# native OpenStack resources
from troposphere import Base64, Join
from troposphere import Parameter, Ref, Template
from troposphere.openstack import neutron, nova
template = Template()
keyname_param = template.add_parameter(Parameter(
... | cryptickp/troposphere | examples/OpenStack_Server.py | Python | bsd-2-clause | 1,759 |
#!/usr/bin/env python
# This file is part of tcollector.
# Copyright (C) 2013 The tcollector Authors.
#
# 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, either version 3 of the License, or... | wangy1931/tcollector | collectors/0/postgresql.py | Python | lgpl-3.0 | 4,885 |
#!/usr/bin/env python
from setuptools import setup
setup(
name='autobot',
version='1.0',
description="A full featured irc logging bot with plugin support",
author="Dolores Portalatin",
author_email='hello@doloresportalatin.info',
url='https://github.com/meskarune/autobot',
packages=['autob... | meskarune/autobot | setup.py | Python | gpl-3.0 | 445 |
""" Check currently registered devices in Zimbra and reported unapproved
devices """
import argparse
from cement.core.controller import CementBaseController, expose
from cement.core.foundation import CementApp
from pythonzimbra.communication import Communication
from pythonzimbra.tools import auth
from pythonzimbra.too... | Zimbra-Community/zimbra-tools | checkdevices/checkdevices.py | Python | mit | 12,665 |
class Operation:
"""
Operation, single operation within execution plan.
"""
def __init__(self, name, args=None):
"""
Create a new operation.
Args:
name: string that represents the name of the operation
args: operation arguments
"""
self.n... | swilly22/redisgraph-py | redisgraph/execution_plan.py | Python | bsd-2-clause | 5,416 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | mindriot101/bokeh | bokeh/client/util.py | Python | bsd-3-clause | 3,391 |
import matplotlib.pyplot as plt
import numpy as np
import random
import sys
import os
from base64 import b64encode
import json
#
#FUNCTIONS TO BE USED LATER:
#
#globalSetting options:
#FORMAT, LEGEND,XMAX,YMAX,XMIN.YMIN, PLOTNAME,XLABEL, YLABEL, and SAVEAS
#clean up the user input for Legend Location to make sure th... | UBOdin/mimir | src/main/resources/Plot.py | Python | apache-2.0 | 25,273 |
"""Gevent message daemon missing get_message and handle_message."""
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from ..daemonize import simple as simple_daemonize
from ..pid import simple as simple_pid
from ..sign... | kevinconway/daemons | daemons/prefab/geventd.py | Python | apache-2.0 | 720 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2014-2015 Nick Hall
#
# 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 v... | sam-m888/gramps | gramps/gui/editors/editplacename.py | Python | gpl-2.0 | 5,275 |
from bs4 import BeautifulSoup
from urlparse import urljoin
def getBayArea(dictionary, soup):
for i in soup.find("div",attrs = {'class': "hide-rss-link hdnce-e hdnce-collection-14737-home_category"}).find_all("li"):
if i.find('a'):
dictionary["Bay Area"].append(urljoin("http://www.sfgate.com/"... | young-geng/StatNews | sfgate/homepage.py | Python | gpl-2.0 | 1,957 |
from distutils.core import setup, Extension
x13_hash_module = Extension('x13_hash',
sources = ['x13module.c',
'x13.c',
'sha3/blake.c',
'sha3/bmw.c',
'sha3/groestl.c',
'sha3/jh.c',
'sha3/... | justinvforvendetta/test1234 | src/x13_hash/setup.py | Python | agpl-3.0 | 1,020 |
import math
import cmath
#
#
def radians(degrees):
return math.pi * degrees / 180.0
def degrees(rad):
return 180.0 * rad / math.pi
def rotate_2d(theta, x, y):
"""Rotate point by theta"""
cangle = cmath.exp(theta * 1j)
cx = cangle * complex(x, y)
return cx.real, cx.imag
def angle(x, y):
... | DaveBerkeley/lasercut | laser/laser.py | Python | gpl-2.0 | 20,008 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from selenium import webdriver
@pytest.fixture(scope='module')
def webfront(agent):
return agent.context().lookup('webfront')
@pytest.fixture(scope='module')
def server_url(webfront):
ret... | nickchen-mitac/fork | tests/functional/webpages.py | Python | apache-2.0 | 3,285 |
#!/usr/bin/env python
# Copyright (C) 2009-2014:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken 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 F... | dfranco/shinken | test/test_orphaned.py | Python | agpl-3.0 | 2,684 |
from ..structure import Structure, register
from ..fields import *
@register(magic="XTIW", name="itemtextcache.wdb")
class ItemTextCache(Structure):
id = IntegerField()
text = StringField()
| jleclanche/pywow | old/wdbc/structures/wdb/item.py | Python | cc0-1.0 | 194 |
import sys
import nose
if __name__ == '__main__':
argv = sys.argv[:]
argv.extend(['-c', '.noserc'])
nose.main(argv=argv)
| mottosso/be | run_coverage.py | Python | lgpl-2.1 | 135 |
import datetime
import os
import json
import re
import psycopg2 as dbapi2
class Projeler:
def __init__(self, baslik, konu, sahip, tarih, uniname, aciklama):
self.baslik = baslik
self.konu = konu
self.sahip = sahip
self.tarih = tarih
self.uniname = uniname
self.acikl... | itucsdb1606/itucsdb1606 | projeler.py | Python | gpl-3.0 | 3,066 |
import RPi.GPIO as GPIO
import time
import signal
#------------------------------------------------------------------------
# use the raspi board pin number
#GPIO.setmode(GPIO.BOARD)
# use the gpio number
GPIO.setmode(GPIO.BCM)
# only one of following for GPIO.IN:
PULL = GPIO.PUD_DOWN #GPIO -> GND
#PULL = GPIO.PUD_U... | meigrafd/Sample-Code | interrupt_taster.py | Python | mit | 1,139 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-28 04:10
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial ... | AfricaChess/lichesshub | account/migrations/0001_initial.py | Python | mit | 2,599 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | thoraxe/openshift-ansible | roles/lib_openshift/library/oc_project.py | Python | apache-2.0 | 58,493 |
# -*- coding: utf-8 -*-
#
# google-cloud-monitoring documentation build configuration file
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; value... | jonparrott/gcloud-python | monitoring/docs/conf.py | Python | apache-2.0 | 10,269 |
#!/usr/bin/env python3
from getbtct import getbtct
from gethavk import gethavk
from getltcg import getltcg
from getbighavk import getbighavk
from getbigbtct import getbigbtct
from getbigltcg import getbigltcg
def mwgi():
# Still a Test Version of mgwi
# Going to Grab ASICMINER on each BTC market and CIPHERMINE... | chalbersma/mwgi | v1/acquiremwgi.py | Python | bsd-2-clause | 3,254 |
# 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... | davidzchen/tensorflow | tensorflow/python/data/util/sparse_test.py | Python | apache-2.0 | 12,352 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditio... | Petr-Kovalev/nupic-win32 | build_system/jenkins/linux/ClusterTest/verify_aws_test.py | Python | gpl-3.0 | 5,957 |
import time
import os
import json
from sys import argv
# Date & Time of When script is executed
date_time = (time.strftime(".%d%m%Y.%H%M%S"))
# The filename of the specified C4ALL Json file provided during execution
script, filename = argv
# Open the C4LL json file and loads the content for parsing
data_file = open(... | ridders/c4all-json-converter | json_converter.py | Python | gpl-3.0 | 3,093 |
from django.utils.log import logger
from django.http import HttpResponse
def index(request):
logger.error('Test Django Logging')
return HttpResponse("Hello world Django.")
| zhengjue/mytornado | omserver/OMserverweb/demo/views.py | Python | gpl-3.0 | 183 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017-2021, The Bifrost Authors. All rights reserved.
# Copyright (c) 2017-2021, The University of New Mexico. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met... | ledatelescope/bifrost | python/bifrost/udp_transmit.py | Python | bsd-3-clause | 2,741 |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import urllib2
import cookielib
import os
from datetime import date
from lxml import html
COOKIEFILE='/tmp/csnews.cookie'
cj = cookielib.LWPCookieJar()
def init_robot():
if os.path.isfile(COOKIEFILE):
cj.load(COOKIEFILE)
opener = urllib2.build_opener(urllib... | rfancn/myprojects | cswbrobot/test_csnews.py | Python | mit | 4,855 |
#/usr/bin/python2
'''
IRCBot Proof of Concept.
Purpose: SPARSA Hacknight project.
Fall: 2015.
'''
import urllib
import random
import time
import platform
import os
import socket
import subprocess
import sys
from datetime import datetime
from sys import platform as _platform
def Scanner():
'''
... | jaredestroud/IRCBot | bot.py | Python | apache-2.0 | 5,192 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | infinite_nature/spade.py | Python | apache-2.0 | 5,930 |
import _plotly_utils.basevalidators
class ShowtickprefixValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="showtickprefix",
parent_name="scatterpolar.marker.colorbar",
**kwargs
):
super(ShowtickprefixValidator, self).__init__(
... | plotly/python-api | packages/python/plotly/plotly/validators/scatterpolar/marker/colorbar/_showtickprefix.py | Python | mit | 606 |
@when(u'I choose guilty - don\'t attend')
def step_impl(context):
context.execute_steps(u'''
When I choose "guilty_no_court" from "guilty"
''')
@when(u'I choose guilty - attend')
def step_impl(context):
context.execute_steps(u'''
When I choose "guilty_court" from "guilty"
''')
@when(u... | ministryofjustice/manchester_traffic_offences_pleas | features/steps/charges.py | Python | mit | 883 |
"""
Set up the plot figures, axes, and items to be done for each frame.
This module is imported by the plotting routines and then the
function setplot is called to set the plot parameters.
"""
from pyclaw.data import Data
userdata = Data(['claw.data','setprob.data'])
#--------------------------
def setplot(p... | clawpack/clawpack-4.x | book/chap10/tvb/setplot.py | Python | bsd-3-clause | 2,567 |
# Copyright 2017 Battelle Energy Alliance, 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 t... | idaholab/raven | scripts/conversionScripts/toFilesNode.py | Python | apache-2.0 | 1,819 |
""" Use BpForms to gather rRNA and tRNA modification information from
`MODOMICS <https://iimcb.genesilico.pl/modomics/>`.
:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2020-04-23
:Copyright: 2019, Karr Lab
:License: MIT
"""
import bpforms
import bs4
import csv
import os
import requests
import requests_cache
class ... | KarrLab/kinetic_datanator | datanator/data_source/modomics.py | Python | mit | 13,680 |
#!/usr/bin/env python
"""Chainer example: train a multi-layer perceptron on MNIST using two GPUs.
This is a toy example to write a model-parallel computation in Chainer.
Note that this is just an example; the network definition is not optimal
and performs poorly on MNIST dataset.
"""
import math
import numpy as np
i... | ikasumi/chainer | examples/mnist/train_mnist_model_parallel.py | Python | mit | 4,324 |
# -*- coding: utf-8 -*-
#
# IoC documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 29 01:43:00 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All con... | IUQOL/PMP | vendor/sonata-project/media-bundle/Resources/doc/conf.py | Python | mit | 7,893 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.