text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
#!/usr/bin/python -Wall
# -*- coding: utf-8 -*-
"""
<div id="content">
<div style="text-align:center;" class="print"><img src="images/print_page_logo.png" alt="projecteuler.net" style="border:none;" /></div>
<h2>Number letter counts</h2><div id="problem_info" class="info"><h3>Problem 17</h3><span>Published on Friday, 1... | beyoungwoo/C_glibc_Sample | _Algorithm/ProjectEuler_python/euler_17.py | Python | gpl-3.0 | 1,631 | 0.045984 |
import os
import numpy as np
import cv2
import json
start_index = 0
image_path = 'images/trial_3_autoencoder/'
test_path = 'test/trial_3_autoencoder/'
json_file = 'annotations/all_patient.json'
image_rows = 376
image_cols = 312
image_rows_map = 46
image_cols_map = 38
with open(json_file) as jf:
dict = json.load(... | lyuboshen/Pose-Estimation-on-Depth-Images-of-Clinical-Patients-V2.0 | src/load_data.py | Python | mit | 9,257 | 0.013179 |
def extract_cache_dicts(cache_dicts, key_list, num_out):
if cache_dicts is not None:
if len(cache_dicts) != num_out:
raise ValueError(f'Length of cache_dicts should be equal to the number of output files!')
if len(key_list) == 1:
return [c[key_list[0]] for c in cache_dicts]
return zip(*[[c[k]... | neulab/compare-mt | compare_mt/cache_utils.py | Python | bsd-3-clause | 642 | 0.018692 |
""" A series of mocks for metapipe. """
from metapipe.models import Job
class MockJob(Job):
def __init__(self, alias, command, depends_on=[]):
super(MockJob, self).__init__(alias, command, depends_on)
self._submitted = False
self._done = False
self._step = 0
def __repr__(sel... | Sonictherocketman/metapipe | test/mocks.py | Python | mit | 673 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-20 21:23
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django_api.models
class Migration(migrations.Migration):
dependencies = [
('django_api', '0018_auto_20160420_23... | IsacEkberg/crag-finder | django_api/migrations/0019_auto_20160420_2323.py | Python | gpl-3.0 | 2,068 | 0.00436 |
"""
Copyright (c) 2008, Carl J Meyer
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions ... | lanky/fabrik | fabrik/snippets/betterforms.py | Python | gpl-2.0 | 8,496 | 0.005532 |
#!/usr/bin/env python3
import dns.resolver
import dns.rdatatype
# This shouldn't be necessary, but for some reason __import__ when
# called from a coroutine, doesn't always work, and I haven't been
# able to figure out why. Possibly this is a 3.4.0 bug that's fixed
# later, but googling for it hasn't worked.
import ... | Abhayakara/minder | smtpd/smtpd.py | Python | gpl-3.0 | 27,553 | 0.013283 |
import sys
import os
import re
from subprocess import PIPE, Popen, call
fq1, fq2, db, prefix = sys.argv[1:]
bowtie2_logfh = open(prefix+'.bowtie2.log','w')
bamfile = prefix+'.bam'
bowtie2_cmd = ['bowtie2', '-x', db, '-1', fq1, '-2', fq2]
samtools_view = ['samtools', 'view', '-bhS', '-']
samtools_sort = ['samtools', 's... | luo-chengwei/utilitomics | utils/align.PE.py | Python | gpl-3.0 | 826 | 0.029056 |
import abjad
from abjad.tools import abctools
class TimespanSpecifier(abctools.AbjadValueObject):
### CLASS VARIABLES ###
__slots__ = (
'_forbid_fusing',
'_forbid_splitting',
'_minimum_duration',
)
### INITIALIZER ###
def __init__(
self,
forbid_fusin... | josiah-wolf-oberholtzer/consort | consort/tools/TimespanSpecifier.py | Python | mit | 1,111 | 0.0036 |
"""
KeepalivePlugin is a pretty cool guy. Eh reflects keep alive packets and doesnt
afraid of anything.
"""
from spockbot.plugins.base import PluginBase
class KeepalivePlugin(PluginBase):
requires = 'Net'
events = {
'PLAY<Keep Alive': 'handle_keep_alive',
}
# Keep Alive - Reflects data back ... | gamingrobot/SpockBot | spockbot/plugins/helpers/keepalive.py | Python | mit | 451 | 0 |
from distutils.core import setup, Extension
setup (name = 'krbV',
version = '1.0.90',
description = 'Kerberos V Bindings for Python',
long_description = """
python-krbV allows python programs to use Kerberos 5 authentication/security
""",
author = 'Test',
author_email = 'mikeb@redhat.com',
classifiers = [... | ivecera/gentoo-overlay | dev-python/python-krbV/files/setup.py | Python | apache-2.0 | 714 | 0.068627 |
"""Auto-generated file, do not edit by hand. RU metadata"""
from phonenumbers.phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_RU = PhoneMetadata(id='RU', country_code=7, international_prefix='810',
general_desc=PhoneNumberDesc(national_number_pattern='[347-9]\\d{9}', possible_lengt... | daviddrysdale/python-phonenumbers | python/tests/testdata/region_RU.py | Python | apache-2.0 | 630 | 0.009524 |
import sys
import re
import numpy as np
from numpy.testing import assert_almost_equal, assert_array_equal
from sklearn.datasets import load_digits
from sklearn.externals.six.moves import cStringIO as StringIO
from sklearn.neural_network import BernoulliRBM
from sklearn.utils.validation import assert_all_finite
np.se... | Eric89GXL/scikit-learn | sklearn/neural_network/tests/test_rbm.py | Python | bsd-3-clause | 4,240 | 0.000236 |
# This is a program for IP limit using picture recognition.
# URL: http://bbs.csdn.net/human_validations/new
# Input: human validations page
# Get the jpeg from the url.
# use picture recognition to get the string from the picture.
# Authentication pass!
#
# this is try to use selenuim to login
import re,os,sys
import... | zhouqilin1993/IntelliDE | crawler/ForumSpider/ForumSpider/valide/picget.py | Python | gpl-3.0 | 3,264 | 0.034007 |
from django.apps import AppConfig
class CalendarFeedConfig(AppConfig):
name = 'info_display.screens.event_schedule'
verbose_name = 'Event Schedule'
| freieslabor/info-display | info_display/screens/event_schedule/apps.py | Python | mpl-2.0 | 158 | 0 |
# 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.
"""Wrappers for gsutil, for basic interaction with Google Cloud Storage."""
import cStringIO
import hashlib
import logging
import os
import subprocess
i... | ChromiumWebApps/chromium | tools/telemetry/telemetry/page/cloud_storage.py | Python | bsd-3-clause | 6,562 | 0.012496 |
from django.db import models
#from Cliente.models import Cliente_Direccion
# Create your models here.
class Tipo_sede(models.Model):
nombre = models.CharField(max_length=50, unique=True)
def __unicode__(self):
return self.nombre
class Meta:
verbose_name = "Tipo de sede"
verbose_n... | jrmendozat/mtvm | Sede/models.py | Python | gpl-2.0 | 1,385 | 0.005776 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
import lxml
'''
A set of functions related to Data Manager and the <data_manager> node
in Opus Project Configuration files.
'''
def get_tool_nodes(projec... | apdjustino/DRCOG_Urbansim | src/opus_gui/data_manager/data_manager_functions.py | Python | agpl-3.0 | 1,946 | 0.004111 |
"""
This module implements transposition tables, which store positions
and moves to speed up the AI.
"""
import pickle
from easyAI.AI.DictTT import DictTT
class TT:
"""
A tranposition table made out of a Python dictionnary.
It can only be used on games which have a method
game.ttentry() -> string, or ... | mrfesol/easyAI | easyAI/AI/TT.py | Python | mit | 2,413 | 0.007874 |
"""
WSGI config for freedoge 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "freedoge.settings")
from dj_static i... | craigatron/freedoge | freedoge/wsgi.py | Python | mit | 426 | 0.004695 |
# @author: Zhongyuan Sun
# time: O(log(m*n)), space: O(1)
class Solution(object):
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
# Solution One: 122ms, beats 50.00%
# if not matrix or not matrix[0]... | danielsunzhongyuan/my_leetcode_in_python | search_a_2d_matrix_ii_240.py | Python | apache-2.0 | 895 | 0.001117 |
from __future__ import unicode_literals
from collections import OrderedDict
import hashlib
import os
import posixpath
import re
import json
from django.conf import settings
from django.core.cache import (caches, InvalidCacheBackendError,
cache as default_cache)
from django.core.exception... | rooshilp/CMPUT410Lab6 | virt_env/virt1/lib/python2.7/site-packages/django/contrib/staticfiles/storage.py | Python | apache-2.0 | 14,802 | 0.000608 |
__author__ = 'bruno'
import unittest
import algorithms.math.abacus as Abacus
class TestAbacus(unittest.TestCase):
def setUp(self):
pass
def test_abacus1(self):
abacus = Abacus.generate_abacus(0)
self.assertEqual(['|00000***** |',
'|00000***** |',
... | bnsantos/python-junk-code | tests/math/abacusTest.py | Python | gpl-2.0 | 5,476 | 0.000183 |
# -*- coding: utf-8 -*-
"""
:copyright: (c) 2015 by Jan-Hendrik Dolling.
:license: Apache 2.0, see LICENSE for more details.
"""
import abc
import six
import json
import logging
from six import string_types
from collections import namedtuple
from configvalidator.tools.exceptions import LoadException, ValidatorExceptio... | JanHendrikDolling/configvalidator | configvalidator/tools/basics.py | Python | apache-2.0 | 6,745 | 0.00089 |
import unittest
from coalib.results.Result import Result
from coalib.results.result_actions.ResultAction import ResultAction
from coalib.settings.Section import Section
class ResultActionTest(unittest.TestCase):
def test_api(self):
uut = ResultAction()
result = Result('', '')
self.asser... | refeed/coala | tests/results/result_actions/ResultActionTest.py | Python | agpl-3.0 | 1,388 | 0 |
#!/usr/bin/python
import os, re,sys
from remote_exe import create_thread
from subprocess import Popen, PIPE
from main import base_fun
fio_cmd = "fio --name=global --ioengine=sync --bs=4k --rw=read --filename=/dev/{0} --runtime={1} --direct=1 -numjobs=1 -iodepth=4 --name=job"
stress_time = 60
class FIO_FUN(base_fun... | trelay/multi-executor | main/main_fio.py | Python | mit | 1,282 | 0.013261 |
from bacpypes.apdu import SubscribeCOVRequest, SimpleAckPDU, RejectPDU, AbortPDU
from bacpypes.iocb import IOCB
from bacpypes.core import deferred
from bacpypes.pdu import Address
from bacpypes.object import get_object_class, get_datatype
from bacpypes.constructeddata import Array
from bacpypes.primitivedata import Tag... | ChristianTremblay/BAC0 | BAC0/core/functions/cov.py | Python | lgpl-3.0 | 5,711 | 0.001926 |
# Copyright (c) 2017 Orange. # All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | stackforge/networking-bagpipe-l2 | networking_bagpipe/objects/bgpvpn.py | Python | apache-2.0 | 15,705 | 0 |
from django.http import HttpResponse, Http404
from django.template.loader import get_template
from django.template import RequestContext
from django.core.paginator import Paginator, EmptyPage
from django.utils.translation import ugettext as _
from tagging.models import Tag
from messages.models import Message
from sett... | rtts/qqq | qqq/views.py | Python | gpl-3.0 | 3,044 | 0.012155 |
# -*- coding: utf-8 -*-
""" Get and post nagios checkresults between nago instances
This extension allows to get status data from a local nagios server.
Also pushing checkresults into a local nagios server, therefore updating nagios status.
"""
from pynag.Parsers import mk_livestatus, config
import time
import os
im... | opinkerfi/nago | nago/extensions/checkresults.py | Python | agpl-3.0 | 4,996 | 0.003203 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import common
from . import test_manual
| jeremiahyan/odoo | addons/l10n_ar/tests/__init__.py | Python | gpl-3.0 | 122 | 0 |
"""
https://open.kattis.com/problems/easiest
"""
import sys
def sum_digits(number):
sum_of_digits = 0
while number:
sum_of_digits, number = sum_of_digits + number % 10, number // 10
return sum_of_digits
for line in sys.stdin:
n = int(line)
if n == 0:
break
p = 11
while... | cstewart90/kattis-python | easiest/easiest.py | Python | mit | 428 | 0 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
VetEpiGIS-Group
A QGIS plugin
Spatial functions for vet epidemiology
-------------------
begin : 2016-05-06
git sha : $Format:%H$
... | IZSVenezie/VetEpiGIS-Group | plugin/export.py | Python | gpl-3.0 | 17,939 | 0.001672 |
from unexistent_import import * | siddhika1889/Pydev-Editor | tests/pysrc/extendable/recursion_on_non_existent/__init__.py | Python | epl-1.0 | 31 | 0.032258 |
# -- coding: utf-8 --
from resources.lib.gui.gui import cGui
from resources.lib.config import cConfig
from resources.lib import common
import urllib2
import xbmc
import xbmcgui
import string
import logger
import time
import os
import sys
class cDownload:
def __createProcessDialog(self):
oDialog = xbmcgui.... | kabooom/plugin.video.xstream | resources/lib/download.py | Python | gpl-3.0 | 4,301 | 0.006278 |
from .main import PGCli
import sql.parse
import sql.connection
import logging
_logger = logging.getLogger(__name__)
def load_ipython_extension(ipython):
"""This is called via the ipython command '%load_ext pgcli.magic'"""
# first, load the sql magic if it isn't already loaded
if not ipython.find_line_ma... | dbcli/pgcli | pgcli/magic.py | Python | bsd-3-clause | 2,270 | 0.000441 |
# Copyright (c) 2014 The Johns Hopkins University/Applied Physics Laboratory
# 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/l... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/virt/ovirt/dmcrypt.py | Python | gpl-2.0 | 2,226 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test autotest_evaluator module."""
from __future__ import print_function
import os
from chromite.cros_bisect import autotest... | endlessm/chromium-browser | third_party/chromite/cros_bisect/autotest_evaluator_unittest.py | Python | bsd-3-clause | 24,070 | 0.0027 |
record_lookupAll_genericLookup_caught = [{"emailAddress": "test@test.com", "field1": "badvalue"}]
record_lookupAll_genericLookup_uncaught = [{"emailAddress": "test@test.com", "field1": "badvalue-uncaught"}]
record_lookupAll_genericLookup_notChecked = [{"emailAddress": "test@test.com", "field2": "badvalue"}]
record_l... | rh-marketingops/dwm | dwm/test/test_records.py | Python | gpl-3.0 | 11,832 | 0.008874 |
# Copyright 2011 Nicholas Bray
#
# 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... | ncbray/pystream | bin/util/application/async.py | Python | apache-2.0 | 1,436 | 0.021588 |
import pytest
from tests.support.asserts import assert_success
"""
Tests that WebDriver can transcend site origins.
Many modern browsers impose strict cross-origin checks,
and WebDriver should be able to transcend these.
Although an implementation detail, certain browsers
also enforce process isolation based on si... | scheib/chromium | third_party/blink/web_tests/external/wpt/webdriver/tests/get_title/iframe.py | Python | bsd-3-clause | 2,183 | 0.000916 |
#
# 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... | lukecwik/incubator-beam | sdks/python/apache_beam/testing/test_stream_test.py | Python | apache-2.0 | 38,080 | 0.002784 |
# -*- coding: utf8 -*-
import subprocess
import os
from pathlib import Path
cwd = os.getcwd()
try:
print(os.getcwd())
subprocess.call(['make'])
# res = subprocess.check_output('uname -a',shell=True)
res = subprocess.check_output(
r"./darknet detector test cfg/coco.data cfg/yolo.cfg yolo.weight... | umyuu/Sample | src/Python3/Q113190/exsample.py | Python | mit | 512 | 0.007813 |
#!/usr/bin/env python
import sys, json, csv, pprint
patrons = []
with open(sys.argv[1]) as csvfile:
csvrows = csv.DictReader(csvfile)
for row in csvrows:
name = row["Name"]
pledge = float(row["Pledge $"].replace("$",""))
lifetime = float(row["Lifetime $"].replace("$",""))
stat... | OverTheWireOrg/OverTheWire-website | patreon/patreon.py | Python | mit | 745 | 0.004027 |
import numpy as np
import env
from base import BaseEstimator
from utils import RNG, print_inline, width_format, Stopwatch
from layers import FullyConnected
from activations import sigmoid
class RBM(BaseEstimator):
"""
Examples
--------
>>> X = RNG(seed=1337).rand(32, 256)
>>> rbm = RBM(n_hidden=1... | monsta-hd/ml-mnist | ml_mnist/nn/rbm.py | Python | mit | 8,597 | 0.002326 |
from myhdl import *
class VGA:
def __init__(self, color_depth=(10, 10, 10,)):
"""
color_depth the number of bits per RGB
"""
self.N = color_depth
# the sync signals
self.hsync = Signal(bool(1))
self.vsync = Signal(bool(1))
# the RGB signals to the... | cfelton/rhea | rhea/cores/video/vga/vga_intf.py | Python | mit | 1,435 | 0 |
f = open('input.txt')
triangles = [map(int,l.split()) for l in f.readlines()]
possible = 0
for t in triangles:
t.sort()
if t[0] + t[1] > t[2]:
possible += 1
print(possible)
| pwicks86/adventofcode2016 | day03/p1.py | Python | mit | 190 | 0.010526 |
from __future__ import print_function
from troposphere import (
Template, Parameter, Ref, Condition, Equals, And, Or, Not, If
)
from troposphere import ec2
parameters = {
"One": Parameter(
"One",
Type="String",
),
"Two": Parameter(
"Two",
Type="String",
),
"Thr... | wangqiang8511/troposphere | examples/EC2Conditions.py | Python | bsd-2-clause | 2,279 | 0 |
"""Root URL definitions."""
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
urlpatterns = [
url(r'^accounts/', include('accounts.urls', namespace='accounts')),
url(r'^admin/', admin.site.urls),
url(r'^'... | knyghty/bord | bord/urls.py | Python | mit | 413 | 0 |
from Spider import *
from config import *
class run():
def __init__(self):
pass
#获取所有列表
def get_list(self):
list = cfg.getType()
for l in list.keys():
print(l)
return list
#获取用户选择的分类
def input_type(self):
start = spider(url)
list = self.... | hitaian/dogSpider | runSpider.py | Python | bsd-2-clause | 1,090 | 0.013889 |
#!/usr/bin/env python
from setuptools import setup, find_packages
__doc__ = """
Falsify data
"""
version = '0.0.1'
setup(name='perjury',
version=version,
description=__doc__,
author='Aaron Merriam',
author_email='aaronmerriam@gmail.com',
keywords='content',
long_description=__doc__,
url='... | pipermerriam/perjury | setup.py | Python | bsd-2-clause | 565 | 0.021239 |
# coding: utf8
"""
1. 每个文档自己训练一个Doc2Vec
2. 所有文档一起训练一个Doc2Vec
"""
import json
from gensim.models import Doc2Vec
from gensim.models.doc2vec import TaggedDocument
from stst.modules.features import Feature
from stst import utils
from stst import config
from stst.data import dict_utils
from stst.libs.kernel import vector_... | rgtjf/Semantic-Texual-Similarity-Toolkits | stst/features/features_nn.py | Python | mit | 4,605 | 0.001533 |
"""Leetcode 796. Rotate String
Easy
URL: https://leetcode.com/problems/rotate-string/
We are given two strings, A and B.
A shift on A consists of taking string A and moving the leftmost character to
the rightmost position. For example, if A = 'abcde', then it will be 'bcdea'
after one shift on A. Return True if and ... | bowen0701/algorithms_data_structures | lc0796_rotate_string.py | Python | bsd-2-clause | 1,408 | 0.00071 |
# ==============================================================================
# Copyright [2013] [Kevin Carter]
#
# 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/l... | cloudnull/bookofnova | bookofnova/logger.py | Python | apache-2.0 | 3,372 | 0.000593 |
#!/usr/bin/env python
from iris_sdk.models.maps.base_map import BaseMap
class CitiesMap(BaseMap):
result_count = None
cities = None | scottbarstow/iris-python | iris_sdk/models/maps/cities.py | Python | mit | 142 | 0.014085 |
# =============================================================================
# COPYRIGHT 2013 Brain Corporation.
# License under MIT license (see LICENSE file)
# =============================================================================
import doctest
import logging
import os
import pytest
import robustus
from r... | braincorp/robustus | robustus/tests/test_robustus.py | Python | mit | 8,887 | 0.006414 |
"""
MySQL database backend for Django.
Requires MySQLdb: http://sourceforge.net/projects/mysql-python
"""
from __future__ import unicode_literals
import datetime
import re
import sys
import warnings
try:
import MySQLdb as Database
except ImportError as e:
from django.core.exceptions import ImproperlyConfigur... | dhoffman34/django | django/db/backends/mysql/base.py | Python | bsd-3-clause | 23,595 | 0.00267 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_foxtabs
----------------------------------
Tests for `foxtabs` module.
"""
import unittest
from foxtabs import foxtabs
class TestFoxtabs(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDown(self)... | gjost/foxtabs | tests/test_foxtabs.py | Python | bsd-3-clause | 382 | 0.005236 |
""" while case """
x = 1
while x<10:
print(x)
x = x + 1
""" while and else case """
x = 1
while x<10:
print(x)
x = x + 1
else:
print("ok")
""" while and else break case """
x = 1
while x<10:
print(x)
x = x + 1
break
else:
print("ok")
| naitoh/py2rb | tests/basic/while.py | Python | mit | 271 | 0.01107 |
# THIS FILE IS AUTO-GENERATED. DO NOT EDIT
from verta._swagger.base_type import BaseType
class ModeldbUpdateDatasetDescriptionResponse(BaseType):
def __init__(self, dataset=None):
required = {
"dataset": False,
}
self.dataset = dataset
for k, v in required.items():
if self[k] is None and... | mitdbg/modeldb | client/verta/verta/_swagger/_public/modeldb/model/ModeldbUpdateDatasetDescriptionResponse.py | Python | mit | 638 | 0.010972 |
"""Microsoft Internet Explorer cookie loading on Windows.
Copyright 2002-2003 Johnny Lee <typo_pl@hotmail.com> (MSIE Perl code)
Copyright 2002-2006 John J Lee <jjl@pobox.com> (The Python port)
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the ... | openhatch/oh-mainline | vendor/packages/mechanize/mechanize/_msiecookiejar.py | Python | agpl-3.0 | 14,694 | 0.002178 |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 ... | freeworldxbmc/pluging.video.Jurassic.World.Media | resources/lib/resolvers/clicknupload.py | Python | gpl-3.0 | 2,319 | 0.012937 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class UsedSalesOrder(Document):
pass
| aruizramon/alec_erpnext | erpnext/selling/doctype/used_sales_order/used_sales_order.py | Python | agpl-3.0 | 276 | 0.01087 |
from __future__ import unicode_literals
from django.db import models
from django.forms import ModelForm
from django.contrib.auth.models import User
from boissons.models import boissons
# Create your models here.
class consommateurs(models.Model):
def __str__(self):
return "%s" % (self.user.username)
user = models... | jadjay/GestionBoissonDj | gestionboisson/consommateurs/models.py | Python | gpl-3.0 | 1,011 | 0.023739 |
# This is modified from a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
import array
import struct
import zlib
from enum import Enum
from pkg_resources import parse_version
from kaitaistruct import __version__ as ks_version, KaitaiStruct, KaitaiStream, BytesIO
if parse_version... | sonusz/PhasorToolBox | phasortoolbox/parser/common.py | Python | mit | 9,531 | 0.002833 |
class MinStack:
def __init__(self):
"""
initialize your data structure here.
"""
from collections import deque
self.stack = deque()
self.stack.append((None, float('inf')))
def push(self, x: int) -> None:
self.stack.append((x, min(x, self.stack[-1][1])))
... | saisankargochhayat/algo_quest | leetcode/155. Min Stack/soln.py | Python | apache-2.0 | 664 | 0 |
# Copyright 2015-2017 Cisco Systems, Inc.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | meidli/yabgp | yabgp/message/attribute/mpunreachnlri.py | Python | apache-2.0 | 9,951 | 0.002311 |
import urllib, urllib2, sys, httplib
url = "/MELA/REST_WS"
HOST_IP="109.231.126.217:8180"
#HOST_IP="localhost:8180"
if __name__=='__main__':
connection = httplib.HTTPConnection(HOST_IP)
description_file = open("./costTest.xml", "r")
body_content = description_file.read()
headers={
... | tuwiendsg/MELA | MELA-Extensions/MELA-ComplexCostEvaluationService/tests/mela-clients/submitServiceDescription.py | Python | apache-2.0 | 589 | 0.050934 |
"""SANE backend.
$Id$"""
import sane
from imagescanner.backends import base
class ScannerManager(base.ScannerManager):
def _refresh(self):
self._devices = []
sane.init()
devices = sane.get_devices()
for dev in devices:
# Check if sane is able to open t... | Eveler/libs | __Python__/edv/edv/imagescanner/backends/sane/__init__.py | Python | gpl-3.0 | 1,278 | 0.008607 |
#!/usr/bin/env python -u
'''
This script does the following
1. Connect the router to the public network
2. Add a public key
3. Boot a cirros instance
4. Attach a floating IP
'''
from __future__ import print_function
import datetime
import os.path
import socket
import sys
import time
from novaclient.v1_1 import cl... | naototty/devstack-vagrant-Ironic | boot-cirros.py | Python | apache-2.0 | 2,863 | 0.002445 |
from office365.runtime.client_object import ClientObject
from office365.runtime.queries.service_operation_query import ServiceOperationQuery
from office365.runtime.paths.resource_path import ResourcePath
from office365.sharepoint.userprofiles.userProfile import UserProfile
class ProfileLoader(ClientObject):
def ... | vgrem/Office365-REST-Python-Client | office365/sharepoint/userprofiles/profileLoader.py | Python | mit | 1,190 | 0.004202 |
"Unit/Functional tests"
import os
from django.contrib.admin.options import ModelAdmin
from django.contrib.admin.sites import AdminSite
from django.test import TestCase
from django.db import models, transaction
from django.contrib.auth.models import User
from django.db.models import Q
from django.conf import settings
f... | Ernsting/django-treebeard | treebeard/tests/tests.py | Python | apache-2.0 | 71,903 | 0.000793 |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2006-2014 CEA/DEN, EDF R&D
#
# 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 2.1 of the License, or (at your option) any lat... | FedoraScientific/salome-yacs | src/salomeloader/salomeloader.py | Python | gpl-2.0 | 43,462 | 0.030578 |
#!/usr/bin/env python3
# for more info, see github.com/qguv/loadaverage
from load.loadaverage import main
| qguv/loadaverage | load/__init__.py | Python | gpl-3.0 | 107 | 0 |
from tokens.andd import And
from tokens.expression import Expression
from tokens.iff import Iff
from tokens.kfalse import ConstantFalse
from tokens.ktrue import ConstantTrue
from tokens.nop import Not
from tokens.orr import Or
from tokens.then import Then
from tokens.variable import Variable
class TokenParser:
""... | LonamiWebs/Py-Utils | logicmind/token_parser.py | Python | mit | 3,318 | 0.003617 |
from node import models
from django.forms import ModelForm
from . import cdmsportalfunc as cpf
from django.core.exceptions import ValidationError
from django import forms
class MoleculeForm(ModelForm):
class Meta:
model = models.Molecules
fields = '__all__'
class SpecieForm(ModelForm):
datea... | cpe/VAMDC-VALD | nodes/cdms/node/forms.py | Python | gpl-3.0 | 1,963 | 0 |
'''
- Leetcode problem: 675
- Difficulty: Hard
- Brief problem description:
You are asked to cut off trees in a forest for a golf event. The forest is represented as a non-negative 2D map, in this map:
0 represents the obstacle can't be reached.
1 represents the ground can be walked through.
The place with number b... | bzhou26/leetcode_sol | p675_Cut_Off_Trees_for_Golf_Event.py | Python | mit | 3,256 | 0.002764 |
"""
Tests for game_theory/random.py
"""
import numpy as np
from numpy.testing import assert_allclose, assert_raises
from nose.tools import eq_, ok_
from quantecon.game_theory import (
random_game, covariance_game, random_pure_actions, random_mixed_actions
)
def test_random_game():
nums_actions = (2, 3, 4)
... | oyamad/QuantEcon.py | quantecon/game_theory/tests/test_random.py | Python | bsd-3-clause | 2,411 | 0 |
"""
FREQUENCY FILE
-> Contains function pertaining to analyze a file based on frequency of characters or words.
"""
def call(Arguments):
"""
Entry point for all calls pertaining to frequency analysis
"""
# Storing arguments in a dictionary for easier reference
ArgumentsDictionary = {
"NAME" : Arguments[0... | Yash3667/CipherAnalysis | Analysis/Frequency.py | Python | mit | 3,272 | 0.034535 |
# Copyright (c) 2011 Rackspace
# 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... | rackerlabs/python-proboscis | proboscis/compatability/exceptions_2_5.py | Python | apache-2.0 | 1,186 | 0.000843 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import easy_thumbnails.fields
import multiselectfield.db.fields
class Migration(migrations.Migration):
dependencies = [
('main', '0035_auto_20141204_1708'),
]
operations = [
migratio... | MaximeBiset/care4care | main/migrations/0036_auto_20141204_1818.py | Python | agpl-3.0 | 1,581 | 0.001898 |
# -*- coding: cp1252 -*-
# No part of the content of this file was derived from the works of David Giffin.
##
# <p>Copyright © 2005-2008 Stephen John Machin, Lingfo Pty Ltd</p>
# <p>This module is part of the xlrd package, which is released under a BSD-style licence.</p>
#
# <p>Provides function(s) for dealing with M... | qianqians/meter | xlrd/xldate.py | Python | lgpl-2.1 | 7,895 | 0.004813 |
##############################################################################
#
# Copyright (C) 2015 Comunitea Servicios Tecnológicos All Rights Reserved
# $Omar Castiñeira Saavedra <omar@pcomunitea.com>$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | Comunitea/CMNT_004_15 | project-addons/custom_partner/__manifest__.py | Python | agpl-3.0 | 1,917 | 0.000522 |
from edc_base.model.models import BaseListModel
class InfantVaccines (BaseListModel):
class Meta:
app_label = 'mb_list'
verbose_name = "Infant Vaccines"
verbose_name_plural = "Infant Vaccines"
| botswana-harvard/microbiome | microbiome/apps/mb_list/models/infant_vaccines.py | Python | gpl-2.0 | 224 | 0 |
"""Support for Tile device trackers."""
import logging
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.components.device_tracker.const import SOURCE_TYPE_GPS
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import ATTR_ATTRIBUTION, CONF_P... | w1ll1am23/home-assistant | homeassistant/components/tile/device_tracker.py | Python | apache-2.0 | 4,346 | 0.00046 |
# Copyright 2016: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | vganapath/rally | tests/unit/plugins/common/hook/test_sys_call.py | Python | apache-2.0 | 4,165 | 0 |
__author__ = 'DownGoat'
from pyfeedreader import database
database.init_db()
| DownGoat/PyFeedReader | db_init.py | Python | gpl-3.0 | 79 | 0 |
import pytest
from munerator.context import GameContext
from mock import Mock
@pytest.fixture
def gc():
gc = GameContext(Mock(), Mock(), Mock())
return gc
def test_player_name_client_id_translation(gc):
client_id = '1'
player_name = 'testplayer'
gc.clients = {
client_id: {
'... | aequitas/munerator | tests/test_context.py | Python | mit | 566 | 0 |
# 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... | ctrlaltdel/neutrinator | vendor/keystoneauth1/tests/unit/loading/test_v3.py | Python | gpl-3.0 | 16,308 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Fri Dec 16 03:13:38 2011
import wx, wx.richtext, wx.grid, wx.lib.intctrl
import sys, os, re
# Climb the tree to find out where we are
p = os.path.abspath(__file__)
t = ""
while t != "src":
(p, t) = os.path.split(p)
if p == "":
... | VerifiableRobotics/LTLMoP | src/lib/configEditor.py | Python | gpl-3.0 | 64,636 | 0.003992 |
#!/usr/bin/env python
"""
Install.py tool to do a generic build of a library
soft linked to by many of the lib/Install.py files
used to automate the steps described in the corresponding lib/README
"""
from __future__ import print_function
import sys, os, subprocess
from argparse import ArgumentParser
sys.path.append... | akohlmey/lammps | lib/mesont/Install.py | Python | gpl-2.0 | 3,025 | 0.006942 |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from jupyter_core.paths import jupyter_data_dir
import subprocess
import os
import errno
import stat
PEM_FILE = os.path.join(jupyter_data_dir(), 'notebook.pem')
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.p... | midvalestudent/jupyter | docker/base/jupyter_notebook_config.py | Python | mit | 1,414 | 0.004243 |
from braces.views import LoginRequiredMixin
from django.views.generic import UpdateView
from oauth2_provider.exceptions import OAuthToolkitError
from oauth2_provider.http import HttpResponseUriRedirect
from oauth2_provider.models import get_application_model as get_oauth2_application_model
from oauth2_provider.settings... | DheerendraRathor/ldap-oauth2 | application/views.py | Python | gpl-3.0 | 4,953 | 0.003836 |
# sqlalchemy/pool.py
# Copyright (C) 2005-2011 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Connection pooling for DB-API connections.
Provides a number of connection poo... | jokajak/itweb | data/env/lib/python2.6/site-packages/SQLAlchemy-0.6.7-py2.6.egg/sqlalchemy/pool.py | Python | gpl-3.0 | 33,545 | 0.002832 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals, division
from sc2reader.utils import Length
from sc2reader.events.base import Event
from sc2reader.log_utils import loggable
from itertools import chain
@loggable
class GameEvent(Event):
"""
This is the base cl... | ggtracker/sc2reader | sc2reader/events/game.py | Python | mit | 25,673 | 0.002454 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from cms.models import Page
from cms.utils.i18n import get_language_list
from django.db import migrations, models
def forwards(apps, schema_editor):
BlogConfig = apps.get_model('djangocms_blog', 'BlogConfig')
BlogConfigTranslation = apps.get_mod... | skirsdeda/djangocms-blog | djangocms_blog/migrations/0014_auto_20160215_1331.py | Python | bsd-3-clause | 1,773 | 0.003384 |
from __future__ import absolute_import
from sentry.identity.vsts import VSTSIdentityProvider
from sentry.integrations.exceptions import IntegrationError
from sentry.integrations.vsts import VstsIntegration, VstsIntegrationProvider
from sentry.models import (
Integration, IntegrationExternalProject, OrganizationIn... | ifduyue/sentry | tests/sentry/integrations/vsts/test_integration.py | Python | bsd-3-clause | 12,757 | 0.000392 |
"""
Django settings for timeline project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
i... | mthpower/timeline-blog | timeline/timeline/settings.py | Python | mit | 2,922 | 0.000342 |
"""Translate cli commands to non-cli code."""
import logging
from urllib.error import HTTPError, URLError
import requests
from kytos.utils.config import KytosConfig
LOG = logging.getLogger(__name__)
class WebAPI: # pylint: disable=too-few-public-methods
"""An API for the command-line interface."""
@class... | kytos/kytos-utils | kytos/cli/commands/web/api.py | Python | mit | 986 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2014 Red Hat, 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 l... | fredericlepied/os-net-config | os_net_config/tests/test_cli.py | Python | apache-2.0 | 4,656 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.