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 unittest
from datetime import datetime
from os import path, remove
from rostam.db.models.container import Docker
from rostam.db.models.timeentry import TimeEntry
from rostam.db.sqlite import Database
class SQLITETest(unittest.TestCase):
def test_database_create(self):
location = 'rostam.db'
... | abzcoding/rostam | tests/db_test.py | Python | bsd-3-clause | 2,384 |
from django.db import models
from django.contrib.auth.models import User
from pagetree.helpers import get_section_from_path, get_module
class UserProfile(models.Model):
user = models.OneToOneField(User, unique=True)
current_location = models.CharField(max_length=256, default="", blank=True)
def current_m... | ccnmtl/diabeaters | diabeaters/main/models.py | Python | gpl-2.0 | 470 |
# Copyright 2016-2017 Alan F Rubin
#
# This file is part of Enrich2.
#
# Enrich2 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.
... | daniaki/Enrich2 | plugins/regression_scorer.py | Python | gpl-3.0 | 12,555 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the source package recipe view classes and templates."""
__metaclass__ = type
from mechanize import LinkNotFoundError
from storm.locals import Store
from testtools.ma... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/code/browser/tests/test_sourcepackagerecipebuild.py | Python | agpl-3.0 | 11,028 |
""" Functional Test == Acceptance Test == End-to-End Test == Black box Test
Overview: helps you build an application with the right functionality
and guarantees that you never accidentally break it. This kind of test
looks at how the whole application functions (from the outside) and should
have human... | WilliamQLiu/job-waffle | functional_tests/test_functional.py | Python | apache-2.0 | 3,417 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import sorl.thumbnail.fields
from django.conf import settings
import cambiaahora.utils
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL... | CARocha/plataforma_fadcanic | cambiaahora/configuracion/migrations/0001_initial.py | Python | mit | 1,797 |
# Copyright (C) 2013 Jeremy S. Sanders
# Email: Jeremy Sanders <jeremy@jeremysanders.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 2 of the License, or
# ... | KDB2/veusz | veusz/dataimport/dialog_twod.py | Python | gpl-2.0 | 7,000 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import datetime
import jinja2
import json
import os
import sys
import shutil
from common import conf, logger
from url_db import url_db
from timeline_db import timeline_db
RSS_TITLE = 'twimg2rss'
RSS_DESC = 'Images in my Twitter home timeline'
RSS_TEMPLATE_J2_FILE = 'twim... | kiyoad/twimg2rss | make_xml.py | Python | mit | 6,992 |
import numpy as np
import tensorflow as tf
from .module import Module
class RBFExpansion(Module):
def __init__(self, low, high, gap, dim=1, name=None):
self.low = low
self.high = high
self.gap = gap
self.dim = dim
xrange = high - low
self.centers = np.linspace(low... | atomistic-machine-learning/SchNet | src/schnet/nn/layers/rbf.py | Python | mit | 966 |
from django.db import models
class Survey(models.Model):
owner = models.CharField(max_length=100)
title = models.CharField(max_length=50)
question = models.CharField(max_length=300)
active = models.BooleanField(default=True)
created = models.DateTimeField(auto_now_add=True, auto_now=False)
updated = model... | dbarenas/Katja-hop | web/rest-test2/survey_proj/survey/models.py | Python | gpl-2.0 | 609 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2018-02-04 20:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('travel', '0014_auto_20180204_2249'),
]
operations = [
migrations.RemoveFiel... | avaika/avaikame | project/travel/migrations/0015_auto_20180204_2318.py | Python | gpl-3.0 | 729 |
#!/usr/bin/env python
# encoding: utf-8
from wtforms import Form
from workin.forms.utils import MultiValueDict
class BaseForm(Form):
"""
Usage:
class HelloForm(BaseForm):
planet = TextField('name', validators=[Required()])
"""
def __init__(self, handler=None, obj=None, prefix='', formda... | knownsec/workin | workin/forms/base.py | Python | bsd-3-clause | 598 |
import logging
import argparse
import json
import logging
import os
import csv
import apache_beam as beam
from urlparse import urlparse
class PredictDoFn(beam.DoFn):
def __init__(self,argv):
#capture any command line arguments passed to dataflow that belong to DeepMeerkat
self.argv=argv
def process(se... | bw4sz/DeepMeerkat | run_clouddataflow.py | Python | gpl-3.0 | 3,198 |
from mock import Mock
from unittest import TestCase
import keywords_from_fr as fr
class FRTests(TestCase):
"""Tests keywords_from_fr"""
def test_normalize_name(self):
for old, new in (
('United States African Development Foundation',
'AFRICAN DEVELOPMENT FOUNDATION'),
... | sunlightlabs/foia-data | new/new-more/foia-master/contacts/tests/keywords_from_fr_tests.py | Python | gpl-3.0 | 2,306 |
import subprocess
import jinja2
import unittest
import os
import shutil
import json
import signal
import sys
import time
import yaml
from datetime import datetime, timedelta
from .compose import ComposeMixin
BEAT_REQUIRED_FIELDS = ["@timestamp",
"beat.name", "beat.hostname", "beat.version"]
... | roncohen/apm-server | _beats/libbeat/tests/system/beat/beat.py | Python | apache-2.0 | 17,661 |
#split in words and get word lengths
[len(word) for word in sentence.split()] | jorisvandenbossche/DS-python-data-analysis | notebooks/python_recap/_solutions/01-basic49.py | Python | bsd-3-clause | 77 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Decode the trained CTC outputs (TIMIT corpus)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from os.path import join, abspath
import sys
import tensorflow as tf
import yaml
import argparse
sys.path.a... | hirofumi0810/tensorflow_end2end_speech_recognition | examples/timit/visualization/decode_ctc.py | Python | mit | 7,425 |
from setuptools import setup
with open('README.rst') as README:
long_description = README.read()
long_description = long_description[long_description.index('Description'):]
setup(name='aesmix',
version='1.6',
description='Mix&Slice',
long_description=long_description,
url='http://githu... | unibg-seclab/aesmix | python/setup.py | Python | mit | 708 |
import os
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
# this is where the name lists and the icon id file is stored
ICON_DATABASE_FOLDER = "../icon-database"
# this is the subfolder inwhich the debug theme is saved
FINAL_THEME_FOLDER = "../final-themes"
# only these context... | debug-icons-project/debug-icons-tools | code/create_theme.py | Python | mit | 14,336 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer, RESPONSE_HEADER_SIZE
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import D... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/multi_map_put_codec.py | Python | apache-2.0 | 1,112 |
'''The SuperText class inherits from Tkinter's Text class and provides added
functionality to a standard text widget:
- Option to turn scrollbar on/off
- Right-click pop-up menu
- Two themes included (terminal and typewriter)
Compliant with Python 2.5-2.7
Author: @ifthisthenbreak
http://code.activestate.com/recipes/... | karimbahgat/Tk2 | tk2/texteditor(old).py | Python | mit | 8,820 |
# Licenced under the txaws licence available at /LICENSE in the txaws source.
"""
Tests for L{txaws.route53.model}.
"""
from ipaddress import IPv4Address
from twisted.trial.unittest import TestCase
from txaws.route53.model import (
Name, SOA, NS, CNAME, A,
)
from txaws.util import XML
class BasicResourceRecor... | twisted/txaws | txaws/route53/tests/test_model.py | Python | mit | 2,729 |
#
# Lecture 3 - Predicting image labels
# Fully connected network
# (includes one-hot encoding, cross entropy)
#
import tensorflow as tf
from libs import datasets
import matplotlib.pyplot as plt
import numpy as np
import datetime
# dja
#np.set_printoptions(threshold=np.inf) # display FULL array (infinite)
plt.ion()
... | dariox2/CADL | session-3/l3b-predict-fullyconnected.py | Python | apache-2.0 | 2,720 |
toppings = ["pepperoni", "sausage", "cheese", "peppers"]
choosen_toppings = []
choice_1 = raw_input("Please, give me a topping: ")
choice_2 = raw_input("Please give me one more topping: ")
if choice_1 in toppings:
choosen_toppings.append(choice_1)
else:
print "Sorry, we do not have {}".format(choice_1)
if choic... | jobli/24 | hour6.py | Python | gpl-3.0 | 496 |
import unittest
from unittest import TestCase
import random
from random import randrange
random.seed(2)
from myhdl import Simulation, StopSimulation, Signal, \
delay, intbv, negedge, posedge, now
from dff import dff
from dff_clkout import dff_clkout
ACTIVE_LOW, INACTIVE_HIGH = 0, 1
class TestDff(T... | jck/myhdl | cosimulation/test/test_dff.py | Python | lgpl-2.1 | 2,670 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
AutofillDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
************************... | AsgerPetersen/QGIS | python/plugins/processing/gui/AutofillDialog.py | Python | gpl-2.0 | 2,276 |
__author__ = 'Sébastien Guimmara <sebastien.guimmara@gmail.com>'
import os
import shutil
import context
from src.builtin import init
ARENA_PATH = None
def get_file_dir(file):
if file is None:
raise TypeError
return os.path.dirname(os.path.realpath(file))
def get_tests_dir():
return os.path.dir... | Groutcho/Pit | src/tests/test_utils.py | Python | gpl-2.0 | 1,660 |
# -*- coding: utf-8 -*-
from rest_framework import status
from rest_framework.response import Response
from rest_framework.settings import api_settings
class CreateModelMixin(object):
"""
Create a model instance.
"""
def create(self, request, *args, **kwargs):
# Serializer that will be used to... | jualjiman/knowledge-base | provision/templates/django/core/api/mixins/__init__.py | Python | apache-2.0 | 4,067 |
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful
# but... | rndusr/stig | stig/tui/table.py | Python | gpl-3.0 | 4,209 |
import time
from cookielib import CookieJar as _CookieJar, DefaultCookiePolicy, IPV4_RE
from pyrake.utils.httpobj import urlparse_cached
class CookieJar(object):
def __init__(self, policy=None, check_expired_frequency=10000):
self.policy = policy or DefaultCookiePolicy()
self.jar = _CookieJar(self... | elkingtowa/pyrake | pyrake/http/cookies.py | Python | mit | 4,973 |
import numpy as np
from BDSpace.Coordinates import Cartesian
from BDSpace.Curve.Parametric import Helix
from matplotlib import pyplot as plt
def plot_tree(mesh_tree, ax=None):
colors = ['r', 'g', 'b', 'c', 'm', 'y', 'k', 'r', 'g', 'b', 'c', 'm', 'y', 'k',
'r', 'g', 'b', 'c', 'm', 'y', 'k', 'r', 'g',... | bond-anton/Space | demo/03_helix_length.py | Python | apache-2.0 | 1,875 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# nph2npsvg.py: Convert NumptyPhysics levels to SVG
# Thomas Perl <m@thp.io>; 2014-12-26
#
import re
import os
import sys
WIDTH = 800
HEIGHT = 480
URL = 'http://numptyphysics.garage.maemo.org/'
FLAGS = [
'token',
'goal',
'fixed',
'sleeping',
'decor'... | thp/numptyphysics | tools/nph2npsvg.py | Python | gpl-3.0 | 3,409 |
"""
=========================================
SGD: Maximum margin separating hyperplane
=========================================
Plot the maximum margin separating hyperplane within a two-class
separable dataset using a linear Support Vector Machines classifier
trained using SGD.
"""
print(__doc__)
import numpy as n... | depet/scikit-learn | examples/linear_model/plot_sgd_separating_hyperplane.py | Python | bsd-3-clause | 1,201 |
from telegram.ext import CommandHandler, Handler, MessageHandler, StringCommandHandler
class FakeHandler(Handler):
check_update = lambda: None
handlers = (
CommandHandler("cmdm41", lambda: None),
CommandHandler("cmdm42", lambda: None),
StringCommandHandler("cmdm43", lambda: None),
MessageHandler... | fjfnaranjo/fjfnaranjo-bot | tests/component_mocks/handlers/component_mock4/info.py | Python | gpl-3.0 | 375 |
"""Routes configuration
The more specific and detailed routes should be defined first so they
may take precedent over the more generic routes. For more information
refer to the routes manual at http://routes.groovie.org/docs/
"""
from routes import Mapper
def make_map(config):
"""Create, configure and return the ... | mtholder/phyloplumber | phyloplumber/config/routing.py | Python | gpl-3.0 | 2,008 |
# coding=utf-8
import os
from collections import OrderedDict
from ensembl import get_merged_cds
from os.path import join, abspath, realpath, dirname, relpath
from pybedtools import BedTool
from targqc.qualimap import report_parser, runner
from targqc.utilz.bed_utils import get_padded_bed_file, intersect_bed, calc_sum_o... | vladsaveliev/TargQC | targqc/general_report.py | Python | gpl-3.0 | 36,428 |
from . import db_utils
def gravity_model_score(city_a, city_b):
"""
Calculates the relationship strength between two cities based
on the gravity model, defined as:
(populationA * populationB) / distanceAB^2
:param city_a: The name of city A
:param city_b: The name of city B
:return: The ... | urbansearchTUD/UrbanSearch | urbansearch/utils/score_utils.py | Python | gpl-3.0 | 572 |
#
# Copyright 2016 The Charles Stark Draper Laboratory
#
# 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 ap... | draperlaboratory/user-ale | demo/dashboard/files/twisted_app.py | Python | apache-2.0 | 7,791 |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
import collections
import traceback
from astroid import nodes
class ASTWalker:
def __init__(self, linter):
# callbacks per node types
self.nbstatement... | PyCQA/pylint | pylint/utils/ast_walker.py | Python | gpl-2.0 | 3,250 |
#!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the follo... | flirtcoin/flirtcoin | contrib/devtools/update-translations.py | Python | mit | 6,783 |
# -*- coding: utf-8 -*-
# /***************************************************************************
# Irmt
# A QGIS plugin
# OpenQuake Integrated Risk Modelling Toolkit
# -------------------
# begin : 2013-10-24
# copyright ... | gem/oq-svir-qgis | svir/dialogs/load_gmf_data_as_layer_dialog.py | Python | agpl-3.0 | 11,659 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | PLyczkowski/Sticky-Keymap | 2.74/scripts/addons_contrib/io_points_pcd/__init__.py | Python | gpl-2.0 | 2,947 |
# Copyright 2021 Open Source Integrators
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class Partner(models.Model):
_inherit = "res.partner"
@api.model
def _get_default_stage_id(self):
return self.env["res.partner.stage"].search(
... | OCA/partner-contact | partner_stage/models/res_partner.py | Python | agpl-3.0 | 773 |
import unittest
import requests_mock
from canvasapi import Canvas
from canvasapi.exceptions import RequiredFieldMissing
from canvasapi.planner import PlannerNote, PlannerOverride
from tests import settings
from tests.util import register_uris
@requests_mock.Mocker()
class TestPlannerNote(unittest.TestCase):
def... | ucfopen/canvasapi | tests/test_planner.py | Python | mit | 7,052 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# no... | little-dude/monolithe | monolithe/generators/lib/templatefilewriter.py | Python | bsd-3-clause | 3,458 |
from django_facebook.management.commands.base import CustomBaseCommand
from django_facebook.utils import queryset_iterator
from optparse import make_option
import datetime
class ExtendTokensCommand(CustomBaseCommand):
help = 'Extend all the users access tokens\'s, per hour'
option_list = CustomBaseCommand.opt... | abhijo89/Django-facebook | django_facebook/management/commands/extend_tokens.py | Python | bsd-3-clause | 620 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/btp_function_declaration246.py | Python | mit | 13,254 |
import datetime
import pytest
import pytz
from Cerebrum.utils import date
from Cerebrum.utils import date_compat
LOCAL_TZ = pytz.timezone('Europe/Oslo')
class MockDateTime(object):
""" a mock mx.DateTime object with pydate() and pydatetime() """
def __init__(self, ts):
self.ts = ts
def pydat... | unioslo/cerebrum | testsuite/tests/test_core/test_utils/test_date_compat.py | Python | gpl-2.0 | 4,071 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import exceptions
from odoo.addons.mail.tests.common import mail_new_test_user
from odoo.addons.sales_team.tests.common import TestSalesMC
from odoo.tests.common import users, TransactionCase
from odoo.tools im... | jeremiahyan/odoo | addons/sales_team/tests/test_sales_team_internals.py | Python | gpl-3.0 | 3,645 |
"""
This module abstracts all the bytes<-->string conversions so that the python 2
and 3 code everywhere else is similar. This also has a few simple functions
that deal with the fact that bytes are different between the 2 versions even
when using from __future__ import unicode_literals. For example:
Python 2:
b'm... | GreatFruitOmsk/protobuf-py3 | python/google/protobuf/internal/utils.py | Python | bsd-3-clause | 6,330 |
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM 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 Founda... | bchiroma/DreamProject_2 | dream/simulation/applications/CapacityStations/CapacityStation.py | Python | gpl-3.0 | 5,020 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-07 14:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('product', '0013_auto_20161207_0555'),
]
operations = [
migrations.AlterFiel... | itbabu/saleor | saleor/product/migrations/0014_auto_20161207_0840.py | Python | bsd-3-clause | 489 |
from .types import EnumType
from .models import BetfairModel
__all__ = ['EnumType', 'BetfairModel']
| Taketrung/betfair.py | betfair/meta/__init__.py | Python | mit | 101 |
#!/usr/bin/python
import curses
class LCD(object):
def __init__(self):
try:
self.__stdscr = curses.initscr()
except Exception:
self.__stdscr = None
if (self.__stdscr is not None):
curses.noecho()
curses.cbreak()
self._... | fabienroyer/ReflowOven | lcd.py | Python | lgpl-3.0 | 1,228 |
import django
from django.conf.urls import url
from django.views.generic import TemplateView
urlpatterns = [
url(
r'^$',
TemplateView.as_view(
template_name='robots/robots.txt',
content_type='text/plain'
),
name='robots'
),
]
if django.VERSION < (1, 9)... | jbergantine/django-robots | django_robots/urls.py | Python | mit | 622 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import psycopg2
from odoo.models import BaseModel
from odoo.tests.common import TransactionCase
from odoo.tools import mute_logger
import odoo.osv.expression as expression
class TestExpression(TransactionCase):
d... | ayepezv/GAD_ERP | openerp/addons/base/tests/test_expression.py | Python | gpl-3.0 | 52,611 |
'''Routes and Views for the Settings'''
from flask import render_template, request, redirect, url_for
from flask_security import login_required, current_user
from flask_security.forms import ChangePasswordForm
from crestify import app
from crestify.models import User
from crestify.forms import PerPageForm, BookmarkImpo... | crestify/crestify | crestify/views/settings.py | Python | bsd-3-clause | 2,489 |
import datetime
import docker
import json
import math
import multiprocessing
import os
import pkg_resources
import platform
import re
import requests
from subprocess import check_output, Popen, PIPE
from vent.api.templates import Template
from vent.helpers.paths import PathDirs
from vent.helpers.logs import Logger
l... | lilchurro/vent | vent/helpers/meta.py | Python | apache-2.0 | 21,703 |
from os.path import abspath, dirname, join
from setuptools import setup
from adventurelib import __version__
ROOT = abspath(dirname(__file__))
with open(join(ROOT, "README.md")) as fd:
README = fd.read()
setup(
name='adventurelib',
description='Easy text adventures',
long_description=README,
lo... | lordmauve/adventurelib | setup.py | Python | mit | 1,091 |
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import sys
try:
image = mpimg.imread('test.jpg')
except FileNotFoundError as e:
print(e)
sys.exit(1)
print('This image is: {}, with dimensions: {}'.format(type(image), image.shape))
ysize = image.shape[0]
xsize = image.sha... | akshaybabloo/Car-ND | Term_1/Finding_Lane_Lines_1/2_color_region_masking.py | Python | mit | 2,501 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
examples
~~~~~~~~
README examples
Examples:
Setup
>>> import sys
>>> from json import loads
>>> from io import StringIO
>>>
>>> sys.stderr = sys.stdout
Hello World
>>> from pygogo import logger
... | reubano/pygogo | examples.py | Python | mit | 7,694 |
a = int(input())
for i in range(1,a):
if i==10:
print('otl')
if i%2==0:
print('even')
else:
print('odd')
| alekseik1/python_mipt_study_1-2 | 1sem/from_list/1.py | Python | gpl-3.0 | 123 |
from django.conf.urls import url, include
from django.contrib import admin
from tweets import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', views.index),
url(r'^tweets/', include('tweets.urls', namespace='tweets', app_name='tweets')),
url(r'^account/', include('account.urls', names... | zhexiao/kweets | kweets/urls.py | Python | apache-2.0 | 360 |
# Copyright 2016 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... | wangyum/tensorflow | tensorflow/contrib/keras/python/keras/callbacks_test.py | Python | apache-2.0 | 18,785 |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | talon-one/talon_one.py | test/test_integration_event.py | Python | mit | 2,069 |
# -*- coding: utf-8 -*-
# Project : LM4paper
# Created by igor on 2016/12/2
import sys
import time
import numpy as np
import tensorflow as tf
from tensorflow.python.client import timeline
from bmlm.lm import LM
from bmlm.common import CheckpointLoader
def run_train(dataset, hps, logdir, ps_device, task=0, master="... | IgorWang/LM4paper | bmlm/run_utils.py | Python | gpl-3.0 | 6,059 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('simpletext', '__first__'),
('bidders', '0003_bidder_address'),
]
operations = [
migrations.AddField(
mod... | kecheon/yablist | bidders/migrations/0004_bidder_tags.py | Python | mit | 460 |
if __name__ == '__main__':
print("Loading Modules...")
from setuptools.command import easy_install
def install_with_easyinstall(package):
easy_install.main(["-U", package])
imported = False
tries = 0
while not imported:
try:
import socket, importlib
globals()['PIL'] = importlib.import_m... | TNT-Samuel/Coding-Projects | Image Test/_ImageEdit3MultiProcess.py | Python | gpl-3.0 | 17,506 |
def iterQueue(queue, sentinel):
"""Iterate over the values in queue until sentinel is reached."""
while True:
value = queue.get()
if value != sentinel:
yield value
else:
return
| ActiveState/code | recipes/Python/252498_Generator_That_Helps_Simplify_Queue/recipe-252498.py | Python | mit | 233 |
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.mozilla.org/MPL/
#
# Softwa... | twobraids/configman_orginal | configman/dotdict.py | Python | bsd-3-clause | 1,840 |
from collections import namedtuple
from ..exceptions import LocationParseError
url_attrs = ['scheme', 'auth', 'host', 'port', 'path', 'query', 'fragment']
class Url(namedtuple('Url', url_attrs)):
"""
Datastructure for representing an HTTP URL. Used as a return value for
:func:`parse_url`.
"""
sl... | gautamMalu/rootfs_xen_arndale | usr/lib/python2.7/dist-packages/urllib3/util/url.py | Python | gpl-2.0 | 4,351 |
from __future__ import unicode_literals
import time
import unittest
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse
from django.test import RequestFactory, SimpleTestCase, override_settings
from django.test.utils import require_jinja2
from django.urls import resolve
from d... | frishberg/django | tests/generic_views/test_base.py | Python | bsd-3-clause | 19,587 |
#!/usr/bin/env python
import argparse
from glob import glob
from hashlib import sha256
import os
import re
import requests
import shutil
from subprocess import check_call, check_output
import sys
from urlparse import urljoin
import ruamel.yaml
sys.path.append('.')
from charmhelpers.core.host import chdir
def parse... | juju-solutions/jujubigdata | scripts/update_bdd.py | Python | apache-2.0 | 5,058 |
from pypov.pov import Texture, Pigment
from pypov.pov import Finish, Box, Cone, Object, Cylinder
from pypov.pov import Union, Difference, Intersection
from pypov.colors import Colors
from pypov.common import grey, white
from lib.base import five_by_five_corner
from lib.textures import cross_hatch, cross_hatch_2, wall_... | autowitch/pypov | scenes/geomorphs/lib/geomorphs/full_5x5_015.py | Python | mit | 2,032 |
# -*- coding: utf-8 -*-
"""
korail2
~~~~~~~
Korail (www.letskorail.com) wrapper for Python.
:copyright: (c) 2014 by Taehoon Kim.
:license: BSD, see LICENSE for more details.
"""
from .korail2 import Korail, Passenger, AdultPassenger, ChildPassenger, SeniorPassenger, TrainType, ReserveOption
from .... | styner9/korail2 | korail2/__init__.py | Python | bsd-3-clause | 617 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | DolphinDream/sverchok | nodes/svg/dimensions_svg.py | Python | gpl-3.0 | 10,600 |
"""Tests for the NonPatientObjectStorageServiceClass."""
from io import BytesIO
import logging
import os
import threading
import time
import pytest
from pydicom import dcmread
from pydicom.dataset import Dataset
from pydicom.uid import ExplicitVRLittleEndian
from pynetdicom import AE, evt, debug_logger
from pynetdi... | scaramallion/pynetdicom3 | pynetdicom/tests/test_service_non_patient.py | Python | mit | 12,222 |
# 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... | ros-infrastructure/superflore | tests/test_TempfileManager.py | Python | apache-2.0 | 1,413 |
'''
Test whitespace between field name and colon in the header
'''
# 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 yo... | duke8253/trafficserver | tests/gold_tests/headers/syntax.test.py | Python | apache-2.0 | 4,109 |
#!/usr/bin/env python
# requires python2 or python3
import argparse
import re
import sys
import os
pr = argparse.ArgumentParser("Assemble WDL file from a workflow file")
pr.add_argument("workflow", help="workflow file")
argv = pr.parse_args()
out = sys.stdout
workflow_fpath = argv.workflow
pattern = re.compile(r'^... | djhshih/wdl-canales | bin/wdl-assemble.py | Python | gpl-3.0 | 858 |
"""Boundary Events API Client for Python.
See also: https://app.boundary.com/docs/events_api
"""
# Copyright 2011-2013, Boundary 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
#
# ... | boundary/boundary-event-plugins | splunk/bin/boundary.py | Python | apache-2.0 | 6,253 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License,... | sparkslabs/kamaelia_ | Sketches/TG/soc2007/gui_final/ConnectorShardsGUI.py | Python | apache-2.0 | 5,853 |
#!/usr/bin/env python
import yaml
import json
my_list = []
for i in range (5):
my_list.append(i)
my_list.append({})
my_list[-1]['platform'] = 'arista'
my_list[-1]['ip_addr'] = '10.0.0.1'
my_list[-1]['attribs'] = range(10)
with open("yaml_file.yml", "w") as f:
f.write(yaml.dump(my_list, default_flow_style=Fals... | dyrbrm/pynet-test | class-1/write_jy.py | Python | apache-2.0 | 389 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_v2beta1_generated_answer_records_update_answer_record_sync.py | Python | apache-2.0 | 1,488 |
# vim: set fileencoding=utf-8 sw=4 ts=4 et :
# pylint: disable-msg=C0111,W0211,R0904
# Copyright (C) 2006-2020 CS GROUP - France
# License: GNU GPL v2 <http://www.gnu.org/licenses/gpl-2.0.html>
from __future__ import absolute_import, print_function
import os, unittest, shutil, socket
from xml.etree import ElementTree ... | vigilo/vigiconf | src/vigilo/vigiconf/test/test_discoverator.py | Python | gpl-2.0 | 7,722 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | shakamunyi/ansible | v2/ansible/module_utils/openstack.py | Python | gpl-3.0 | 4,502 |
import os
from conda_build import api
# god-awful hack to get data from the test recipes
import sys
_thisdir = os.path.dirname(__file__)
sys.path.append(os.path.dirname(_thisdir))
from tests.utils import metadata_dir
variant_dir = os.path.join(metadata_dir, '..', 'variants')
def time_simple_render():
api.rend... | pelson/conda-build | benchmarks/time_render.py | Python | bsd-3-clause | 749 |
"""
Server: handle multiple clients in parallel with select. use the select
module to manually multiplex among a set of sockets: main sockets which
accept new client connections, and input sockets connected to accepted
clients; select can take an optional 4th arg--0 to poll, n.m to wait n.m
seconds, or omitted to ... | simontakite/sysadmin | pythonscripts/programmingpython/Internet/Sockets/select-server.py | Python | gpl-2.0 | 2,707 |
#! ../env/bin/python
# -*- coding: utf-8 -*-
from leonardo import create_app
class TestConfig:
def test_dev_config(self):
app = create_app('leonardo.settings.DevConfig', env='dev')
assert app.config['DEBUG'] is True
assert app.config['SQLALCHEMY_DATABASE_URI'] == 'sqlite:///../database.db... | qiulin/leonardo | tests/test_config.py | Python | mit | 663 |
#
# Callback.py -- Mixin class for programmed callbacks.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import sys
import traceback
class CallbackError(Exception):
... | stscieisenhamer/ginga | ginga/misc/Callback.py | Python | bsd-3-clause | 4,864 |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python3/dist-packages/PyKDE4/kdeui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
fr... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyKDE4/kdeui/KWindowSystem.py | Python | gpl-2.0 | 5,617 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011-2016 Didotech Srl. (<http://www.didotech.com>)
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero G... | iw3hxn/LibrERP | project_extended/models/inherited_project_project.py | Python | agpl-3.0 | 24,616 |
"""Tests of disco_metanetwork"""
from unittest import TestCase
from mock import MagicMock, call, patch
from disco_aws_automation.disco_metanetwork import DiscoMetaNetwork
from disco_aws_automation.exceptions import EIPConfigError
from tests.helpers.patch_disco_aws import TEST_ENV_NAME
MOCK_ROUTE_FILTER = {"vpc-id"... | amplifylitco/asiaq | tests/unit/test_disco_metanetwork.py | Python | bsd-2-clause | 12,881 |
import unittest
from scrapy.http import Request
from scrapy.item import BaseItem
from scrapy.utils.spider import iterate_spider_output, iter_spider_classes
from scrapy.contrib.spiders import CrawlSpider
class MyBaseSpider(CrawlSpider):
pass # abstract spider
class MySpider1(MyBaseSpider):
name = 'myspider1'... | gbirke/scrapy | tests/test_utils_spider.py | Python | bsd-3-clause | 1,064 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# __init__.py
#------------------------------------------------------------------------------
import os
modelPath = os.path.normpath(os.path.dirname(__file__))
class Model(object):
def __init__(self):
... | knittledan/solr_lxml_Example | server/model/__init__.py | Python | mit | 855 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2014 The ProteinDF development team.
# see also AUTHORS and README if provided.
#
# This file is a part of the ProteinDF software package.
#
# The ProteinDF is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Publ... | ProteinDF/ProteinDF_bridge | proteindf_bridge/modeling.py | Python | gpl-3.0 | 24,765 |
# Locking debugging code -- temporary
# Copyright (C) 2003-2015 John Goerzen & contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (a... | iamprakashom/offlineimap | offlineimap/ui/debuglock.py | Python | gpl-2.0 | 1,740 |
# 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.
class MockBrowserBackend(object):
def __init__(self, package):
self.package = package
class MockBrowser(object):
def __init__(self, package):
se... | js0701/chromium-crosswalk | tools/telemetry/telemetry/internal/platform/power_monitor/pm_mock.py | Python | bsd-3-clause | 1,826 |
import unittest
import chainer
import chainermn
class BnChain(chainer.Chain):
def __init__(self, size):
super(BnChain, self).__init__()
with self.init_scope():
self.conv = chainer.links.Convolution2D(
None, size, 1, 1, 1, nobias=True)
self.bn = chainer.lin... | okuta/chainer | tests/chainermn_tests/links_tests/test_create_mnbn_model.py | Python | mit | 2,588 |
# -*- coding: utf-8 -*-
# python+selenium识别验证码
#
import re
import requests
import pytesseract
from selenium import webdriver
from PIL import Image,Image
import time
#
driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://higo.flycua.com/hp/html/login.html")
driver.implicitly_wait(30)
# 下面用户名和密码涉及到我个... | 1065865483/0python_script | test/imag_test.py | Python | mit | 3,355 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.