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 |
|---|---|---|---|---|---|
# ############################################################################
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business i... | uclouvain/OSIS-Louvain | education_group/tests/views/training/test_create.py | Python | agpl-3.0 | 5,481 |
from mini_battleship.board import Point
__author__ = 'yosefderay'
class ConsoleInput(object):
@staticmethod
def get_point():
guess_row = int(raw_input("Guess Row:")) - 1
guess_col = int(raw_input("Guess Column:")) - 1
point = Point(guess_row, guess_col)
point.point_type = Po... | reuvenderay/PythonProjects | mini_battleship/input.py | Python | mit | 351 |
from utilities.compression import SoSCompression
class SparqlDecompress:
"""Performs SPARQL sos-decompression"""
name = "SparqlCompress"
description = "Performs SPARQL sos-decompression"
@staticmethod
def execute(token):
message = token.message
body = message.get_body()
d... | onnovalkering/sparql-over-sms | sos-service/src/processing/filters/sparqldecompress.py | Python | mit | 635 |
# -*- coding: utf-8 -*-
class Solution(object):
"""
下排每个数都是先前上排那十个数在下排出现的次数。
上排的十个数如下:
【0,1,2,3,4,5,6,7,8,9】
举一个例子,
数值: 0,1,2,3,4,5,6,7,8,9
分配: 6,2,1,0,0,0,1,0,0,0
"""
# 求两个列表的乘积和
def list_sum(self,a, b):
size = len(a)
c = [a[i] * b[i] for i in range(0, size)]
... | zymtech/leetcode | algorithmhomework/interview/1.py | Python | gpl-3.0 | 1,485 |
#
# The Python Imaging Library
# $Id$
#
# WMF stub codec
#
# history:
# 1996-12-14 fl Created
# 2004-02-22 fl Turned into a stub driver
# 2004-02-23 fl Added EMF support
#
# Copyright (c) Secret Labs AB 1997-2004. All rights reserved.
# Copyright (c) Fredrik Lundh 1996.
#
# See the README file for information on... | Amechi101/concepteur-market-app | venv/lib/python2.7/site-packages/PIL/WmfImagePlugin.py | Python | mit | 4,093 |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 10 00:15:50 2017
@author: sakurai
"""
import collections
import numpy as np
from sklearn.preprocessing import LabelEncoder
from fuel.streams import DataStream
from fuel.schemes import IterationScheme, BatchSizeScheme, SequentialScheme
from .cars196_dataset import Cars19... | ronekko/deep_metric_learning | lib/datasets/data_provider.py | Python | mit | 6,900 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# modelo.py
#
# Copyright 2010 Jesús Hómez <jesus@jesus-laptop>
#
# 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; ei... | jehomez/pymeadmin | modelo2.py | Python | gpl-2.0 | 89,398 |
__author__ = 'Dmitriy Korsakov'
__doc__ = 'Manage global variables for farm roles'
from scalrctl import commands
class UpdateFarmRoleGlobalVariable(commands.Action):
prompt_for = ["roleId", "globalVariableName"]
class DeleteFarmRoleGlobalVariable(commands.Action):
delete_target = 'globalVariableName' | Scalr/scalr-ctl | scalrctl/commands/farm_role_gv.py | Python | apache-2.0 | 314 |
__author__ = 'carsten'
import sys
seqlibfile = open(sys.argv[1],'r')
proteinlistfile = open(sys.argv[2],'r')
ps_scanlistfile = open(sys.argv[3],'w')
seqlib = {}
for line in seqlibfile:
seqlib[line.split(':')[0]] = line.split(':')[1]
seqlibfile.close()
for line in proteinlistfile:
id = line.rstrip()
if ... | carstenuhlig/gobi | python/get_fasta_seq.py | Python | gpl-2.0 | 448 |
# coding=utf-8
"""
The majority of of the spatial effect are caused by uneven temperature gradients across assay plates due to inefficient
incubation conditions. To predict the amount of evaporation in each well in a time and space dependent manner, and its
effect on the resulting data set, a diffusion-state model was ... | ArnaudKOPP/TransCellAssay | TransCellAssay/Stat/Normalization/DiffusionModel.py | Python | gpl-3.0 | 10,079 |
"""
Provides an APIView class that is the base of all views in REST framework.
"""
from __future__ import unicode_literals
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.utils.datastructures import SortedDict
from django.views.decorators.csrf import csrf_exempt
... | hfercc/mese2014 | lib/rest_framework/views.py | Python | apache-2.0 | 15,793 |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... | vbannai/neutron | neutron/plugins/linuxbridge/lb_neutron_plugin.py | Python | apache-2.0 | 24,540 |
# -*- coding: utf-8 -*-
WS_NFE_ENVIO_LOTE = 0
WS_NFE_CONSULTA_RECIBO = 1
WS_NFE_CANCELAMENTO = 2
WS_NFE_INUTILIZACAO = 3
WS_NFE_CONSULTA = 4
WS_NFE_SITUACAO = 5
WS_NFE_CONSULTA_CADASTRO = 6
WS_DPEC_RECEPCAO = 7
WS_DPEC_CONSULTA = 8
WS_NFE_EVENTO= 9
WS_NFE_CONSULTA_DESTINATARIO = 10
WS_NFE_DOWNLOAD_XML_DESTINATARIO =... | annacarol/Recursos-NFE-em-Python | nfe/pysped/nfe/webservices_flags.py | Python | lgpl-2.1 | 1,353 |
# -*- test-case-name: mamba.test.test_response -*-
# Copyright (c) 2012 Oscar Campos <oscar.campos@member.fsf.org>
# See LICENSE for more details
"""
.. module:: response
:platform: Unix, Windows
:synopsys: Custom Response object for Mamba
.. moduleauthor:: Oscar Campos <oscar.campos@member.fsf.org>
"""
fro... | Kelfast/mamba-framework | mamba/web/response.py | Python | gpl-3.0 | 8,008 |
try:
from urllib.request import Request, urlopen
except ImportError:
from urllib2 import Request, urlopen
import json
import sys
from collections import namedtuple
{4}_score = namedtuple('{4}_score', [{5}])
def get_{4}_score({0}):
data = {{
'Id': 'score00001',
'Inst... | jkorell/PTVS | Python/Product/ML/ML/service_code.py | Python | apache-2.0 | 941 |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2021-05-20 17:03
import logging
from typing import Union, List
import torch
from torch.utils.data import DataLoader
from hanlp.common.structure import History
from hanlp.layers.transformers.pt_imports import AutoConfig_, AutoTokenizer_
from transformers import AutoModelFo... | hankcs/HanLP | hanlp/components/sts/transformer_sts.py | Python | apache-2.0 | 11,294 |
from datetime import datetime
from decimal import Decimal
from django.http import HttpResponse
from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils import timezone
from livesettings import config_get_group, config_value
from satchmo_store.shop.models import Order, OrderItem, OrderPayment
... | jordotech/sherri_satchmo | satchmo/apps/payment/views/cron.py | Python | bsd-3-clause | 5,485 |
#!/usr/bin/python
# Copyright 2015 Tomas Popela <tpopela@redhat.com>
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, cop... | spotrh/chromium-rpm | get_free_ffmpeg_source_files.py | Python | mit | 2,895 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Custom filters for use in openshift-master
'''
import copy
import sys
from ansible import errors
from ansible.parsing.yaml.dumper import AnsibleDumper
from ansible.plugins.filter.core import to_bool as ansible_bool
# ansible.compat.six goes away with Ansible 2.4
try:
... | detiber/openshift-ansible | roles/openshift_master_facts/filter_plugins/openshift_master.py | Python | apache-2.0 | 22,339 |
# models.py
from dateutil.parser import parse
from django.db import models
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.fields import GenericForeignKey
import json
from te... | alirizakeles/tendenci | tendenci/apps/versions/models.py | Python | gpl-3.0 | 2,293 |
import pytest
import libforget.brotli
BEE_SCRIPT = bytes("According to all known laws of aviation,", 'UTF-8')
TIMEOUT_TARGET = 0.2
@pytest.fixture
def app():
from flask import Flask
app_ = Flask(__name__)
app_.config['REDIS_URI'] = 'redis://localhost:6379'
app_.debug = True
@app_.route('/')
... | codl/forget | test/test_libbrotli.py | Python | isc | 3,064 |
def multipleOfThree(number):
if number % 3 == 0:
return True
else:
return False
def multipleOfFive(number):
if number % 5 == 0:
return True
else:
return False
#I know I can make this more clear by breaking hte "sum" functionality out of this method, but I'm not sure how to store the sum...
def multipleFin... | vabacumov/ProjectEuler | oleg_problem1.py | Python | mit | 510 |
# coding: utf-8
# This example was based on:
# https://github.com/compjour/search-script-scrape/blob/master/scripts/42.py
from io import BytesIO
from urlparse import urljoin
import requests
import rows
from rows.plugins.html import tag_to_dict
url = 'http://www.supremecourt.gov/opinions/slipopinions.aspx'
html = ... | kretcheu/rows | examples/slip_opinions.py | Python | gpl-3.0 | 548 |
'''
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 use this ... | ivalo/robotframework-pycurllibrary | test/testenv.py | Python | apache-2.0 | 1,056 |
#!/usr/bin/env python
#coding=utf8
# Common section
import re
import argparse
import sys
import logging
import os
def get_args_parser():
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument("-i", "--infile",
default=sys.stdin,
nargs='?',
type=argparse.FileType('r'),
help="Input file. Defaults... | techborder/wp | wp-content/plugins/contact-form-7-config/convert-wpcf7-to-email.py | Python | gpl-2.0 | 5,570 |
# encoding: utf-8
from django.db import models
from django.utils.translation import ugettext_lazy as _
from wagtail.contrib.settings.models import BaseSetting, register_setting
@register_setting
class TemplateSettings(BaseSetting):
base_template = models.CharField(
max_length=127,
verbose_name=_... | tracon/dragontail | dragontail/content/models/templatesettings.py | Python | mit | 1,237 |
import re
import numpy as np
import pytest
from pandas import (
DataFrame,
MultiIndex,
options,
)
import pandas._testing as tm
from pandas.io.excel import (
ExcelWriter,
_XlwtWriter,
)
xlwt = pytest.importorskip("xlwt")
pytestmark = pytest.mark.parametrize("ext,", [".xls"])
def test_excel_rai... | rs2/pandas | pandas/tests/io/excel/test_xlwt.py | Python | bsd-3-clause | 4,032 |
__author__ = 'Bohdan Mushkevych'
import json
from synergy.db.model.freerun_process_entry import FreerunProcessEntry
from synergy.db.dao.freerun_process_dao import FreerunProcessDao
from synergy.mx.base_request_handler import valid_action_request
from synergy.mx.abstract_action_handler import AbstractActionHandler
fro... | mushkevych/scheduler | synergy/mx/freerun_action_handler.py | Python | bsd-3-clause | 4,312 |
#!/usr/bin/env python
'''
BibTex parser.
'''
import sys
import string
import cStringIO
import json
import unicodedata
import re
class BibTexParser(object):
def __init__(self, fileobj):
data = fileobj.read()
# On some sample data files, the character encoding detection simply hangs
... | flowsta/bibserver | parserscrapers_plugins/bibtex.py | Python | mit | 97,628 |
# Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and... | youtube/cobalt | third_party/blink/Tools/Scripts/webkitpy/style/main_unittest.py | Python | bsd-3-clause | 3,440 |
#
# Copyright 2013 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 law or agreed to in writi... | pkilambi/ceilometer | ceilometer/tests/alarm/evaluator/test_threshold.py | Python | apache-2.0 | 27,889 |
# from: http://cairographics.org/freetypepython/
import ctypes
import cairo
class FreeTypeLibInitializationFailed(Exception):
pass
class PycairoContext(ctypes.Structure):
_fields_ = [("PyObject_HEAD", ctypes.c_byte * object.__basicsize__),
("ctx", ctypes.c_void_p), ("base", ctypes.c_void_p)... | cajone/pychess | lib/pychess/System/cairoextras.py | Python | gpl-3.0 | 2,930 |
# -*- coding:utf-8 -*-
# Copyright (c) 2010-2012 OpenStack Foundation
#
# 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 ... | swiftstack/swift | test/unit/common/test_memcached.py | Python | apache-2.0 | 38,729 |
# -*- coding: utf-8 -*-
'''
@author:黄鑫晨
@createtime:2016-10-01
@introduction:话题的一系列函数
'''
import time
import random
from sqlalchemy import func, desc
from mod.databases.tables import Topic, Tpraise, Tcomment, TopicAdmin, Users
#global db,
from mod.huati.getUserInfo import User_info_handler
global top, random_lis... | HeraldStudio/HeraldAppApi | mod/huati/TopicFuncs.py | Python | mpl-2.0 | 15,135 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-03 20:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('address', '__first__'),
]
operations = [
migrations.Crea... | TraMZzz/travelize | travelize/diller/migrations/0001_initial.py | Python | mit | 826 |
from localflavor.cz import tests as localflavor_cz_tests
from localflavor.se import tests as localflavor_se_tests
from localflavor.ar import ARLocalFlavorTests
from localflavor.at import ATLocalFlavorTests
from localflavor.au import AULocalFlavorTests
from localflavor.at import ATLocalFlavorTests
from localflavor.br i... | 350dotorg/Django | tests/regressiontests/forms/localflavortests.py | Python | bsd-3-clause | 1,531 |
import os
import re
files = ('README.rst', 'CONTRIBUTING.rst')
# replace GitHub external links by :doc: links
replacements = (('`([^`]*?) <(docs/)?(.*?)\.rst>`_', ':doc:`\g<1> <\g<3>>`'),)
def read(fname: str) -> str:
return open(os.path.join(os.path.dirname(__file__), fname), encoding='utf-8').read()
for ... | nferch/acd_cli | docs/hoist.py | Python | gpl-2.0 | 473 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from typing import Optional, List
import torch
import torch.nn as nn
from torch import Tensor
class Search(nn.Module):
def ... | hfp/libxsmm | samples/deeplearning/sparse_training/fairseq/fairseq/search.py | Python | bsd-3-clause | 12,720 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015 Matthias Klumpp <mak@debian.org>
#
# 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.0 of the License, or (at your option) any la... | limba-project/limba-hub | setup.py | Python | gpl-3.0 | 1,020 |
# coding=utf-8
while(True):
respuesta= raw_input("hemos perdido o hemos gaado")
litrosPerdidos = int(raw_input("cuantos litros hemos perdido"))
litrosGanados = int(raw_input("cuantos litros hemos ganado"))
| JorgeGarciaIrazabal/WhereAppUBE | Azahara.py | Python | mit | 222 |
# -*- coding: utf-8 -*-
# © 2016 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests import common
class TestL10nEsToponyms(common.TransactionCase):
def setUp(self):
super(TestL10nEsToponyms, self).setUp()
self.wi... | RamonGuiuGou/l10n-spain | l10n_es_toponyms/tests/test_l10n_es_toponyms.py | Python | agpl-3.0 | 1,152 |
from abrtcli import config
from abrtcli.i18n import _
from abrtcli.match import match_lookup
from abrtcli.utils import format_problems
from . import Command
class List(Command):
aliases = ['ls']
name = 'list'
description = 'list problems'
def __init__(self, *args, **kwargs):
super().__init__(... | martinky82/abrt | src/cli/abrtcli/cli/list.py | Python | gpl-2.0 | 1,205 |
# Copyright (c) 2012 OpenStack Foundation.
#
# 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... | mahak/neutron | neutron/tests/unit/extensions/test_portsecurity.py | Python | apache-2.0 | 26,311 |
# 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.
import json
import xmlrpclib
import requests
from bkr.inttest import d... | jtoppins/beaker | IntegrationTests/src/bkr/inttest/server/requests_utils.py | Python | gpl-2.0 | 1,825 |
# coding=utf-8
import platform
import unittest
from mock import Mock
from conans import ConanFile, Settings
from conans.client.generators.virtualenv import VirtualEnvGenerator
from conans.model.env_info import EnvValues
class VirtualEnvGeneratorTest(unittest.TestCase):
""" Verify VirtualEnvGenerator functions,... | conan-io/conan | conans/test/unittests/client/generators/virtualenv_test.py | Python | mit | 2,888 |
#!/usr/bin/env python
"""
Demo for lx.py.
Download population of countries.
"""
import re
from jabbapylib.web.scraper import lx
from jabbapylib.web.web import get_page
def process(doc):
data = {}
for row in doc.cssselect('tr'):
cols = row.cssselect('td')
if cols:
rank = col... | jabbalaci/jabbapylib | demos/lx_population.py | Python | gpl-3.0 | 850 |
import importlib
import unittest
import os
from flask.ext.script.commands import Command, Option
import sys
import xmlrunner
from shuttl import app
from shuttl.Models.Reseller import Reseller
from shuttl.tests import *
## TestSuite for running test modules from command line
# \param Command The command that is input... | shuttl-io/shuttl | shuttl/Commands/TestSuite.py | Python | mit | 2,165 |
# Зверюшка со свойствами
# Демонстрирует свойства
class Critter(object) :
def __init__(self, name):
print("Появилась на свет новая зверюшка!")
self._name = name
@property
def name(self):
return self._name
@name.setter
def name(self, new_name):
if new_name == " ":... | mr0p0hard/python_study | Enimal1.py | Python | gpl-3.0 | 1,460 |
# -*- coding: utf-8 -*-
#
# Copyright © 2008 Ricky Zhou
# Copyright © 2008 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that... | ampotty/fas | plugins/fas-plugin-show/fas_show/help.py | Python | gpl-2.0 | 2,308 |
# -*- coding: utf-8 -*-
# PyMeeus: Python module implementing astronomical algorithms.
# Copyright (C) 2018 Dagoberto Salazar
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either v... | architest/pymeeus | tests/test_moon.py | Python | lgpl-3.0 | 10,986 |
# -c
print "BEGIN-LOG"
import pymol
import cmd
# need to do this for all supported file types because the load routines diverge...
def x(st):
print st
cmd.set("raise_exceptions",0)
valu = eval(st)
print valu
if cmd.is_error(valu):
cmd.set("raise_exceptions",1)
try:
print eval(st)... | gratefulfrog/lib | python/pymol/pymol_path/test/inp/C2000returns.py | Python | gpl-2.0 | 12,632 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0006_auto_20150615_1421'),
]
operations = [
migrations.AlterField(
model_name='invitation',
... | nonZero/OpenCommunity | src/users/migrations/0007_auto_20150615_1535.py | Python | bsd-3-clause | 571 |
# Copyright 2016 Google 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 by applicable law or ... | sduskis/cloud-bigtable-examples | python/nox.py | Python | apache-2.0 | 1,449 |
from Event import Event
from Startup import *
from Connected import *
from Disconnected import *
from PrintStarted import *
from PrintFailed import *
from PrintDone import *
from PrintCancelled import *
from Paused import *
from Home import *
| thomaskneisel/LightRider | bin/LightRider/OctoPrint/events/__init__.py | Python | mit | 244 |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | pmisik/buildbot | master/buildbot/test/unit/schedulers/test_timed_Periodic.py | Python | gpl-2.0 | 9,748 |
import ecore
print ecore.NsURI
print ecore.__dict__
a = ecore.createEClass()
print a
a.set_name("hola")
name = a.get_name()
print name
a.set_name("adios")
print a.get_name()
# print ecore.package
# print ecore.package.get_name()
# print ecore.package.get_nsURI()
# print ecore.package.get_nsPrefix()
# print ecor... | wurfkeks/emf4cpp | emf4cpp.tests/PyEcore/tests/test1.py | Python | lgpl-3.0 | 332 |
"""contentbox_add.py
Supports adding to the contentbox"""
import httplib2
from errors import *
class ContentboxAddCommand(object):
h = httplib2.Http()
def __init__(self, store_uri=None, data=None, type="application/x-unknown"):
self.store_uri = (store_uri is not None and store_uri.endswith("/")) and store_uri[:-1] ... | iand/pynappl | old/contentbox_add.py | Python | gpl-2.0 | 936 |
from django.core import validators
from django.core.exceptions import ValidationError
from django.core.urlresolvers import resolve
from cobra.core.loading import get_model
from django.http import Http404
from django.utils.translation import ugettext_lazy as _
class ExtendedURLValidator(validators.URLValidator):
... | lyoniionly/django-cobra | src/cobra/core/validators.py | Python | apache-2.0 | 4,618 |
import datetime
import os
import sys
import time
from progressbar import ProgressBar
from selenium.common.exceptions import (
ElementNotVisibleException,
NoSuchElementException,
ElementNotInteractableException,
TimeoutException,
WebDriverException,
)
from RatS.utils import file_impex
TIMESTAMP = ... | StegSchreck/RatS | RatS/base/base_ratings_inserter.py | Python | agpl-3.0 | 6,430 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish... | rwl/PyCIM | CIM14/CDPSM/Balanced/IEC61970/Wires/Switch.py | Python | mit | 2,127 |
#!/usr/bin/python # lint-amnesty, pylint: disable=django-not-configured, missing-module-docstring
from .loncapa_check import * # lint-amnesty, pylint: disable=redefined-builtin
| stvstnfrd/edx-platform | common/lib/sandbox-packages/loncapa/__init__.py | Python | agpl-3.0 | 180 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2013 Star2Billing S.L.
#
# The Initia... | hardikk/newfies-dialer | newfies/user_profile/management.py | Python | mpl-2.0 | 2,688 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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
#... | shsingh/ansible | lib/ansible/modules/cloud/ovirt/_ovirt_cluster_facts.py | Python | gpl-3.0 | 4,458 |
# coding=utf-8
# Copyright 2018 Google LLC & Hwalsuk Lee.
#
# 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 ... | ifding/ifding.github.io | gans/modular_gan_test.py | Python | mit | 6,402 |
#coding:utf8
import urllib2
from sgmllib import SGMLParser
class SingerInfoParser(SGMLParser):
''' 抓取歌手索引页面(http://music.baidu.com/artist),解析出歌手名称和歌手详情页相对链接地址。
歌手索引页面的HTML格式如下:
<h3>
<a name="B"></a>
</h3>
<ul class="clearfix"> ... | aofeng/PythonDemo | src/cn/aofeng/demo/http/BaiduSingerInfo.py | Python | apache-2.0 | 3,797 |
'''
Test the 408 response 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 you under the Apache License, V... | duke8253/trafficserver | tests/gold_tests/headers/http408.test.py | Python | apache-2.0 | 2,162 |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... | wasit7/book_pae | book/django/project/project/settings.py | Python | mit | 3,378 |
"""Evaluate SegNet.
nohup python -u -m self_driving.segnet.evaluate > self_driving/segnet/output.txt 2>&1 &
"""
import os
import tensorflow as tf
from utils import camvid
from scipy import misc
LOG_DIR = 'save'
BATCH_SIZE = 4
EPOCH = 25
IMAGE_HEIGHT = 720
IMAGE_WIDTH = 960
IMAGE_CHANNEL = 3
NUM_CLASSES = 32
test_d... | mengli/MachineLearning | self_driving/segnet/evaluate.py | Python | apache-2.0 | 4,191 |
# /tests/word_game_search_test.py
#
# Test cases for artificialintelligence.uninformed_word_game_search
#
# See LICENCE.md for Copyright information
"""Test cases for usage of polysquarecmakelinter.main()."""
from artificialintelligence.uninformed_word_game_search import (breadth_first_search,
... | smspillaz/artificial-intelligence | tests/word_game_search_test.py | Python | mit | 2,147 |
__author__ = 'belinkov'
import sys
import os
import codecs
import re
from data_utils import DIACS, REGEX_DIACS
REGEX_SOLUTION_DIAC = re.compile(r'\((.+?)\)') # for gold diacritized word
class WordAnalysis(object):
"""
A simplified pos analysis from treebank pos/before-treebank files.
Attributes:
... | boknilev/diacritization | extract_data.py | Python | mit | 7,629 |
"""
@author: Thomas PERROT
Contains settings for sets app
"""
from django.apps import AppConfig
class SetsConfig(AppConfig):
name = 'sets'
verbose_name = "Sets"
| thomasperrot/MTGTrader | mtg/sets/apps.py | Python | mit | 174 |
def setup_database(config):
from models import db
if isinstance(config.DB_DATA, str):
db.bind(config.DB_PROVIDER, config.DB_DATA)
else:
db.bind(config.DB_PROVIDER, **config.DB_DATA)
from views import home, expenses
from config import load_config
from flask import Flask
config = load_co... | contasdoape/wowbagger | src/application.py | Python | agpl-3.0 | 685 |
"""
Acceptance tests for Studio.
"""
from bok_choy.web_app_test import WebAppTest
from ..edxapp_pages.studio.asset_index import AssetIndexPage
from ..edxapp_pages.studio.auto_auth import AutoAuthPage
from ..edxapp_pages.studio.checklists import ChecklistsPage
from ..edxapp_pages.studio.course_import import ImportPage
... | pelikanchik/edx-platform | common/test/acceptance/tests/test_studio.py | Python | agpl-3.0 | 4,147 |
from netpyne import specs
from cfg import cfg
#------------------------------------------------------------------------------
#
# NETWORK PARAMETERS
#
#------------------------------------------------------------------------------
netParams = specs.NetParams() # object of class NetParams to store the network parame... | Neurosim-lab/netpyne | examples/rxd_net/netParams.py | Python | mit | 6,584 |
import warnings
from datapackage_pipelines.wrapper import ingest
from datapackage_pipelines.utilities.flow_utils import spew_flow
from datapackage_pipelines.lib.dump_to_sql import flow
if __name__ == '__main__':
warnings.warn(
'dump.to_sql will be removed in the future, use "dump_to_sql" instead',
... | frictionlessdata/datapackage-pipelines | datapackage_pipelines/lib/dump/to_sql.py | Python | mit | 419 |
# 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... | laosiaudi/tensorflow | tensorflow/contrib/layers/python/layers/target_column_test.py | Python | apache-2.0 | 7,057 |
# 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... | chenjun0210/tensorflow | tensorflow/contrib/image/python/ops/image_ops.py | Python | apache-2.0 | 8,665 |
import os
import shutil
import tempfile
from ConfigParser import ConfigParser, NoOptionError
from ..base import GP_VCS_EXTEND_DEVELOP
from ..base import GP_DEVELOP_DIR
from ..testing import RecipeTestCase
class TestExtraction(RecipeTestCase):
test_dir = os.path.dirname(__file__)
def setUp(self):
sup... | anybox/anybox.recipe.odoo | anybox/recipe/odoo/tests/test_extract.py | Python | agpl-3.0 | 8,221 |
# encoding: utf-8
import logging
__version__ = VERSION = '0.1.0'
__project__ = PROJECT = 'html-cleaner'
log = logging.getLogger( __name__ )
| ProstoKSI/html-cleaner | html_cleaner/__init__.py | Python | mit | 143 |
from builtins import object
import numpy as np
from sporco.admm import ccmodmd
class TestSet01(object):
def setup_method(self, method):
np.random.seed(12345)
def test_01(self):
N = 16
M = 4
Nd = 8
X = np.random.randn(N, N, 1, 1, M)
S = np.random.randn(N, N... | bwohlberg/sporco | tests/admm/test_ccmodmd.py | Python | bsd-3-clause | 12,774 |
import bpy
import bmesh
import itertools
from mathutils import Vector
class MeshData:
__slots__ = ("vertices", "edges", "polygons")
def __init__(self, vertices, edges, polygons):
self.vertices = vertices
self.edges = edges
self.polygons = polygons
def __repr__(self):
retur... | Thortoise/Super-Snake | Blender/animation_nodes-master/data_structures/mesh.py | Python | gpl-3.0 | 4,998 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CS224N 2016-17: Homework 3
util.py: General utility routines
Arun Chaganty <chaganty@stanford.edu>
"""
from __future__ import division
import sys
import time
import logging
from io import StringIO
from collections import defaultdict, Counter, OrderedDict
import numpy... | AppleFairy/CS224n-Natural-Language-Processing-with-Deep-Learning | assignment/assignment3/util.py | Python | mit | 18,466 |
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 sw=4 ts=4 et :
# Copyright (C) 2017-2020 CS GROUP - France
# License: GNU GPL v2 <http://www.gnu.org/licenses/gpl-2.0.html>
from __future__ import unicode_literals, print_function
import sys
import inspect
from copy import deepcopy
from lxml import etree
from vigi... | vigilo/vigiconf | src/vigilo/vigiconf/migrate_tests_5_0_0.py | Python | gpl-2.0 | 3,055 |
import random
import time
import threading
from threading import Thread,Semaphore
globvar = 1
INT_MAX = 1000000000
N=16
DEG=16
P=2
u=0
W = [[0 for x in range(DEG)] for x in range(N)]
W_index = [[0 for x in range(DEG)] for x in range(N)]
D = [0 for x in range(N)]
Q = [0 for x in range(N)]
threads = []
class Barrier... | masabahmad/Path-Planning-Python | dijk_inner.py | Python | mit | 2,605 |
import directories
from albow.controls import RotatableImage, Label
import pygame
from albow.widget import Widget
from albow.layout import Column, Row
from albow.fields import TimeField, IntField
class ModifiedTimeField(TimeField):
_callback = None
def __init__(self, callback=None, **kwds):
s... | Khroki/MCEdit-Unified | editortools/timeditor.py | Python | isc | 5,657 |
import pytest
from aoc2019.day22 import shuffle
SAMPLE_INSTRUCTIONS = [
"""deal with increment 7
deal into new stack
deal into new stack""",
"""cut 6
deal with increment 7
deal into new stack""",
"""deal with increment 7
deal with increment 9
cut -2""",
"""deal into new stack
... | bertptrs/adventofcode | 2019/tests/test_day22.py | Python | mit | 944 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from models import Visit, Subscription, Plan, Payment
from forms import EmptyPermittedFormSet
class PlanAdmin(admin.ModelAdmin):
list_display = ('name', 'price')
class AdministrantedModelAdmin(admin.ModelAdmin):
def save_model(self, request, obj, f... | clincher/phuketstash | visits/admin.py | Python | bsd-3-clause | 1,917 |
#!/usr/bin/env python
from tempfile import mkstemp
from shutil import move
from os import remove, close
from os import system
def replace(file_path, pattern, subst,count):
#Create temp file
fh, abs_path = mkstemp()
new_file = open(abs_path,'w')
old_file = open(file_path)
print(old_file)
for line... | shennjia/home | .script/myE.py | Python | unlicense | 1,308 |
# init: Time: O(n), Space: O(n)
# get: Time: O(1), Space: O(1)
# check: Time: O(1), Space: O(1)
# release: Time: O(1), Space: O(1)
class PhoneDirectory(object):
def __init__(self, maxNumbers):
"""
Initialize your data structure here
@param maxNumbers - The maximum numbers that... | kamyu104/LeetCode | Python/design-phone-directory.py | Python | mit | 1,688 |
import unittest, os
from commontest import *
from rdiff_backup import Globals, SetConnections, log, rpath, backup, fs_abilities
"""Regression tests
This one must be run in the rdiff-backup directory, as it requres
chdir-wrapper, the various rdiff-backup files, and the directory
testfiles
"""
Globals.set('change_sou... | makinacorpus/rdiff-backup | testing/regressiontest.py | Python | gpl-2.0 | 14,010 |
from unittest import TestCase
import hark.exceptions
import hark.networking
class TestNetwork(TestCase):
def test_network(self):
nw = hark.networking.Network()
assert nw.get_host_address() == '192.168.168.1'
assert nw.get_free_address() == '192.168.168.2'
exclude = ['192.168.1... | hark-project/hark | src/tests/test_networking.py | Python | gpl-3.0 | 675 |
"""Module for testing long and long raw variables."""
import sys
class TestLongVar(BaseTestCase):
def __PerformTest(self, a_Type, a_InputType):
self.cursor.execute("truncate table Test%ss" % a_Type)
longString = ""
for i in range(1, 11):
char = chr(ord('A') + i - 1)
... | Bluehorn/cx_Oracle | test/LongVar.py | Python | bsd-3-clause | 4,064 |
def getArguments(argv):
if len(sys.argv) != 2:
print 'Please pass training file'
sys.exit()
return str(sys.argv[1])
def train(sc,matrix, featureSize, labels):
matrix=matrix.T
RDD1=sc.parallelize(matrix) #set up the graMatrix on the spark
normalized_data=RDD1.map(normalized) #normalized the original matr... | motian12ps/Bigdata_proj_yanif | Src/Spark.py | Python | mit | 1,372 |
#!/usr/bin/env python
#
# Copyright 2014 Facebook
#
# 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 a... | ifduyue/tornado | tornado/test/tcpclient_test.py | Python | apache-2.0 | 16,547 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLayoutManager.
.. note:: 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.
"""
... | dwadler/QGIS | tests/src/python/test_qgslayoutmanager.py | Python | gpl-2.0 | 10,609 |
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'qualapp@cart.ucsd.edu'
EMAIL_HOST_PASSWORD = ''
| Micaiah-Chang/qualApp | eMail.py | Python | mit | 137 |
import pytest
from stellar_sdk.client.aiohttp_client import AiohttpClient
from stellar_sdk.exceptions import ValueError
from stellar_sdk.sep.exceptions import (
BadFederationResponseError,
FederationServerNotFoundError,
InvalidFederationAddress,
)
from stellar_sdk.sep.federation import (
FederationReco... | StellarCN/py-stellar-base | tests/sep/test_federation.py | Python | apache-2.0 | 4,823 |
# Author: Robert Massa <robertmassa@gmail.com>
# URL: http://code.google.com/p/sickbeard/
#
# This file is based upon tvtorrents.py.
#
# This file is part of Sick Beard.
#
# Sick Beard is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fr... | imajes/Sick-Beard | sickbeard/providers/torrentleech.py | Python | gpl-3.0 | 2,908 |
from django.apps import AppConfig
class ProfilesConfig(AppConfig):
name = 'profiles'
| sheagcraig/sal | profiles/apps.py | Python | apache-2.0 | 93 |
# Copyright: Damien Elmes <anki@ichi2.net>
# -*- coding: utf-8 -*-
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from aqt.qt import *
from http import HTTPStatus
import http.server
import errno
class MediaServer(QThread):
def run(self):
self.port = 10000
self.serv... | Stvad/anki | aqt/mediasrv.py | Python | agpl-3.0 | 2,373 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.