code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2015, Continuum Analytics, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#----------------------------------------... | ericdill/bokeh | bokeh/server/storage/backbone_storage.py | Python | bsd-3-clause | 3,761 |
import argparse
import datetime
import json
import os
import shutil
import tarfile
import zipfile
from urllib.request import Request, urlopen
def url_download(url, workdir):
file_path = os.path.join(workdir, 'download.dat')
if not os.path.exists(workdir):
os.makedirs(workdir)
src = None
dst = ... | mvdbeek/tools-iuc | data_managers/data_manager_fetch_ncbi_taxonomy/data_manager/data_manager.py | Python | mit | 4,462 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# 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_METADATA = {'metadata_version': '1.1',
... | Jorge-Rodriguez/ansible | lib/ansible/modules/network/f5/bigip_apm_policy_fetch.py | Python | gpl-3.0 | 15,623 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api
class CrmClaim(mo... | oihane/odoomrp-utils | crm_claim_extra_ref/model/crm_claim.py | Python | agpl-3.0 | 2,116 |
import logging
import os
import sys
from django_extensions.management.signals import post_command, pre_command
def _make_writeable(filename):
"""
Make sure that the file is writeable. Useful if our source is
read-only.
"""
import stat
if sys.platform.startswith('java'):
# On Jython t... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/django_extensions/management/utils.py | Python | agpl-3.0 | 2,188 |
# Copyright (C) 2015 by Alex Brandt <alunduil@alunduil.com>
#
# muniments is freely distributable under the terms of an MIT-style license.
# See COPYING or http://www.opensource.org/licenses/mit-license.php.
| alunduil/muniments | test_muniments/test_unit/test_scheduler/test_models/__init__.py | Python | mit | 208 |
# -*- coding:utf-8 -*-
#
#
# Copyright (C) 2011,2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# 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... | Endika/hr | hr_employee_education/__openerp__.py | Python | agpl-3.0 | 1,451 |
#!/usr/bin/python
import re
import os
import sys
import pyclbr
def find_lcmtypes():
alpha_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
valid_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_")
lcmtypes = []
regex = re.compile("_get_packed_fingerprint")
... | Morbotic/pronto-distro | externals/libbot-drc/bot2-lcm-utils/python/src/bot_log2mat/scan_for_lcmtypes.py | Python | lgpl-2.1 | 4,032 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class HowcastIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?howcast\.com/videos/(?P<id>\d+)'
_TEST = {
'url': 'http://www.howcast.com/videos/390161-How-to-Tie-a-Square-Knot-Properly',
'md5': '8b743df908... | laborautonomo/youtube-dl | youtube_dl/extractor/howcast.py | Python | unlicense | 1,474 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
compat_urllib_parse,
)
class MalemotionIE(InfoExtractor):
_VALID_URL = r'^(?:https?://)?malemotion\.com/video/(.+?)\.(?P<id>.+?)(#|$)'
_TEST = {
'url': 'http://malemotion.com/video/bien-dur.1... | MiLk/youtube-dl | youtube_dl/extractor/malemotion.py | Python | unlicense | 1,665 |
# encoding: utf-8
from __future__ import unicode_literals
from ..compat import (
compat_urllib_parse_unquote,
compat_urllib_parse_urlencode,
)
from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
ExtractorError,
)
class Porn91IE(InfoExtractor):
IE_NAME = '91por... | nandhp/youtube-dl | youtube_dl/extractor/porn91.py | Python | unlicense | 2,707 |
# Copyright 2013 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 logging
from appengine_wrappers import webapp2
from handler import Handler
from servlet import Request
class AppEngineHandler(webapp2.RequestHandle... | 7kbird/chrome | chrome/common/extensions/docs/server2/app_engine_handler.py | Python | bsd-3-clause | 1,488 |
#!/usr/bin/env python
'''
Created on Dec 6, 2013
:author: jzupka
'''
import os
import logging
import select
import cPickle
import time
import remote_interface
import cStringIO
import base64
class IOWrapper(object):
"""
Class encaptulates io opearation to be more consist in different
implementations. (... | rbian/avocado-vt | virttest/remote_commander/messenger.py | Python | gpl-2.0 | 7,889 |
#!/usr/bin/python2.4
# Copyright 2007 John Kasunich and Jeff Epler
#
# 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 lat... | ArcEye/machinekit-testing | src/hal/user_comps/vismach/scaragui.py | Python | lgpl-2.1 | 5,700 |
"""
exec_command
Implements exec_command function that is (almost) equivalent to
commands.getstatusoutput function but on NT, DOS systems the
returned status is actually correct (though, the returned status
values may be different by a factor). In addition, exec_command
takes keyword arguments for (re-)defining enviro... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/numpy/distutils/exec_command.py | Python | mit | 8,663 |
#!/usr/bin/python
# license:BSD-3-Clause
# copyright-holders:Olivier Galibert
import io
import re
import sys
# Initial state
state = 1
text = ""
dispatch_to_states = { "MAIN" : 0 }
states_to_dispatch = { 0 : "MAIN" }
def load_file(fname, lines):
path = fname.rpartition('/')[0]
if path != "":
path += '/'
try:
... | johnparker007/mame | src/devices/cpu/m6809/m6809make.py | Python | gpl-2.0 | 3,562 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.internet._sigchld}, an alternate, superior SIGCHLD
monitoring API.
"""
import os, signal, errno
from twisted.python.log import msg
from twisted.trial.unittest import TestCase
from twisted.internet.fdesc import setNonBlock... | waseem18/oh-mainline | vendor/packages/twisted/twisted/internet/test/test_sigchld.py | Python | agpl-3.0 | 6,400 |
#!/usr/bin/env python
#
# Copyright (c) 2014 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import optparse
import os
import sys
import zipfile
def main():
option_parser = optparse.OptionParser()
option_parser.add_opti... | zeropool/crosswalk | build/android/generate_xwalk_core_library_aar.py | Python | bsd-3-clause | 2,953 |
"""
Multi-part parsing for file uploads.
Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
file upload handlers for processing.
"""
import base64
import binascii
import cgi
from urllib.parse import unquote
from django.conf import settings
from django.core.exceptions import (
RequestDa... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/http/multipartparser.py | Python | mit | 24,849 |
#!/usr/bin/python
# Copyright: 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_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/amazon/ec2_asg_facts.py | Python | bsd-3-clause | 13,766 |
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://openerp.com>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | jaggu303619/asylum | openerp/addons/l10n_in_hr_payroll/report/report_payslip_details.py | Python | agpl-3.0 | 1,644 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | tsdmgz/ansible | test/units/plugins/test_plugins.py | Python | gpl-3.0 | 3,565 |
__author__ = 'Frank Sehnke, sehnke@in.tum.de'
from pybrain.rl.environments.ode import ODEEnvironment, sensors, actuators
import imp
from scipy import array
class AcrobotEnvironment(ODEEnvironment):
def __init__(self, renderer=True, realtime=True, ip="127.0.0.1", port="21590", buf='16384'):
ODEEnvironment.... | hassaanm/stock-trading | src/pybrain/rl/environments/ode/instances/acrobot.py | Python | apache-2.0 | 1,031 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005 (ita)
"Module called for configuring, compiling and installing targets"
import os, sys, shutil, traceback, datetime, inspect, errno
import Utils, Configure, Build, Logs, Options, Environment, Task
from Logs import error, warn, info
from Constants import *
... | urisimchoni/samba | third_party/waf/wafadmin/Scripting.py | Python | gpl-3.0 | 15,298 |
from __future__ import unicode_literals
from datetime import date, time, datetime
import unittest
from django.utils.dateparse import parse_date, parse_time, parse_datetime
from django.utils.timezone import get_fixed_timezone
class DateParseTests(unittest.TestCase):
def test_parse_date(self):
# Valid in... | diegoguimaraes/django | tests/utils_tests/test_dateparse.py | Python | bsd-3-clause | 2,232 |
# TODO: Commit to separate repositoruy
from django.forms import BaseForm
class BaseFormSet(object):
"""
A collection of instances of the same Form class.
"""
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
initial=None, error_class=ErrorList, form_kwargs=None... | asedunov/intellij-community | python/helpers/python-skeletons/django/forms/formsets.py | Python | apache-2.0 | 583 |
from collections import namedtuple
class C(namedtuple('C', ['foo', 'bar'])):
pass
def f(x):
return x.foo, x.bar
def g():
x = C(foo=0, bar=1)
return f(x)
print(g()) | paplorinc/intellij-community | python/testData/inspections/PyTypeCheckerInspection/NamedTupleBaseClass.py | Python | apache-2.0 | 186 |
#!/usr/bin/env python
# Copyright (c) 2013 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 multiprocessing
import optparse
import os
import posixpath
import sys
import urllib2
import buildbot_common
import build_ve... | xin3liang/platform_external_chromium_org | native_client_sdk/src/build_tools/build_projects.py | Python | bsd-3-clause | 11,275 |
"""
A Styles is a collection of PropertySets that can be applied to a particular RTF element.
At present there are only two, Text and Paragraph but ListStyles will be added soon too.
"""
from PropertySets import *
class TextStyle :
def __init__( self, text_props, name=None, shading_props=None ) :
self.... | pouyana/teireader | webui/gluon/contrib/pyrtf/Styles.py | Python | mit | 3,292 |
#!/usr/bin/env python
#
# Copyright (C) 2009 Google 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 ... | webmedic/booker | src/gdata/blogger/client.py | Python | mit | 6,686 |
"""
Encryption module that uses the Java Cryptography Extensions (JCE).
Note that in default installations of the Java Runtime Environment, the
maximum key length is limited to 128 bits due to US export
restrictions. This makes the generated keys incompatible with the ones
generated by pycryptopp, which has no such re... | estaban/pyload | module/lib/beaker/crypto/jcecrypto.py | Python | gpl-3.0 | 1,035 |
from test import support
# Skip test if _tkinter wasn't built.
support.import_module('_tkinter')
# Skip test if tk cannot be initialized.
from tkinter.test.support import check_tk_availability
check_tk_availability()
from tkinter.test import runtktests
def test_main(enable_gui=False):
if enable_gui:
if s... | BeATz-UnKNoWN/python-for-android | python3-alpha/python3-src/Lib/test/test_tk.py | Python | apache-2.0 | 651 |
#
# 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 not us... | aokolnychyi/spark | python/pyspark/shell.py | Python | apache-2.0 | 3,126 |
# 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/contrib/keras/api/keras/applications/xception/__init__.py | Python | bsd-2-clause | 1,148 |
from __future__ import absolute_import
from django.test import TestCase
from django.core.exceptions import FieldError
from .models import Poll, Choice, OuterA, Inner, OuterB
class NullQueriesTests(TestCase):
def test_none_as_null(self):
"""
Regression test for the use of None as a query value.
... | atruberg/django-custom | tests/null_queries/tests.py | Python | bsd-3-clause | 2,936 |
def function1():
pass
def function2():
pass
| siosio/intellij-community | python/testData/refactoring/move/fromImportAliases/before/src/lib.py | Python | apache-2.0 | 54 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 the BabelFish authors. All rights reserved.
# Use of this source code is governed by the 3-clause BSD license
# that can be found in the LICENSE file.
#
from __future__ import unicode_literals
import os.path
import tempfile
import zipfile
import reque... | dantebarba/docker-media-server | plex/Sub-Zero.bundle/Contents/Libraries/Shared/babelfish/data/get_files.py | Python | gpl-3.0 | 1,554 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. 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 th... | Dabug123/owlCore64 | scripts/gcc-wrapper.py | Python | gpl-2.0 | 3,609 |
# 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... | alxgu/ansible | lib/ansible/module_utils/storage/emc/emc_vnx.py | Python | gpl-3.0 | 1,915 |
from guardian.compat import url, patterns
urlpatterns = patterns('posts.views',
url(r'^$', view='post_list', name='posts_post_list'),
url(r'^(?P<slug>[-\w]+)/$', view='post_detail', name='posts_post_detail'),
)
| jasonballensky/django-guardian | example_project/posts/urls.py | Python | bsd-2-clause | 222 |
"""
Store status messages in the database.
"""
from django.db import models
from django.contrib import admin
from django.core.cache import cache
from xmodule_django.models import CourseKeyField
from config_models.models import ConfigurationModel
from config_models.admin import ConfigurationModelAdmin
class GlobalS... | ahmadiga/min_edx | common/djangoapps/status/models.py | Python | agpl-3.0 | 2,090 |
# Test calling non-special method inherited from native type
class mylist(list):
pass
l = mylist([1, 2, 3])
print(l)
print([e for e in l])
class mylist2(list):
def __iter__(self):
return iter([10, 20, 30])
l = mylist2([1, 2, 3])
print(l)
print([e for e in l])
| AriZuu/micropython | tests/basics/subclass_native_specmeth.py | Python | mit | 282 |
print("123"[0:1])
print("123"[0:2])
print("123"[:1])
print("123"[1:])
# Idiom for copying sequence
print("123"[:])
print("123"[:-1])
# Weird cases
print("123"[0:0])
print("123"[1:0])
print("123"[1:1])
print("123"[-1:-1])
print("123"[-3:])
print("123"[-3:3])
print("123"[0:])
print("123"[:0])
print("123"[:-3])
prin... | turbinenreiter/micropython | tests/basics/string_slice.py | Python | mit | 555 |
# Copyright (c) 2011 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.
"""gypd output module
This module produces gyp input as its output. Output files are given the
.gypd extension to avoid overwriting the .gyp files that they are ... | nikste/visualizationDemo | zeppelin-web/node/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py | Python | apache-2.0 | 3,325 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | diogocs1/comps | web/addons/note/note.py | Python | apache-2.0 | 8,900 |
# perf trace event handlers, generated by perf trace -g python
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# This script tests basic functionality such as flag and symbol
# strings, common_xxx() calls back into perf, begin, end, unhandled
# events, etc. Ba... | droidzone/Supernova-Kernel | tools/tools/perf/scripts/python/check-perf-trace.py | Python | gpl-2.0 | 2,501 |
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... | e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/module_utils/facts/network/dragonfly.py | Python | bsd-3-clause | 1,202 |
try:
from configparser import NoSectionError, NoOptionError
except ImportError:
from ConfigParser import NoSectionError, NoOptionError
from django import forms
from django.utils.translation import ugettext as _
def get_option(settings, section, option):
try:
return settings.get(section, option)
... | trehn/django-installer | django_installer/installer/forms.py | Python | isc | 2,440 |
import sys
sys.path.append('..')
from hermes import run_server, Chatroom
from settings import chatrooms
class BillyMaysChatroom(Chatroom):
command_patterns = ((r'.*', 'shout'),)
def shout(self, sender, body, match):
body = body.upper() #SHOUT IT
self.broadcast(body)
run_server(chatrooms, us... | mattlong/hermes | tests/test_servers.py | Python | isc | 344 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Coho documentation build configuration file, created by
# sphinx-quickstart on Sun Jun 4 22:59:13 2017.
#
# 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
# autog... | cornett/coho | doc/conf.py | Python | isc | 4,671 |
import json
import pathlib
import re
import pytest
import snafu.versions
version_paths = list(snafu.versions.VERSIONS_DIR_PATH.iterdir())
version_names = [p.stem for p in version_paths]
@pytest.mark.parametrize('path', version_paths, ids=version_names)
def test_version_definitions(path):
assert path.suffix ==... | uranusjr/snafu | tests/test_versions.py | Python | isc | 4,596 |
import threading
from buffer import DataBuffer
from seqnum import SequenceNumber
class PTCControlBlock(object):
def __init__(self, send_seq, receive_seq, send_window, receive_window):
self.snd_wnd = send_window
self.snd_nxt = send_seq.clone()
self.snd_una = send_seq.clone()
s... | lukius/ptc | ptc/cblock.py | Python | mit | 5,507 |
from domain.snake import Snake
from util.encoding import Encoder
class GenePool:
"""Represents the highest evaluated snake encodings of all time. Stores a list of 100 snakes."""
def __init__(self):
self.snakes = []
for i in range(100):
self.snakes.append(Snake(Encoder.generate_enc... | hesslink111/neuralnetworknibbles | domain/genepool.py | Python | mit | 670 |
"""
Driver for PQSC V1
Author: Michael Kerschbaum
Date: 2019/09
"""
import time
import sys
import os
import logging
import numpy as np
import pycqed
import json
import copy
import pycqed.instrument_drivers.physical_instruments.ZurichInstruments.ZI_base_instrument as zibase
log = logging.getLogger(__name__)
########... | DiCarloLab-Delft/PycQED_py3 | pycqed/instrument_drivers/physical_instruments/ZurichInstruments/ZI_PQSC.py | Python | mit | 9,278 |
## bcreader.py
## Author: Yangfeng Ji
## Date: 01-27-2015
## Time-stamp: <yangfeng 01/30/2015 22:16:26>
from cPickle import dump
import gzip
def reader(fname):
bcvocab = {}
with open(fname, 'r') as fin:
for line in fin:
items = line.strip().split('\t')
bcvocab[items[1]] = items... | jiyfeng/DPLP | resources/bcreader.py | Python | mit | 565 |
import collections
from supriya.ugens.PV_ChainUGen import PV_ChainUGen
class PV_MagSmear(PV_ChainUGen):
"""
Averages magnitudes across bins.
::
>>> pv_chain = supriya.ugens.FFT(
... source=supriya.ugens.WhiteNoise.ar(),
... )
>>> pv_mag_smear = supriya.ugens.PV_M... | Pulgama/supriya | supriya/ugens/PV_MagSmear.py | Python | mit | 585 |
import json
import requests
from celery import shared_task
from repro.monitoring.custom_metrics import custom_metric_timed_node
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
@shared_task()
@custom_metric_timed_node('Custom/incoming/twitter/2')
def incoming(tweet, *args, **kwargs):
... | Evzdrop/celery-2619-repro | celery_repro/repro/tasks/incoming.py | Python | mit | 524 |
# coding=utf-8
from django.conf.urls import patterns, url, include
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse_lazy
from django.views.generic import RedirectView
from startup.accounts.views import DetailUser, UpdateUser, CreateUser
urlpatterns = patterns(
... | mariocesar/django-startup | startup/accounts/urls.py | Python | mit | 723 |
from activedirectory import Client, Creds, activate
domain = 'freeadi.org'
creds = Creds(domain)
creds.load()
activate(creds)
client = Client(domain)
users = client.search('(objectClass=user)', scheme='gc')
for dn,attrs in users:
name = attrs['sAMAccountName'][0]
domain = client.domain_name_from_dn(dn)
p... | theatlantic/python-active-directory | tut/tutorial2.py | Python | mit | 356 |
"""
Django settings for CL_Project project.
Generated by 'django-admin startproject' using Django 1.9.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... | pmakahmann/CL_Project | CL_Project/settings.py | Python | mit | 3,282 |
import pytest
from mockito import mock
from app.hook_details.hook_details import HookDetails
pytestmark = pytest.mark.asyncio
@pytest.mark.usefixtures('unstub')
class TestHookDetails:
async def test__hook_details__is_pure_interface(self):
with pytest.raises(NotImplementedError):
f"{HookDetai... | futuresimple/triggear | tests/hook_details/test_hook_details.py | Python | mit | 911 |
def count_factor(n, factor=0):
for i in range(1, int(n**0.5)+1):
if n % i == 0:
factor += 2
return factor
def nth_triangular_number(n):
return int(n+(n*(n-1))/2)
def find_triangular_number_over(k, n=0):
while count_factor(nth_triangular_number(n)) <= k:
n += 1
return nt... | higee/project_euler | 11-20/12.py | Python | mit | 439 |
# Python - 3.6.0
find_short = lambda s: min(map(len, s.split(' ')))
| RevansChen/online-judge | Codewars/7kyu/shortest-word/Python/solution1.py | Python | mit | 69 |
import json
from google.cloud import datastore
# from google.appengine.ext.db import GqlQuery
import cloudstorage
import mypubsub
import utility
class Capitals:
def __init__(self):
self.ds = datastore.Client(project=utility.project_id())
self.kind = "newworld"
def publish_capital(self, ci... | DSankpal/wed-thurs-fri | world.py | Python | mit | 4,567 |
# -*- coding: utf-8 -*-
'''
Rupture
version 1.4.0
build 5
'''
from bs4 import BeautifulSoup
import datetime
import requests
import socket
import pickle
import time
import ssl
from .utils import six
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
cl... | shinznatkid/rupture | rupture/rupture.py | Python | mit | 6,405 |
"""
Pylearn2 wrapper for the TIMIT dataset
"""
__authors__ = ["Vincent Dumoulin"]
__copyright__ = "Copyright 2014, Universite de Montreal"
__credits__ = ["Laurent Dinh", "Vincent Dumoulin"]
__license__ = "3-clause BSD"
__maintainer__ = "Vincent Dumoulin"
__email__ = "dumouliv@iro"
import gc
import os.path
import func... | jfsantos/ift6266h14 | old/pylearn2_timit/timit.py | Python | mit | 18,158 |
# Class for a network object.
from NetworkPrimitives import Ip, Mac
from Config import config
from Exceptions import *
import Toolbox
import easysnmp
import requests
import json
import time
from datetime import datetime
import uuid
import geocoder
# Disable security warnings.
from requests.packages.urllib3.exception... | mudbungie/NetExplorer | Host.py | Python | mit | 17,053 |
import fileinput
for line in fileinput.input(inplace=True, backup='.bak'):
if fileinput.isfirstline():
do_print = False
dash_num = 0
if do_print:
print (line, end='')
if line.startswith("---"):
dash_num += 1
if dash_num == 2:
do_print = True
| casutton/casutton.github.io | _scripts/after-dash.py | Python | mit | 299 |
import os
import multiprocessing
bind = "0.0.0.0:8080"
workers = (multiprocessing.cpu_count() * 2) + 1
accesslog = "-"
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
loglevel = "debug"
capture_output = True
enable_stdio_inheritance = True
| hasura/quickstart-docker-git | python-flask/app/conf/gunicorn_config.py | Python | mit | 275 |
from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^$', views.post_list), #URL para lista de todos los post
url(r'^post/(?P<pk>[0-9]+)/$', views.post_detail), #URL para ver los detalles del post
url(r'^post/new/$', views.post_new, name='post_new'), #URL ... | chrisRubiano/djangoblog | blog/urls.py | Python | mit | 500 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import os
import tarfile
def create_tarball(dirs_to_tarball, tarball_name, save_dir,
backup_date_fmt="%Y%m%d_%H%M%S", gzip=True):
if gzip:
tar_opts = 'w:gz'
file_suffix = 'tar.gz'
else:
tar_opts = 'w:'
... | ryankanno/py-utilities | py_utilities/compression/tar_utilities.py | Python | mit | 1,077 |
"""
WSGI config for django_rest_test project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLI... | fqc/django_rest_test | django_rest_test/wsgi.py | Python | mit | 1,449 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 2017-2020 Rhilip <rhilipruan@gmail.com>
import time
from flask import Blueprint, request, jsonify, redirect
from app import cache
from .gen import Gen
getinfo_blueprint = Blueprint('infogen', __name__, url_prefix="/movieinfo")
docs_url = "https://github.co... | Rhilip/PT-help-server | modules/infogen/__init__.py | Python | mit | 1,231 |
#!/usr/bin/env python
import os
import pkg_resources
import sys
from setuptools import setup
import chainerx_build_helper
if sys.version_info[:3] == (3, 5, 0):
if not int(os.getenv('CHAINER_PYTHON_350_FORCE', '0')):
msg = """
Chainer does not work with Python 3.5.0.
We strongly recommend to use anothe... | wkentaro/chainer | setup.py | Python | mit | 6,122 |
import datetime
import release
def test_release():
rel = release.Release("mysql-3.23.22-beta", "1234-05-06")
print(vars(rel))
assert vars(rel) == {
"raw_label": "mysql-3.23.22-beta",
"raw_date": "1234-05-06",
"majormin": "3.23",
"pre": "mysql-",
"post": ".22-beta",... | johntellsall/shotglass | dec/test_release.py | Python | mit | 380 |
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---------------------------------------------... | QingChenmsft/azure-cli | src/azure-cli/setup.py | Python | mit | 3,406 |
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from selenium.common.exceptions import NoSuchElementException
from .helpers import SeleniumTestCase
class LareRequestTest(SeleniumTestCase):
def test_lare_request_depth_1(self):
self.browser_get_reverse('index')
... | lare-team/lare.js | test_app/tests/test_lare_request.py | Python | mit | 9,862 |
from __future__ import print_function
from django.test import LiveServerTestCase
from selenium import webdriver
import os
from django.contrib.auth.models import User
import factory
SCREEN_DUMP_LOCATION = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'screendumps'
)
class UserFactory(factory.djang... | joelstanner/django-imager | imager/imager/tests_selenium.py | Python | mit | 2,730 |
from nltk.corpus import stopwords
class BigUnicodePruner:
def test(self, term):
for ch in term:
if ord(ch) > 2048:
return False
return True
class EnglishStopWordsPruner:
def __init__(self):
self.stopwords = set(stopwords.words('english'))
def test(se... | west-tandon/ReSearch | research/index/pruning.py | Python | mit | 374 |
# /test/test_linter_acceptance.py
#
# Acceptance tests for polysquarelinter.linter, actually runs
# main() and checks results of various functions.
#
# Disable no-self-use in tests as all test methods must be
# instance methods and we don't necessarily have to use a matcher
# with them.
# pylint:disable=no-self-use
#
#... | polysquare/polysquare-generic-file-linter | test/test_linter_acceptance.py | Python | mit | 11,503 |
#!/home/ssm/Documents/projects/djangoProjects/october/django-jquery-file-upload/venv/bin/python3
#
# The Python Imaging Library
# $Id$
#
# PIL raster font compiler
#
# history:
# 1997-08-25 fl created
# 2002-03-10 fl use "from PIL import"
#
from __future__ import print_function
import glob
import sys
# drivers
f... | Imaginashion/cloud-vision | .fr-d0BNfn/django-jquery-file-upload/venv/bin/pilfont.py | Python | mit | 1,105 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/service_type_info.py | Python | mit | 1,980 |
from flask import Blueprint, flash, redirect, render_template, request, url_for
from sqlalchemy.orm.exc import NoResultFound
from ..sqltypes import HashableLocale as Locale
from ..work import Trope, Work
from .db import session
adv_search_bp = Blueprint('adv_search', __name__)
@adv_search_bp.route('/', methods=['P... | clicheio/cliche | cliche/web/adv_search.py | Python | mit | 2,111 |
#!/usr/bin/env python3
from gi.repository import GObject
import dbus
import dbus.service
import dbus.glib
import syslog
import random
syslog.openlog("BlueMock-DBus")
session_bus = dbus.SessionBus()
service = dbus.service.BusName("org.bluem", bus=session_bus)
def _log(text):
syslog.syslog(syslog.LOG_ALERT, text)... | highmobility/bluex | test/bluem-dbus/bluem-service.py | Python | mit | 7,508 |
#!/usr/bin/env python
"""
High amount of parallel connections.
@author: David Siroky (siroky@dasir.cz)
@license: MIT License (see LICENSE.txt or
U{http://www.opensource.org/licenses/mit-license.php})
"""
import time
import logging
import sys
import os
import threading
import multiprocessing
import random
... | dsiroky/snakemq | tests/performance/packeter_connections.py | Python | mit | 3,249 |
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .fields import HexIntegerField
from .managers import APNSDeviceManager, GCMDeviceManager
try:
instapush_settings = settings.INSTAPUSH_SETTINGS
except AttributeError:
raise ImproperlyCon... | amyth/django-instapush | instapush/models/base.py | Python | mit | 2,928 |
import time
import math
import os
import torch
import codecs
import torch.nn as nn
import torch.optim as optim
import pdb
########################################################
### MODEL
########################################################
class RNNModel(nn.Module):
"""Container module with an encoder, a r... | markriedl/easygen | lstm.py | Python | mit | 20,858 |
"""
Find the total area covered by two rectilinear rectangles in a 2D plane.
Each rectangle is defined by its bottom left corner and top right corner as
shown in the figure.
![Example layout]
(https://leetcode.com/static/images/problemset/rectangle_area.png)
Assume that the total area is never beyond the maximum pos... | ufjfeng/leetcode-jf-soln | python/223_rectangle_area.py | Python | mit | 1,071 |
# generated from catkin/cmake/template/__init__.py.in
# keep symbol table as clean as possible by deleting all unnecessary symbols
from os import path as os_path
from sys import path as sys_path
from pkgutil import extend_path
__extended_path = "/home/rss-student/rss-2014-team-3/src/robotbrain/src".split(";")
for p ... | WeirdCoder/rss-2014-team-3 | devel/lib/python2.7/dist-packages/robotbrain/__init__.py | Python | mit | 1,010 |
from rest_framework import serializers
from invoices.models import Invoice, InvoiceHistory
from common.serializer import (
UserSerializer,
OrganizationSerializer,
BillingAddressSerializer,
)
from teams.serializer import TeamsSerializer
class InvoiceSerailizer(serializers.ModelSerializer):
from_address... | MicroPyramid/Django-CRM | invoices/serializer.py | Python | mit | 3,430 |
'''
Swap counting
Status: Accepted
'''
###############################################################################
def inversions(constants, variables):
"""Number of swaps"""
if variables:
pow2 = pow(2, variables - 1, 1_000_000_007)
return pow2 * (constants * 2 + variables)
return co... | ivanlyon/exercises | kattis/k_sequences.py | Python | mit | 969 |
# coding: utf-8
# # Query `apiso:ServiceType`
# In[43]:
from owslib.csw import CatalogueServiceWeb
from owslib import fes
import numpy as np
# The GetCaps request for these services looks like this:
# http://catalog.data.gov/csw-all/csw?SERVICE=CSW&VERSION=2.0.2&REQUEST=GetCapabilities
# In[56]:
endpoint =... | rsignell-usgs/notebook | CSW/data.ioos.us-pycsw.py | Python | mit | 2,570 |
#!/usr/bin/env python
from __future__ import with_statement, division, unicode_literals
import logging
import os
import sys
import unittest
from server import app
__package__ = 'server'
DEFAULT_HOST = '0.0.0.0'
DEFAULT_PORT = 8000
def run_tests():
suite = unittest.TestLoader().discover('.'.join([__package__, ... | MatchmakerExchange/exchange-server | manage.py | Python | mit | 1,801 |
import datetime
import re
import scrapy
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
day_mapping = {'MON': 'Mo','TUE': 'Tu','WED': 'We','THU': 'Th',
'FRI': 'Fr','SAT': 'Sa','SUN': 'Su'}
def convert_24hour(time):
"""
Takes 12 hour time as a string and conver... | iandees/all-the-places | locations/spiders/petsmart.py | Python | mit | 3,626 |
# -*- encoding: utf-8 -*-
# $Id: __init__.py,v 1.8.2.10 2012/02/03 23:04:01 customdesigned Exp $
#
# This file is part of the pydns project.
# Homepage: http://pydns.sourceforge.net
#
# This code is covered by the standard Python License. See LICENSE for details.
#
# __init__.py for DNS class.
__version__ = '2.3.6'
... | hansroh/aquests | aquests/protocols/dns/pydns/__init__.py | Python | mit | 2,174 |
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
pin = 17
first = 1
gap = 1
second = 1
def play(nra):
# D Letter
firstCount = 5
secondCount = nra
pin = 17
first = 1
gap = 1
second = 1
firstSleepTimeOn = 0.02
firstSleepTimeOff = 0.04
secondSleepTimeOn = 0.02
secondSleepTimeOff = 0.04
gapSleepT... | larssima/AmiJukeBoxRemote | AmiJukeBoxRemote/gui/RaspberryPi/playjbd.py | Python | mit | 869 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from builtins import object
from ctypes import *
import time
from .IC_GrabberDLL import IC_GrabberDLL
from .IC_Exception import IC_Exception
from .IC_Property import IC_Property
from . import IC_Struct... | joshbrake/py-ic-imaging-control | pyicic/IC_Camera.py | Python | mit | 18,666 |
class Solution(object):
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
if not grid or not grid[0]:
return 0
m = len(grid)
n = len(grid[0])
dp = []
for _ in range(m):
dp.append([None] * (n))
... | daicang/Leetcode-solutions | 064-minimum-path-sum.py | Python | mit | 877 |
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.ptime import time
import pyqtgraph as pg
__all__ = ['ValueLabel']
class ValueLabel(QtGui.QLabel):
"""
QLabel specifically for displaying numerical values.
Extends QLabel adding some extra functionality:
- displaying units with si prefix
... | robertsj/poropy | pyqtgraph/widgets/ValueLabel.py | Python | mit | 2,623 |
"""TestCase and TestSuite artifacts and testing decorators."""
import itertools
import operator
import re
import sys
import types
import warnings
from cStringIO import StringIO
from sqlalchemy.test import config, assertsql, util as testutil
from sqlalchemy.util import function_named, py3k
from engines import drop_all... | obeattie/sqlalchemy | lib/sqlalchemy/test/testing.py | Python | mit | 27,201 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.