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 sys
class RedminePage:
def __init__(self,id):
self._id = id # redmine ID
self._question = "" #question # question
self._question_time = ""#question_time # ask question time
self._floor = 0 # floor sum
self._commo... | labdong801/easyredmine | src/eobj.py | Python | apache-2.0 | 1,572 |
from twilio.rest.resources.util import normalize_dates
from twilio.rest.resources import InstanceResource, ListResource
class Transcription(InstanceResource):
pass
class Transcriptions(ListResource):
name = "Transcriptions"
instance = Transcription
def list(self, **kwargs):
"""
Re... | balanced/status.balancedpayments.com | venv/lib/python2.7/site-packages/twilio/rest/resources/recordings.py | Python | mit | 1,602 |
# encoding: utf-8
"""
The data type and use of it for declaratively creating test courses.
"""
# used to create course subtrees in ModuleStoreTestCase.create_test_course
# adds to self properties w/ the given block_id which hold the UsageKey for easy retrieval.
# fields is a dictionary of keys and values. sub_tree is a... | ahmadiga/min_edx | common/lib/xmodule/xmodule/modulestore/tests/sample_courses.py | Python | agpl-3.0 | 9,544 |
# -*- coding: utf8 -*-
import random
import re
from helga.plugins import match
def imgur(image):
"""
Returns an imgur link with a given hash
"""
return 'http://i.imgur.com/{0}.gif'.format(image)
RESPONSES = {
# Direct text responses
r'(gross|disgusting|eww)': (imgur('XEEI0Rn'),), # Dumb an... | shaunduncan/helga-oneliner | helga_oneliner.py | Python | mit | 8,137 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('warehouse', '0002_gogglesjob'),
]
operations = [
migrations.RenameModel(
old_name='GogglesJob',
new_... | smn/goggles | goggles/warehouse/migrations/0003_auto_20141216_2052.py | Python | bsd-2-clause | 355 |
# projectParams.py
# ----------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to
# http://ins... | anthonybrice/COMP469 | w2/search/projectParams.py | Python | gpl-3.0 | 854 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import os
import re
from contextlib import contextmanager
from uuid import uuid4
from flask import Bluepr... | pferreir/indico | indico/web/flask/wrappers.py | Python | mit | 9,244 |
from django.contrib import admin
from django.forms import ModelForm, CharField
from open_municipio.events.models import *
from tinymce.widgets import TinyMCE
from django.forms.models import inlineformset_factory, BaseInlineFormSet
from django.forms import Textarea, ModelForm, TextInput
# TODO place these widget and f... | openpolis/open_municipio | open_municipio/events/admin.py | Python | agpl-3.0 | 1,812 |
"""experimenting with versioning modes
Revision ID: 4f22490b9071
Revises: 4371f183fc40
Create Date: 2019-08-24 23:56:44.249781
"""
# revision identifiers, used by Alembic.
revision = '4f22490b9071'
down_revision = '4371f183fc40'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
... | fake-name/ReadableWebProxy | alembic/versions/00046_4f22490b9071_experimenting_with_versioning_modes.py | Python | bsd-3-clause | 2,493 |
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. 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
... | phenoxim/cinder | cinder/volume/drivers/zfssa/zfssarest.py | Python | apache-2.0 | 60,863 |
from pyelt.datalayers.database import Column, Columns
from pyelt.datalayers.dv import Sat, DvEntity, Link, Hub, HybridSat, LinkReference
class Role:
pass
class Act:
pass
class Participation:
pass
class Zorgverlener(DvEntity, Role):
class Default(Sat):
zorgverlenernummer = Columns.TextCo... | NLHEALTHCARE/PYELT | tests/old/unit_tests_rob/_domain_rob_unittest.py | Python | gpl-3.0 | 2,194 |
# -*- coding: utf-8 -*-
# This file is part of pygal
#
# A python svg graph plotting library
# Copyright © 2012-2014 Kozea
#
# This library 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... | funkring/fdoo | pygal/graph/stackedbar.py | Python | agpl-3.0 | 4,948 |
#!/usr/bin/env python
# Script by Jason Kwong
# Extracts porB sequence from Neisseria meningitidis
# Use modern print function from python 3.x
from __future__ import print_function
# Modules
import argparse
from argparse import RawTextHelpFormatter
import sys
import os
from io import StringIO
from Bio import SeqIO
fr... | MDU-PHL/meningotype | meningotype/porB.py | Python | gpl-3.0 | 3,596 |
"""test hybrid construction"""
from __future__ import print_function
import logging
logging.basicConfig(level=logging.INFO)
import time
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
from tulip import abstract, hybrid
from polytope import box2poly
input_bound = 0.4
uncertainty = 0.05
cont_state_space ... | tulip-control/tulip-control | examples/developer/fuel_tank/continuous_switched_test.py | Python | bsd-3-clause | 2,645 |
"""
Newton search algorithm.
A powerful method for unconstrained minimization problem.
"""
import sys
import numpy as np
from numpy.linalg import LinAlgError
from models.quadratic import FuncQuadratic
from models.base import FuncModel
class NewtonMethod(object):
_model = None
def __init__(self, model, dim,... | HaiQW/Optimal | search/newton.py | Python | apache-2.0 | 4,376 |
# Copyright (C) 2016 Semenovsky, Oleg <o.semenovsky@gmail.com>
# Author: Semenovsky, Oleg <o.semenovsky@gmail.com>
#
# 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 L... | osemenovsky/oshlex | oshlex/config.py | Python | gpl-2.0 | 6,614 |
#!/usr/bin/env python
#
# Computation of the rate-distortion function for source coding with side
# information at the decoder using the Blahut-Arimoto algorithm.
#
# Formulation similar to R.E. Blahut "Computation of Channel Capacity and
# Rate-Distortion Functions," IEEE Transactions on Information Theory, 18,
# no. ... | isloux/Shannon | python/rbawz2.py | Python | bsd-3-clause | 3,690 |
"""
Запуск через командную строку
$ python "10_exceptions in requests.py" https://github.com
"""
import requests
import sys
url = sys.argv[1]
try:
response = requests.get(url, timeout=30)
response.raise_for_status()
except requests.Timeout:
print("ошибка timeout, url:", url)
except requests.HTTPError as ... | Foxfanmedium/python_training | OnlineCoursera/mail_ru/Python_1/Week_3/10_exceptions in requests.py | Python | apache-2.0 | 663 |
"""SCons.Tool.mslink
Tool-specific initialization for the Microsoft linker.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Fo... | cournape/numscons | numscons/scons-local/scons-local-1.2.0/SCons/Tool/mslink.py | Python | bsd-3-clause | 10,711 |
"""empty message
Revision ID: f3c0682a08dd
Revises: 83c5499c55ed
Create Date: 2016-05-24 07:57:32.946000
"""
# revision identifiers, used by Alembic.
revision = 'f3c0682a08dd'
down_revision = '83c5499c55ed'
from alembic import op
import sqlalchemy as sa
import geoalchemy2
from sqlalchemy_utils import URLType
from... | ryanbaumann/athletedataviz | migrations/versions/f3c0682a08dd_.py | Python | mit | 5,384 |
import CatalogGardenItem
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from otp.otpbase import OTPLocalizer
from direct.interval.IntervalGlobal import *
from toontown.estate import GardenGlobals
class CatalogToonStatueItem(CatalogGardenItem.CatalogGardenItem):
pictureToonS... | ksmit799/Toontown-Source | toontown/catalog/CatalogToonStatueItem.py | Python | mit | 2,471 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
nodes, vBucketsNR = 1, 4096
vBuckets = [nodes] * vBucketsNR
while nodes <= 16:
print min(vBucketsNR * 2, 256) * "-"
nodes += 1
newAdd = [nodes] * (vBucketsNR / nodes)
canBeAssgined = []
for i in range(1, nodes):
# calculate every exist nod... | gugemichael/kvdb | tools/vbuckets.py | Python | apache-2.0 | 1,123 |
from .. import parser, LegacyItemAccess, CommandParser
from insights.specs import Specs
@parser(Specs.sestatus)
class SEStatus(LegacyItemAccess, CommandParser):
"""Class to parse the ``sestatus -b`` command
Attributes:
data (dict): A dict likes
{
"loaded_policy_name": "targeted",
... | RedHatInsights/insights-core | insights/parsers/sestatus.py | Python | apache-2.0 | 2,984 |
#!/usr/bin/env python
# coding: utf-8
"""
Created On Jul 2, 2014
@author: jwang
"""
import logging
# from pymongo import DESCENDING
from weibonews.utils.decorators import perf_logging
from weibonews.db.utils import cursor_to_array
_LOGGER = logging.getLogger('weibonews.wechat')
DB = None
IDS = None
INDEXES = {
... | vispeal/VoteHelper | wechat/wechat/db/wechatdb.py | Python | gpl-2.0 | 2,009 |
from django.template import Library, Node, Variable
from converter.api import get_dimensions
from documents.conf.settings import PRINT_SIZE
register = Library()
class GetImageSizeNode(Node):
def __init__(self, document):
self.document = document
def render(self, context):
document = Variab... | appsembler/mayan_appsembler | apps/documents/templatetags/printing_tags.py | Python | gpl-3.0 | 716 |
"""
Geocoding API Google
import geomapgoogle
geomapgoogle.geocode('San Francisco')
geomapgoogle.regeocode(latlng='40.714224,-73.961452')
"""
import urllib, json
GEOCODE_BASE_URL = 'http://maps.google.com/maps/api/geocode/json'
def geocode(address, sensor='false', **geo_args):
"""
geocoding
"""
geo_args = ... | jolth/gpservi-1.0.1 | Location/geomapgoogle.py | Python | bsd-3-clause | 902 |
"""Provide the _dbm module as a dbm submodule."""
from _dbm import *
| Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/dbm/ndbm.py | Python | gpl-3.0 | 70 |
from math import sqrt
class Vector:
# __slots__ = ['x', 'y']
def __init__(self, x, y):
super().__setattr__('x', x)
super().__setattr__('y', y)
def __eq__(self, other):
return (self.x, self.y) == (other.x, other.y)
def __repr__(self):
return ''.join(('Vector(', str(se... | g-sobral/google-python-exercises | basic/vector.py | Python | apache-2.0 | 1,601 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import sys
import logging
def print_error(msg):
"""
Print a string to stderr.
:param msg: The message to print.
"""
print(msg, file=sys.stderr)
def decode_cli_arg(arg):
"""
Turn a bytestring provided by `arg... | gebn/Stitcher | stitcher/util.py | Python | mit | 1,046 |
# Copyright 2014-2016 Ivan Kravets <me@ikravets.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/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | valeros/platformio | platformio/app.py | Python | apache-2.0 | 5,626 |
"""This module contains code from
Think Python by Allen B. Downey
http://thinkpython.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from lumpy_demo import *
from swampy.Lumpy import Lumpy
def countdown(n):
if n <= 0:
print 'Blastoff!'
lumpy.object... | simontakite/sysadmin | pythonscripts/thinkpython/lumpy_demo2.py | Python | gpl-2.0 | 482 |
"""call with DBFILE THRESH1 THRES2.
DBFILE - pickle file of list of passages, whose terminals are pos-tagged
THRESH1 - int, how many appearances a noun needs in order to be count as
a valid target (less than this threshold is ignored).
THRESH2 - float, what is the ratio between scene-evoking instances to not
which wil... | borgr/ucca | scenes/get_noun_targets.py | Python | gpl-3.0 | 1,307 |
#! /usr/bin/python
import sys
import string
fout = file('user-likesmovie', 'w')
def writetxn(fout, txn) :
for i in txn:
fout.write(str(i) + ' ')
fout.write('\n')
def read_mov(f):
line = f.readline()
movieid = int(line.strip(':\n'))
print '<%s>' % movieid
lines = f.readlines()
de... | examachine/bitdrill | scripts/netflix2user-likesmovie.py | Python | agpl-3.0 | 699 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | nathanbjenx/cairis | cairis/test/test_RiskLevelAPI.py | Python | apache-2.0 | 5,044 |
### extends 'class_empty.py'
### block ClassImports
# NOTICE: Do not edit anything here, it is generated code
from . import gxapi_cy
from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref
### endblock ClassImports
### block Header
# NOTICE: The code generator will not replace the code in this block
### end... | GeosoftInc/gxpy | geosoft/gxapi/GXGER.py | Python | bsd-2-clause | 5,416 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: metagriffin <mg.github@uberdev.org>
# date: 2012/05/13
# copy: (C) Copyright 2012-EOT metagriffin -- see LICENSE.txt
#-----------------------------------------------------------------------------... | metagriffin/pysyncml | pysyncml/items/note.py | Python | gpl-3.0 | 4,879 |
"""Initial migration
Revision ID: ff7e7ae6d711
Revises:
Create Date: 2017-04-23 19:06:15.552092
"""
# revision identifiers, used by Alembic.
revision = 'ff7e7ae6d711'
down_revision = None
branch_labels = ('uber',)
depends_on = None
from alembic import op
import sqlalchemy as sa
import sideboard.lib.sa
try:
i... | RAMSProject/rams | alembic/versions/ff7e7ae6d711_initial_migration.py | Python | agpl-3.0 | 18,774 |
'''
Created on May 25, 2014
@author: doerig
'''
import logging
import logging.config
from testrest.handler.JsonHandler import JsonHandler
class LogHandler(object):
'''
classdocs
'''
_dict = None
def __init__(self, dict):
'''
Constructor
'''
self._dict = JsonHandl... | sdoerig/TestRest | testrest/testrest/logger/LogHandler.py | Python | gpl-3.0 | 2,281 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#======================================================================
#
# compinit.py - python shell tab completion
#
# Created by skywind on 2018/01/27
# Last change: 2018/01/27 21:48:26
#
#======================================================================
... | skywind3000/collection | script/compinit.py | Python | mit | 1,023 |
#!/usr/bin/env python
import logging
import sys
import os
from . import helpers
helpers.setup_path()
from plist.nextstep import NSPlistReader, NSPlistWriter
fname = sys.argv[1]
f = open(fname)
r = NSPlistReader(f, name=fname)
w = NSPlistWriter(sys.stdout)
w.write_plist(r.read())
| alessandrostone/mergepbx | tools/nsplist.py | Python | gpl-3.0 | 285 |
def fast_distinct(model_cls, column):
"""
Use a loose indexscan http://wiki.postgresql.org/wiki/Loose_indexscan
to get all distinct values for a given column
Functionally equivalent to
model_cls.distinct(column).values_list(column, flat=True)
"""
table = model_cls._meta.db_table
assert ... | puttarajubr/commcare-hq | corehq/util/queries.py | Python | bsd-3-clause | 984 |
#!/usr/bin/env @python@
# ROOT command line tools: rootmkdir
# Author: Julien Ripoche
# Mail: julien.ripoche@u-psud.fr
# Date: 20/08/15
"""Command line to add directories in ROOT files"""
import cmdLineUtils
import sys
# Help strings
COMMAND_HELP = "Add directories in ROOT files"
PARENT_HELP = "make parent directo... | BerserkerTroll/root | main/python/rootmkdir.py | Python | lgpl-2.1 | 1,220 |
# -*- coding: utf-8 -*-
"""
Public Python API to create CMS contents.
WARNING: None of the functions defined in this module checks for permissions.
You must implement the necessary permission checks in your own code before
calling these methods!
"""
import datetime
from cms.utils.conf import get_cms_setting
from djang... | foobacca/django-cms | cms/api.py | Python | bsd-3-clause | 12,953 |
# -*- coding: utf-8 -*-
import os
from sys import platform
from random import randint
## Inicializa a lista de amigos que vão participar do sorteio
amigos = []
## Preenche a lista de amigos que vão participar do sorteio
qtd_amigos = int(input("Quantos amigos seu grupo possui? "))
for i in range(qtd_amigos):
amigo... | juliarizza/script-amigo-secreto | amigo_secreto.py | Python | mit | 3,539 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-26 16:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('students', '0011_auto_20170422_0211'),
]
operations = [
migrations.AlterFie... | jamesaud/se1-group4 | jmatcher/students/migrations/0012_auto_20170426_1606.py | Python | mit | 542 |
# 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 ... | ozamiatin/oslo.messaging | oslo_messaging/tests/drivers/pika/test_message.py | Python | apache-2.0 | 22,701 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-03-27 10:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tags', '0020_auto_20190326_1547'),
]
operations = [
migrations.AddField(
model_name='tagversiontype',
... | ESSolutions/ESSArch_Core | ESSArch_Core/tags/migrations/0021_tagversiontype_archive_type.py | Python | gpl-3.0 | 452 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-31 17:41
from __future__ import unicode_literals
from django.db import migrations
from ..models import User
import json
import os
def fill_from_mock(apps, schema_editor):
try:
with open(os.path.join('mock', 'account', 'users.json')) as f:
... | EndyKaufman/django-postgres-angularjs-blog | app/account/migrations/0002_fill_from_mock.py | Python | mit | 1,995 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################################
## Python code generated with wxFormBuilder (version Jun 17 2015)
## http://www.wxformbuilder.org/
##
## PLEASE DO "NOT" EDIT THIS FILE!
###########################################################... | cgqyh/MyAQI | src/myAQIGUI.py | Python | mit | 13,446 |
# Copyright 2015-present The Scikit Flow 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 require... | shishaochen/TensorFlow-0.8-Win | tensorflow/examples/skflow/multiple_gpu.py | Python | apache-2.0 | 1,662 |
#!/usr/bin/env python
import os
from setuptools import setup
def recursive_files(*roots):
for r in roots:
for root, directories, files in os.walk(r):
for i in files:
yield os.path.join(root, i)
setup(name='npactflask',
version='0.6.1',
description='Website for PYNP... | victor-lin/npact | npactflask/setup.py | Python | bsd-3-clause | 777 |
# -*- coding: utf-8 -*-
import pytest
from .fixtures import parametrize
from korona.lib.utils import validate_tag
@parametrize('tag,error,error_msg', [
('htmle', ValueError, 'tag is not supported'),
(None, AttributeError, 'Tag cannot be empty')
])
def test_validate_invalid_tags(tag, error, error_msg):
... | bharadwajyarlagadda/korona | tests/test_tags.py | Python | mit | 478 |
from __future__ import absolute_import
from django import template
from mailviews.helpers import should_use_staticfiles
from mailviews.previews import URL_NAMESPACE
register = template.Library()
def mailviews_static(path):
if should_use_staticfiles():
from django.templatetags.static import static
... | danxshap/django-mailviews | mailviews/templatetags/mailviews.py | Python | apache-2.0 | 532 |
from typing import List
import unittest
import heapq
class Worker:
def __init__(self, wage: float, quality: float):
self.wage = wage
self.quality = quality
self.ratio = wage / quality
def __str__(self) -> str:
return f"R {self.ratio} W {self.wage} Q {self.quality}"
class Sol... | rralcala/random-scripts | py/lc/8/857.py | Python | gpl-2.0 | 1,315 |
"""
WSGI config for rockmylight project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_S... | RockMyLight/django-rml | rockmylight/rockmylight/wsgi.py | Python | mit | 399 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Wei Gao <gaowei3@qq.com>
# Copyright: (c) 2018, 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
ANSIBLE... | pdellaert/ansible | lib/ansible/modules/cloud/vmware/vmware_host_facts.py | Python | gpl-3.0 | 12,620 |
# -*- 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):
# Adding field 'Executor.started'
db.add_column(u'fastapp_executor', 'sta... | sahlinet/fastapp | fastapp/south_migrations/0020_auto__add_field_executor_started.py | Python | mit | 9,248 |
# Add taintlib to PATH so it can be imported during runtime without any hassle
import sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__))))
from taintlib import *
# This has no runtime impact, but allows autocomplete to work
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ..taintlib... | github/codeql | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_with.py | Python | mit | 1,236 |
# Copyright 2016 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.
'''Generates a test suite from NIST PKITS test descriptions.
The output is a set of Type Parameterized Tests which are included by
pkits_unittest.h. See pki... | endlessm/chromium-browser | net/third_party/nist-pkits/generate_tests.py | Python | bsd-3-clause | 55,596 |
import OOMP
newPart = OOMP.oompItem(9233)
newPart.addTag("oompType", "RESE")
newPart.addTag("oompSize", "0402")
newPart.addTag("oompColor", "X")
newPart.addTag("oompDesc", "O123")
newPart.addTag("oompIndex", "67")
OOMP.parts.append(newPart)
| oomlout/oomlout-OOMP | old/OOMPpart_RESE_0402_X_O123_67.py | Python | cc0-1.0 | 243 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import bawebauth.apps.bawebauth.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
o... | mback2k/django-bawebauth | bawebauth/apps/bawebauth/migrations/0001_initial.py | Python | mit | 1,925 |
import string
import datetime
import time
from functions import *
from cloudant.client import Cloudant
from cloudant.error import CloudantException
from cloudant.result import Result, ResultByKey
def getDataFor5min(load):
client = Cloudant("39a4348e-3ce1-40cd-b016-1f85569d409e-bluemix",
"48e266... | maurofm1992/smartpanel | conversions.py | Python | apache-2.0 | 4,085 |
import os
import django
from django.core.checks import run_checks
from django.core.exceptions import AppRegistryNotReady
from celery import Celery
from manage import init_hq_python_path, run_patches
init_hq_python_path()
run_patches()
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'settings')
app = Celery()
app.... | dimagi/commcare-hq | corehq/celery.py | Python | bsd-3-clause | 483 |
import pandas as pd
import numpy as np
import json
def get_data(filename):
with open(filename) as data_file:
# print(ps.read_json(content, orient='values'))
data = json.load(data_file)
dates = pd.to_datetime(data['dates'], format="%Y-%m-%d")
dataset = np.array(data['dataset'], dtype... | ansteh/quandl-url-service | labs/resources.py | Python | mit | 424 |
# -*- coding: utf-8 -*-
"""Test suite for the TG app's models"""
from nose.tools import eq_
from devcon import model
from devcon.tests.models import ModelTest
class TestGroup(ModelTest):
"""Unit test case for the ``Group`` model."""
klass = model.Group
attrs = dict(
group_name = u"test_group",
... | eriknyk/devcon | devcon/tests/models/test_auth.py | Python | lgpl-2.1 | 1,492 |
# -*- encoding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
from enocean.communicators import Communicator
from enocean.protocol.packet import Packet
from enocean.protocol.constants import RORG, DB6
from enocean.decorators import timing
@timing(rounds=100, limit=750)
... | Ethal/enocean | enocean/protocol/tests/test_teachin.py | Python | mit | 1,614 |
"""This module does the argument and config parsing, and contains the main
function (that is called when calling pep8radius from shell)."""
from __future__ import print_function
import os
import sys
try:
from configparser import ConfigParser as SafeConfigParser, NoSectionError
except ImportError: # py2, pragma:... | hayd/pep8radius | pep8radius/main.py | Python | mit | 11,438 |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... | dirkmueller/kiwi | kiwi/builder/__init__.py | Python | gpl-3.0 | 2,508 |
"""
For more details, see the class documentation.
"""
class WikiInfoDTO:
"""
This class represents the data transfer object for a Wikipedia article.
"""
def __init__(self):
"""
Constructor to initialize this object.
"""
self.location = None
self.title = ""
... | agarwalt/WikiNearby | map_annotate_app/dto/WikiInfoDTO.py | Python | mit | 796 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2011
# Pexego Sistemas Informáticos. (http://pexego.es) All Rights Reserved
#
# Migración OpenERP 7.0. Top Consultant Software Creations S.L. (http://www.topconsultant.es/) 2013
# ... | jmesteve/saas3 | openerp/addons_extra/l10n_es_aeat_mod349/wizard/calculate_mod349_records.py | Python | agpl-3.0 | 13,600 |
# Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | davehunt/selenium | py/test/selenium/webdriver/common/children_finding_tests.py | Python | apache-2.0 | 6,753 |
# encoding:utf-8
import datetime
from django.core.urlresolvers import reverse
from django.db import models
from mptt.models import MPTTModel, TreeForeignKey
from tagging.fields import TagField
from apps.models import CommentEntity
class Category(MPTTModel):
"""
种类
"""
name = models.CharField(u'名称', ma... | openslack/openslack-web | openslack/apps/industry/models.py | Python | apache-2.0 | 2,174 |
from __future__ import unicode_literals
from decimal import Decimal
import gittip
from aspen.utils import utcnow
from gittip.testing import Harness
from gittip.testing.client import TestClient
class TestRecordAnExchange(Harness):
# fixture
# =======
def setUp(self):
super(Harness, self).setUp()... | bountysource/www.gittip.com | tests/test_record_an_exchange.py | Python | cc0-1.0 | 3,836 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.datatype import AttribDict
_defaults = {
"csvDel": ',',
"timeSec": 5,
"googlePage": 1,
"verbose": 1,
"delay": 0,
"tim... | hackersql/sq1map | lib/core/defaults.py | Python | gpl-3.0 | 566 |
from PyQt4.QtCore import QString
try:
_from_Utf8 = QString.fromUtf8
except AttributeError:
_from_Utf8 = lambda s: s
| dpr10/whooshle-insight | common/utilities.py | Python | gpl-2.0 | 125 |
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 6677
MESSAGE = "setsocket:Amp:1"
print( "UDP target IP:", UDP_IP )
print( "UDP target port:", UDP_PORT )
print( "message:", MESSAGE )
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(bytes(MESSAGE, "utf8"), (UDP_IP... | coolchip/powerPiWidget | python_udp/sender.py | Python | mit | 332 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class JournalVoucherDetail(Document):
pass | suyashphadtare/vestasi-erp-1 | erpnext/erpnext/accounts/doctype/journal_voucher_detail/journal_voucher_detail.py | Python | agpl-3.0 | 273 |
import random
def gen_rand():
return random.randrange(0, 25)
def gen_rand_arr():
a = []
a.append(gen_rand())
a.append(gen_rand()+a[-1])
a.append(gen_rand()+a[-1])
a.append(gen_rand()+(a[-1]*3))
a.append(gen_rand()+(a[-1]*3))
for i in range(len(a)):
a[i] = str(a[i])
return a... | teja635/vandy_hacks | random_data_generator.py | Python | mit | 719 |
# coding: utf-8
from .platform import TestPlatform, make_test_fsm
| BernardFW/bernard | src/bernard/platforms/test/__init__.py | Python | agpl-3.0 | 66 |
#!/usr/bin/env python
class Solution:
def solveNQueens(self, n: int):
import itertools
def search(seq, col, dia1, dia2, k):
return [seq] if k == n else list(itertools.chain.from_iterable([search(seq+str(i), col+[i], dia1+[k+i], dia2+[k-i], k+1) for i in range(n) if (i not in col) and (k... | eroicaleo/LearningPython | interview/leet/51_N-Queens_v2.py | Python | mit | 616 |
"""
cycapture provides python (cython) bindings for the libpcap and libtins libraries.
"""
__author__ = 'stef'
| stephane-martin/cycapture | cycapture/__init__.py | Python | lgpl-3.0 | 113 |
from __future__ import unicode_literals
from dvc.output.hdfs import OutputHDFS
from dvc.dependency.base import DependencyBase
class DependencyHDFS(DependencyBase, OutputHDFS):
pass
| dataversioncontrol/dvc | dvc/dependency/hdfs.py | Python | apache-2.0 | 188 |
# 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, software
# distributed under t... | jonnary/keystone | keystone/tests/unit/test_v3_assignment.py | Python | apache-2.0 | 135,102 |
'''
Created on Nov 22, 2012
@author: Buddhika De Seram
'''
class MQTT:
database5 = None
threed_pub = None
client_cosm = "LIB_cosm"
client_ts = "LIB_ts"
client_3d = "LIB_3d"
client_sense = "LIB_sense"
client_3bpub = "3dPub"
server = "winter.ceit.uq.edu.au"
client = "LIB_temp"
clie... | craigknott/CEIT_Sensors_Server | MQTT.py | Python | mit | 542 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 New Dream Network, LLC (DreamHost)
#
# Author: Doug Hellmann <doug.hellmann@dreamhost.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
#
# ... | ramineni/myironic | ironic/api/controllers/root.py | Python | apache-2.0 | 2,972 |
# coding=utf-8
# Copyright 2022 The ML Fairness Gym 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/ml-fairness-gym | run_util.py | Python | apache-2.0 | 4,856 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import urlparse
from odoo import http
from odoo.http import request
from odoo.addons.website_mail.controllers.main import WebsiteMail
class WebsiteMailController(WebsiteMail):
@http.route(['/website_mail/post/jso... | ayepezv/GAD_ERP | addons/website_sale/controllers/website_mail.py | Python | gpl-3.0 | 2,183 |
# 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 ... | v-iam/azure-sdk-for-python | azure-batch/azure/batch/models/pool_upgrade_os_parameter.py | Python | mit | 1,060 |
#/usr/bin/python3.4
# Lista os usuários cadastrados
# Autor: Everton de Vargas Agilar
# Data: 20/10/2014
# python
import http.client
conn = http.client.HTTPConnection('localhost', 8000)
conn.request("GET",'/acesso/api1/adm/Usuario/')
response = conn.getresponse().read().decode("utf-8")
conn.close()
print(response)
... | eliot-framework/eliot | test/lista_users.py | Python | gpl-2.0 | 391 |
###############################################################################
# lazyflow: data flow based lazy parallel computation framework
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/o... | stuarteberg/lazyflow | tests/testOpColorizeLabels.py | Python | lgpl-3.0 | 3,980 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from os.path import join as pjoin
import numpy as np
from dis... | zhongyx12/Faster-RCNN-Refinement | faster_rcnn/setup.py | Python | mit | 5,979 |
# Generated by Django 1.9.13 on 2018-05-18 10:17
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("candidates", "0044_remove_membership_fk_to_election"),
("popolo", "0002_update_model... | DemocracyClub/yournextrepresentative | ynr/apps/popolo/migrations/0003_move-extra-fields-to-base.py | Python | agpl-3.0 | 990 |
#!/usr/local/lib/mailinabox/env/bin/python
# This script performs a backup of all user data:
# 1) System services are stopped.
# 2) STORAGE_ROOT/backup/before-backup is executed if it exists.
# 3) An incremental encrypted backup is made using duplicity.
# 4) The stopped services are restarted.
# 5) STORAGE_ROOT/backup... | mail-in-a-box/mailinabox | management/backup.py | Python | cc0-1.0 | 20,895 |
"""
WSGI config for admin_readonly_model project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault(... | mozillazg/django-simple-projects | projects/admin_readonly_model/admin_readonly_model/wsgi.py | Python | mit | 417 |
#! /usr/bin/env python
# kicad2protel: kicad gerber output normalizer
# Copyright (C) 2015 Jeff Ciesielski <jeffceisielski@gmail.com>
# 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; version 2
#... | Jeff-Ciesielski/kicad2protel | kicad2protel.py | Python | gpl-2.0 | 11,099 |
#!/bin/env python
import os
from setuptools import setup
def find_xdg_data_files(syspath, relativepath, pkgname, data_files=[]):
for (dirname, _, filenames) in os.walk(relativepath):
if filenames:
syspath = syspath.format(pkgname=pkgname)
subpath = dirname.split(relativepath)[1]
... | eliostvs/tomate-notify-plugin | setup.py | Python | gpl-3.0 | 1,311 |
# 1-example.py -- Examples which rely on accessories
# (and therefore also on xutils)
#
# Copyright 2008 Alberto Milone <albertomilone@alice.it>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General P... | tseliot/XKit | examples/1-example.py | Python | gpl-2.0 | 7,180 |
# -*- coding: utf-8 -*-
import os
import re
import urllib
import requests
from bs4 import BeautifulSoup
import simplejson as json
class zamunda():
def __init__(
self,
xxx,
base_url,
usr,
passwd,
path,
bau... | kodi1/plugin.video.zamunda | resources/lib/zamunda.py | Python | gpl-3.0 | 7,252 |
from lib.layer_utils import *
from lib.grad_check import *
from lib.optim import *
import numpy as np
import copy
class CIFAR10_DataLoader(object):
"""
Data loader class for CIFAR-10 Data.
Arguments:
- data: Array of input data, of shape (batch_size, d_1, ..., d_k)
- labels: Array of labels, of shape (batch_size... | vatsalgit/Deep-Learning- | assignment1/lib/train.py | Python | gpl-3.0 | 7,568 |
# -*- encoding: utf-8 -*-
#
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2013 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
#
# Coded by: Fernando Rangel (fernando.rangel@vauxoo.com)
#
#
# This program is free software: you can ... | 3dfxsoftware/cbss-addons | partner_search_by_vat/model/res_partner.py | Python | gpl-2.0 | 3,218 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.