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
#!/usr/bin/env python # encoding: utf-8 """ roman-to-integer.py Created by Shuailong on 2016-03-17. https://leetcode.com/problems/roman-to-integer/. """ class Solution(object): def __init__(self): self.d = {'I':1, 'V':5, 'X':10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} def romanToInt(self, s): ...
Shuailong/Leetcode
solutions/roman-to-integer.py
Python
mit
1,036
from setuptools import setup, find_packages setup( name="absmodels", version="0.1", packages=find_packages(), )
stavinsky/simple_cms
abs_models/setup.py
Python
mit
124
# -*- coding: utf-8 -*- from django.conf import settings from django.core.paginator import Paginator, InvalidPage from django.db import models from django.http import Http404, HttpResponseRedirect, HttpResponse from django.template.defaultfilters import force_escape from django.utils.translation import ugettext_lazy as...
avastjohn/maventy_new
search/views.py
Python
bsd-3-clause
12,853
from numpy.random import randn from numpy.linalg import cholesky as chol import numpy as np import numpy.linalg as L import scipy.special as sp import pymc.flib as flib import time import testmod import util import pdb def gen_testdata(n=100, k=4): # use static data to compare to R data = randn(n, k) mean ...
dukestats/gpustats
old/scratch.py
Python
bsd-3-clause
1,670
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import division import random, bisect class ItemGenerator(object): '''Choices randomly an element from a list. It does it not uniformly, but using a given weight for each element. Just instantiate this class passing a list of pairs ...
ActiveState/code
recipes/Python/576370_Weighted_random_choice/recipe-576370.py
Python
mit
1,256
__author__ = 'miko' from Tkinter import Frame class GameState(Frame): def __init__(self, *args, **kwargs): self.stateName = kwargs["stateName"] self.root = args[0] self.id = kwargs["id"] Frame.__init__(self, self.root.mainWindow) self.config( background="gold" ) self.place(relwidth=1, relheight=1)
FSI-HochschuleTrier/hacker-jeopardy
de/hochschuletrier/jpy/states/GameState.py
Python
mit
319
import os from pyfaidx import Faidx, Fasta from nose.tools import raises from unittest import TestCase path = os.path.dirname(__file__) os.chdir(path) class TestFeatureSplitChar(TestCase): def setUp(self): pass def tearDown(self): try: os.remove('data/genes.fasta.fai') ex...
mattions/pyfaidx
tests/test_feature_split_char.py
Python
bsd-3-clause
1,722
#!/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'], ...
nrwahl2/ansible
lib/ansible/modules/cloud/amazon/elb_target_group_facts.py
Python
gpl-3.0
9,841
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Karmind app - Automotive tool based on OBD-II protocol # Check www.karmind.com for further details # # obd_link.py # # Copyright 2010 miguel <enoelrocotiv@gmail.com> # Copyright 2010 oscar <osc.iglesias@gmail.com> # # This program i...
jukkar/karmind-obd-application
obd_link.py
Python
gpl-3.0
8,145
import sqlalchemy as _sqla from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from mc.utils import update_helper from .query_builder import QueryBuilder class Db(object): ITEM_TYPES = ['job', 'flow', 'queue'] class ItemNotFoundError(Exception): pass def __init__(self, ...
aspuru-guzik-group/mission_control
mc/db/db.py
Python
apache-2.0
13,175
"""Saranani URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-b...
AlexandroPQC/sara-ani
Saranani/Saranani/urls.py
Python
gpl-3.0
1,241
"""224. Basic Calculator https://leetcode.com/problems/basic-calculator/ Given a string s representing an expression, implement a basic calculator to evaluate it. Example 1: Input: s = "1 + 1" Output: 2 Example 2: Input: s = " 2-1 + 2 " Output: 3 Example 3: Input: s = "(1+(4+5+2)-3)+(6+8)" Output: 23 Constraint...
isudox/leetcode-solution
python-algorithm/leetcode/problem_224.py
Python
mit
2,843
import math from sqlalchemy import not_ from pprint import pprint # noqa from aleph.index import TYPE_DOCUMENT from aleph.core import es, es_index from aleph.model import Collection from aleph.search.fragments import text_query, filter_query def round(x, factor): rnd = int(math.floor(x / float(factor))) * facto...
smmbllsm/aleph
aleph/search/peek.py
Python
mit
2,568
print bin(1) print bin(2) print bin(3) print bin(4) print bin(5) print int("1",2) print int("10",2) print int("111",2) print int("0b100",2) print int(bin(5),2) print int("11001001",2)
KellyChan/python-examples
python/gists/bin.py
Python
mit
186
# coding=utf-8 from django import template import subprocess try: head = subprocess.Popen("git rev-parse --short HEAD", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) HEAD = head.stdout.readline().strip() except: HEAD = 'unknown' register = template.Library() ...
joostrijneveld/eetFestijn
orders/templatetags/git_head.py
Python
cc0-1.0
375
# encoding: utf8 # # This file is part of the a2billing-spyne project. # Copyright (c), Arskom Ltd. (arskom.com.tr), # Cemrecan Ünal <unalcmre@gmail.com>. # Burak Arslan <burak.arslan@arskom.com.tr>. # All rights reserved. # # Redistribution and use in source and binary forms, with or with...
cemrecan/a2billing-spyne
a2billing_spyne/service/extensions.py
Python
bsd-3-clause
4,821
# Copyright 2021 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. """Module for querying BigQuery.""" import collections import json import os import subprocess from flake_suppressor import results as results_module from f...
chromium/chromium
content/test/gpu/flake_suppressor/queries.py
Python
bsd-3-clause
8,625
#!/usr/bin/env python from __future__ import unicode_literals from setuptools import setup, find_packages install_requires = [ "Jinja2", "boto>=2.20.0", "flask", "httpretty>=0.6.1", "requests", "xmltodict", "six", "werkzeug", ] import sys if sys.version_info < (2, 7): # No buildin...
jotes/moto
setup.py
Python
apache-2.0
1,286
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest import numpy import pandas import dendropy import Bio.Alphabet from Bio.AlignIO import MultipleSeqAlignment from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from pandas.util.testing import ( assert_categorical_equal, assert_dict_equal, ...
jmenglund/pandas-charm
test_pandascharm.py
Python
mit
7,631
from datetime import datetime from sqlalchemy.orm import reconstructor, relationship, backref from sqlalchemy.schema import Column, ForeignKey from sqlalchemy.types import Integer, Unicode, Boolean, DateTime from sqlalchemy import BigInteger from sqlalchemy.sql.expression import false, or_ from sqlalchemy.ext.associati...
USStateDept/FPA_Core
openspending/model/dataorg.py
Python
agpl-3.0
5,452
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui_listwidget.ui' # # Created: Fri Apr 5 10:20:33 2013 # by: PyQt4 UI code generator 4.9.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except A...
mape90/VetApp
uipy/ui_listwidget.py
Python
gpl-3.0
2,028
# demo start from sanic import Sanic, Blueprint from sanic.response import text from sanic_limiter import Limiter, get_remote_address app = Sanic(__name__) limiter = Limiter(app, global_limits=['1 per hour', '10 per day'], key_func=get_remote_address) bp = Blueprint('some_bp') limiter.limit("2 per hour")(bp) @bp.ro...
bohea/sanic-limiter
test/test_demo.py
Python
mit
2,145
# 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 u...
argv0/cloudstack
plugins/hypervisors/ovm/scripts/vm/hypervisor/ovm/OvmVifModule.py
Python
apache-2.0
1,984
import webracer import re import nose.tools import nose.plugins.attrib from . import utils from .apps import form_app utils.app_runner_setup(__name__, form_app.app, 8043) @nose.plugins.attrib.attr('client') @webracer.config(host='localhost', port=8043) class FormTest(webracer.WebTestCase): def test_with_specified...
p/webracer
tests/form_test.py
Python
bsd-2-clause
10,706
#!/usr/bin/env python3 # Copyright (C) 2017 Freie Universität Berlin # # This file is subject to the terms and conditions of the GNU Lesser # General Public License v2.1. See the file LICENSE in the top level # directory for more details. import sys from testrunner import run # It takes ~11s on nucleo-l152re, so add...
cladmi/RIOT
tests/pkg_qdsa/tests/01-run.py
Python
lgpl-2.1
481
#!/usr/bin/env python # # Compute changes in on-field composition during # a 2012-13 Premier League match. # from soccermetrics.rest import SoccermetricsRestClient client = SoccermetricsRestClient() home_club = "Brazil" away_club = "Croatia" # get match information match = client.natl.information.get(home_team_name...
soccermetrics/soccermetrics-client-py
examples/nationalteams/example_pbp.py
Python
mit
1,228
from nltk import AlignedSent from stalimet.ibm2_exact import IBMModel2Exact class SentencePair(AlignedSent): @property def score(self) -> float: return self._score @score.setter def score(self, value: float): self._score = value def __init__(self, words, mots, alignment=None): ...
amalinovskiy/stalimet
stalimet/corpus.py
Python
apache-2.0
1,492
# -*- coding: utf-8 -*- from flask import Flask from flask_script import Manager, Command import sys def get_cur_info(): """Return the frame object for the caller's stack frame.""" try: raise Exception except: f = sys.exc_info()[2].tb_frame.f_back return (f.f_code.co_name, f.f_lineno) ...
fengbohello/practice
python/libs/flask_script/test_manager.py
Python
lgpl-3.0
838
category_output = { 'Ad': 9, 'Al': 14, 'Co': 8, 'Cr': 11, 'Da': 5, 'Hu': 14, 'Ra': 12, 'Ro': 6, 'Sa': 4, 'Sl': 12, 'Tr': 7, } def categories(format_json, input_json): output = [] for key in sorted(input_json['story']['categories']): if input_json['story']['c...
DanielOaks/goshu
modules/link/fimfiction_lnk.py
Python
isc
634
#!/usr/bin/python # # Copyright 2016 Red Hat | Ansible # # 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 la...
GustavoHennig/ansible
lib/ansible/modules/cloud/docker/docker_container.py
Python
gpl-3.0
76,360
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico 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 (a...
belokop/indico_bare
indico/modules/events/registration/__init__.py
Python
gpl-3.0
9,647
#!/usr/local/bin/python3 # # tinker.py # Test subroutine of the CHRUBIX project # ...for me to tinker with things :) import sys import os from chrubix import generate_distro_record_from_name, load_distro_record from chrubix.utils import fix_broken_hyperlinks, system_or_die, call_makepkg_or_die, remaining_megabytes_fr...
ReubenAbrams/Chrubix
src/tinker.py
Python
gpl-3.0
14,182
# Copyright 2010 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 law or agreed to ...
SkyLined/headsup
decode/PNG_sRGB.py
Python
apache-2.0
1,352
# This file is part of MSMTools. # # Copyright (c) 2015, 2014 Computational Molecular Biology Group, Freie Universitaet Berlin (GER) # # MSMTools 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 ...
markovmodel/msmtools
msmtools/flux/dense/__init__.py
Python
lgpl-3.0
799
# -*- coding:utf-8 -*- import tornado.ioloop as tioloop import tornado.web as tweb import xml.etree.ElementTree as et import pony.orm as orm import sys import os __dir__ = os.path.abspath(os.path.dirname(__file__)) # sys.path.append("/home/concefly/project/git/tornado_connector") # import connector # 配置数据库 db = ...
concefly/address_book
server.py
Python
mit
7,611
""" Django settings for census_site project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ......
sanitz/django-census-example
census_site/settings.py
Python
mit
2,001
import numpy as np import unittest from caffe2.python import core, workspace, test_util class TestToyRegression(test_util.TestCase): def testToyRegression(self): """Tests a toy regression end to end. The test code carries a simple toy regression in the form y = 2.0 x1 + 1.5 x2 + 0.5 ...
xzturn/caffe2
caffe2/python/toy_regression_test.py
Python
apache-2.0
2,822
from __future__ import absolute_import from sentry.testutils import AcceptanceTestCase class ApiTokensTest(AcceptanceTestCase): def setUp(self): super(ApiTokensTest, self).setUp() self.user = self.create_user('foo@example.com') self.login_as(self.user) self.path = '/api/' def...
JamesMura/sentry
tests/acceptance/test_api.py
Python
bsd-3-clause
1,565
# file xpath/ast.py # # Copyright 2010 Emory University General Library # # 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 ...
emory-libraries/eulcore-history
src/eulcore/xpath/ast.py
Python
apache-2.0
8,995
#!/usr/bin/python import sys import re import thread import urllib from time import sleep from datetime import datetime, timedelta import requests import praw from prawcore.exceptions import * import irc.bot # Begin configurable parameters identity = { # Make sure to set these if they aren't already! 'reddit_cli...
flarn2006/TPPStreamerBot
tppsb.py
Python
mit
10,064
# # Chris Lumens <clumens@redhat.com> # # Copyright 2005, 2006, 2007 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 it # ...
jikortus/pykickstart
pykickstart/commands/langsupport.py
Python
gpl-2.0
2,590
from src.platform.jboss.interfaces import JINTERFACES from src.platform.jboss.authenticate import checkAuth from src.module.deploy_utils import parse_war_path from collections import OrderedDict from os.path import abspath from log import LOG import utility title = JINTERFACES.JMX versions = ["3.2", "4.0", "4.2", "5.0...
jorik041/clusterd
src/platform/jboss/deployers/dfs_deploy.py
Python
mit
2,440
try: from django.conf.urls.defaults import patterns, url except ImportError: from django.conf.urls import patterns, url urlpatterns = patterns('libthumbor.django.views', url("^$", 'generate_url', name="generate_thumbor_url"), )
APSL/libthumbor
libthumbor/django/urls.py
Python
mit
241
# 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 may ...
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_06_01/aio/operations/_ddos_protection_plans_operations.py
Python
mit
23,738
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-11-09 05:04 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ptti', '0008_auto_20161108_2355'), ] operations = [ migrations.AlterField( ...
z3774/ptti-source
ptti/migrations/0009_auto_20161109_0004.py
Python
gpl-3.0
457
# Copyright (c) 2011 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 uuid from buildbot.changes.filter import ChangeFilter from buildbot.scheduler import Dependent from buildbot.scheduler import Nightly from buildb...
eunchong/build
scripts/master/master_config.py
Python
bsd-3-clause
7,620
#!/usr/bin/env python # query cpu topology and print all matching cpu numbers # cputop "query" ["format"] # query is a python expression, using variables: # socket, core, thread, type, cpu # or "offline" to query all offline cpus # or "atom" or "core" to select core types # type can be "atom" or "core" # cpu is the cpu...
andikleen/pmu-tools
cputop.py
Python
gpl-2.0
3,533
import time import collections from django.core.exceptions import ImproperlyConfigured from rest_framework.parsers import JSONParser from rest_framework.exceptions import ParseError, NotAuthenticated from framework.auth import signing from api.base.utils import is_bulk_request from api.base.renderers import JSONAPIRen...
adlius/osf.io
api/base/parsers.py
Python
apache-2.0
12,295
from rezgui.qt import QtCore, QtGui from rezgui.util import create_pane from rezgui.widgets.IconButton import IconButton from rezgui.widgets.TimeSelecterPopup import TimeSelecterPopup from rezgui.dialogs.BrowsePackageDialog import BrowsePackageDialog import time class TimestampWidget(QtGui.QFrame): timeChanged =...
saddingtonbaynes/rez
src/rezgui/widgets/TimestampWidget.py
Python
gpl-3.0
2,743
from django.utils import timezone from django.forms import ( ValidationError, ModelForm, CharField, HiddenInput, Form, FileField, ) from .models import ( Article, ArticleComment, ) HONEYPOT_STRING = str(347 * 347) def honeypot_ok(cleaned_data, missing_name): return ( clea...
w0rp/w0rpzone
blog/forms.py
Python
bsd-2-clause
2,339
# Copyright 2017 TWO SIGMA OPEN SOURCE, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
twosigma/beaker-notebook
beakerx/beakerx/install.py
Python
apache-2.0
8,866
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) class RubyErubis(RubyPackage): """Erubis is a fast, secure, and very extensible implementation of eRuby. """ ...
LLNL/spack
var/spack/repos/builtin/packages/ruby-erubis/package.py
Python
lgpl-2.1
659
#!/usr/bin/env python # Copyright (c) 2011 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. '''Unit test suite that collects all test cases for GRIT.''' import os import sys if __name__ == '__main__': sys.path.append(os....
paul99/clank
tools/grit/grit/test_suite_all.py
Python
bsd-3-clause
3,329
#!/usr/bin/env python # vim:fileencoding=utf-8 from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>' import re, unicodedata from itertools import chain from math import ceil from...
sharad/calibre
src/calibre/gui2/tweak_book/diff/view.py
Python
gpl-3.0
46,245
from pycp2k.inputsection import InputSection class _screening3(InputSection): def __init__(self): InputSection.__init__(self) self.Rc_taper = None self.Rc_range = None self._name = "SCREENING" self._keywords = {'Rc_range': 'RC_RANGE', 'Rc_taper': 'RC_TAPER'}
SINGROUP/pycp2k
pycp2k/classes/_screening3.py
Python
lgpl-3.0
306
import requests import json def update_position_data(position_data): with open("local_data/positions.json", "w") as positions_file: json.dump(position_data, positions_file, indent=2) def update_player_data(player_data): for player in player_data: player_response = requests.get("https://fant...
rachel-sharp/fantasy-scout
archived_scripts/load_fpl_data.py
Python
mit
1,350
from datetime import datetime import pytz from django.contrib.postgres.fields import ArrayField from django.db import models from osf.models import Node from osf.models import OSFUser from osf.models.base import BaseModel, ObjectIDMixin from osf.models.validators import validate_subscription_type from website.notifica...
mluo613/osf.io
osf/models/notifications.py
Python
apache-2.0
4,912
#!/usr/local/bin/python # -*- coding: utf-8 -*- """ """ from micropsi_core import runtime as micropsi import logging def test_set_logging_level(): assert logging.getLogger('system').getEffectiveLevel() == logging.WARNING micropsi.set_logging_levels(system='DEBUG', world='DEBUG', nodenet='DEBUG') asser...
printedheart/micropsi2
micropsi_core/tests/test_runtime.py
Python
mit
3,993
from datetime import datetime, timedelta import functools import numpy as np import pandas as pd from .options import OPTIONS from .pycompat import iteritems, unicode_type, bytes_type, dask_array_type def pretty_print(x, numchars): """Given an object `x`, call `str(x)` and format the returned string so that...
drewokane/xray
xarray/core/formatting.py
Python
apache-2.0
9,132
from __future__ import print_function import sys from . import actions from . import axioms from . import conditions from . import predicates from . import pddl_types from . import functions from . import f_expression class Task(object): def __init__(self, domain_name, task_name, requirements, t...
rock-planning/planning-fd_uniform
src/translate/pddl/tasks.py
Python
gpl-3.0
10,257
import datetime, json, logging, uuid from . import LANGUAGES, RE_CHALLENGE_ID, RE_USER_ID from .StorageHelper import StorageKeys, get_redis, wait_for_redis # ------------------------------------------------------------------- @wait_for_redis def CreateSubmission(lang, user_id, challenge_id, code, simulation=None): #...
rlods/CodingChallenge
app/helpers/SubmissionHelper.py
Python
mit
2,584
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "quickly.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
wearespindle/quickly.press
manage.py
Python
mit
276
""" Algorithmic Thinking Part 2 Project 4: Computing alignment of Sequences Author: Weikang Sun Date: 11/2/15 CodeSkulptor source: http://www.codeskulptor.org/#user40_tbt1hSyQm6_25.py """ def build_scoring_matrix(alphabet, diag_score, off_diag_score, dash_score): """ Function to build a scoring matrix given ...
wezil/algorithmic-thinking
4p-sequence-align.py
Python
mit
6,354
# coding:utf-8 from importlib import import_module from django.http import HttpResponse from . import settings as USettings import os import json from django.views.decorators.csrf import csrf_exempt import datetime import random import urllib from django.utils import six if six.PY3: long = int de...
yephper/django
django/bin/minicms/DjangoUeditor/views.py
Python
bsd-3-clause
12,693
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the...
ankur-gupta91/horizon-net-ip
openstack_dashboard/dashboards/project/access_and_security/keypairs/tests.py
Python
apache-2.0
10,966
from django import forms from .validators import IBANValidator, swift_bic_validator, IBAN_COUNTRY_CODE_LENGTH IBAN_MIN_LENGTH = min(IBAN_COUNTRY_CODE_LENGTH.values()) class IBANFormField(forms.CharField): """ An IBAN consists of up to 34 alphanumeric characters. To limit validation to specific countrie...
benkonrath/django-iban
django_iban/forms.py
Python
bsd-3-clause
2,977
import sys import socket import os import select from threading import Thread from queue import Queue from helpers import encrypt, decrypt, get_client_key, get_nonce, socket_buffer_size # Globals router = socket.socket(socket.AF_INET, socket.SOCK_STREAM) router.settimeout(5) name = "" keys = {} nonces = {} # Used as ...
wraithy/crypto-chat
client.py
Python
mit
9,242
# Code modified from the Natural Language Toolkit # Original author: Long Duong <longdt219@gmail.com> import tempfile import pickle import os import copy import operator import scipy.sparse as sparse import numpy as np from sklearn.datasets import load_svmlight_file from sklearn import svm class Configuration(object...
Alexoner/mooc
coursera/nlpintro-001/Assignment1/code/providedcode/transitionparser.py
Python
apache-2.0
12,825
from .base import * # noqa from .base import env SECRET_KEY = env("SECRET_KEY", default="only dev replace me") ALLOWED_HOSTS = ["*"] # # django session configure # SESSION_ENGINE = "django.contrib.sessions.backends.file" SESSION_FILE_PATH = env("SESSION_PATH", default="/tmp") # SESSION_COOKIE_SECURE = True # CSRF_C...
edison7500/dugong
dugong/settings/dev.py
Python
gpl-3.0
3,002
import sys import warnings from collections import defaultdict, OrderedDict from django.db.models.query import RawQuerySet from django.core.exceptions import FieldError from itertools import groupby, chain, islice from operator import itemgetter from .utils import _getattr from .validation import clean_dps, clean_pdps,...
pgollakota/django-chartit
chartit/chartdata.py
Python
bsd-2-clause
26,655
#!/usr/bin/env python3 # Sample code for doing computations with braids # # The code here emphasizes clarity over speed. We have used the memoize() # function to memoize functions that are called repeatedly with the same # arguments. Use of memoize is an indication that better algorithms exist. import hashlib impor...
mcelrath/braidcoin
braids.py
Python
gpl-3.0
30,925
import random from CommandTemplate import CommandTemplate from IrcMessage import IrcMessage class Command(CommandTemplate): triggers = ['dice', 'roll'] helptext = "Roll dice. Simple. Format is either <sides> [<rolls>], or <rolls>d<sides> like in those nerdy tabletop games" def execute(self, message): """ :ty...
Didero/DideRobot
commands/Dice.py
Python
mit
4,880
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors # See license.txt from __future__ import unicode_literals import frappe import unittest from frappe.utils import random_string, nowdate from erpnext.hr.doctype.expense_claim.expense_claim import make_bank_entry from erpnext.accounts....
manqala/erpnext
erpnext/hr/doctype/expense_claim/test_expense_claim.py
Python
gpl-3.0
7,091
import mimetypes # This module is used by PastyAppConfig.ready(). EXTRA_TYPES = { '.yaml': 'application/x-yaml', '.json': 'application/json', # App Engine: text/plain '.js': 'application/javascript', # App Engine: application/x-javascript } def add_content_types(): """Load extra content types...
davidwtbuxton/captain-pasty
pasty/content_types.py
Python
mit
426
#! python3 # ========================================== # Unity Project - A Test Framework for C # Copyright (c) 2015 Alexander Mueller / XelaRellum@web.de # [Released under MIT License. Please refer to license.txt for details] # Based on the ruby script by Mike Karlesky, Mark VanderVoord, Greg Williams # ====...
Stanford-BDML/super-scamp
vendor/unity/auto/unity_test_summary.py
Python
gpl-3.0
5,033
# https://leetcode.com/problems/consecutive-characters/ # The power of the string is the maximum length of a non-empty substring that # contains only one unique character. # Given a string s, return the power of s. import pytest class Solution: def maxPower(self, s: str) -> int: count = 1 i = 0 ...
anu-ka/coding-problems
Python/consecutive_character.py
Python
mit
812
from . import Job import mirror import logging class Publish(Job): def __init__(self, pages = None, export_ns = '', publisher = None): Job.__init__(self) self.pages = pages self.export_ns = export_ns self.publisher = publisher def summary(self): return "Publishing pages %s" % self.pages def required...
stlemme/python-dokuwiki-export
jobs/publish.py
Python
mit
1,237
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "icekit.project.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
ic-labs/django-icekit
icekit/bin/manage.py
Python
mit
258
# -*- coding: utf-8 -*- # -------------------------------------------------------------------------------------------------------------------------------------------- # Scraper para pelisalacarta, palco y otros plugin de XBMC/Kodi basado en el Api de https://www.themoviedb.org/ # version 1.3: # - Corregido erro...
dentaku65/plugin.video.sod
core/tmdb.py
Python
gpl-3.0
33,580
# Copyright 2015 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...
nanditav/15712-TensorFlow
tensorflow/python/summary/writer/writer_cache.py
Python
apache-2.0
1,878
import clientPackets import serverPackets def handle(userToken, packetData): # get token data username = userToken.username # Read packet data packetData = clientPackets.setAwayMessage(packetData) # Set token away message userToken.setAwayMessage(packetData["awayMessage"]) # Send private message from Rohwabo...
RlSEN/bannedcho
c.ppy.sh/setAwayMessageEvent.py
Python
gpl-3.0
674
from tornado.testing import gen_test from .. server import AuthServer from .. import options as _opts from anthill.common.testing import ServerTestCase class AccountsTestCase(ServerTestCase): @classmethod def need_test_db(cls): return True @classmethod def get_server_instance(cls, db=None)...
anthill-services/anthill-login
anthill/login/tests/test_accounts.py
Python
mit
1,446
from chatterbot import ChatBot from plugin_system import Plugin try: from settings import USE_CHATTER except ImportError: USE_CHATTER = False if not USE_CHATTER: plugin = Plugin('Переписка с ботом', usage=['бот [сообщение] - сообщение боту']) chatbot = ChatBot( 'Валера', ...
mrlinux777/vkbottsone
plugins/chatter.py
Python
mit
628
from api.tests.test_api import TestAPICase from api.views import OrgProfileViewSet class TestOrgsAPI(TestAPICase): def setUp(self): super(TestOrgsAPI, self).setUp() self.view = OrgProfileViewSet.as_view({ 'get': 'list', 'post': 'create' }) def test_orgs_list(se...
SEL-Columbia/formhub
api/tests/test_orgs_api.py
Python
bsd-2-clause
1,217
import pytest from machina.core.db.models import get_model from machina.core.loading import get_class from machina.test.factories import ( PostFactory, UserFactory, create_category_forum, create_forum, create_topic ) Forum = get_model('forum', 'Forum') ForumVisibilityContentTree = get_class('forum.visibility', ...
ellmetha/django-machina
tests/unit/apps/forum/test_visibility.py
Python
bsd-3-clause
8,480
# Copyright (c) 2006,2007,2008 Mitch Garnaat http://garnaat.org/ # # 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,...
harshilasu/LinkurApp
y/google-cloud-sdk/platform/gsutil/third_party/boto/boto/sdb/db/__init__.py
Python
gpl-3.0
1,108
# mapache, @cesans 2016 (c) import matplotlib.pylab as plt import matplotlib import numpy as np from sklearn import gaussian_process import time import datetime class SingleBars: def __init__(self, poll, parties, elections=None, join_coalitions=True): plt.rcParams['figure.figsize'] = (12, 6) ...
cesans/mapache
mapache/vis.py
Python
bsd-3-clause
10,110
from suma.api.schemas import LinkSchema from schematics.exceptions import ModelValidationError, ModelConversionError import pytest def test_valid_link_schema(): schema = LinkSchema({"url": "https://google.com"}) schema.validate() assert schema.url == "https://google.com" assert schema.user_id is None ...
rach/suma
tests/api/schemas/test_link_schema.py
Python
apache-2.0
1,194
import time from utils import yellow, green, blue, mangenta, red class Convert(object): vocabulary = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" def __init__(self, number, _from, to, log): self.log = log self.number = number self._from = _from self.to = to @property de...
vtemian/university_projects
arhitecure/hmw1/conversion.py
Python
apache-2.0
4,722
import where_query
galtys/galtys-addons
account_move_line_where_query/__init__.py
Python
agpl-3.0
19
# Copyright 2015 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 a...
dllatas/deepLearning
uppmax/cifar10_input.py
Python
mit
10,086
# Copyright 2016 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
jonparrott/gcloud-python
dns/noxfile.py
Python
apache-2.0
2,619
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-06-29 19:04 from __future__ import unicode_literals import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('operation_finance', '0007_auto_20170629_1840'), ] operations = [ ...
michealcarrerweb/LHVent_app
operation_finance/migrations/0008_auto_20170629_1904.py
Python
mit
519
#!/usr/bin/env python from optparse import OptionParser import socket import sys import httplib import json PASS = 0 WARNING = 1 CRITICAL = 2 def get_bongo_host(server, app): try: con = httplib.HTTPConnection(server, timeout=45) con.request("GET","/v2/apps/" + app) data = con.getresponse(...
yieldbot/sensu-yieldbot-plugins
plugins/bongo/check-eventanomaly.py
Python
mit
2,703
import heuristic_bursts.agent import heuristic_bursts.team import heuristic_bursts.options import truss.truss import truss.truss_visual import time import csv options = heuristic_bursts.options.Options() # with open('probabilistic_selection_test_500_iterations.csv', 'w') as sim_data_file: # fieldnames = ['repet...
HSDL/HeuristicBursts
tests/truss_tests/Main Truss Tests/probabilistic_selection_test_both_tiers.py
Python
mit
1,929
#!/usr/bin/env python import sys, os, shutil, glob, imp, subprocess, time, shlex import helper_func from helper_func import * #################################### # Helper functions #################################### def _generate_a2_cfgFile(spl, cfgFile): # Pad the A2 image up to 1M # HPS will fail to boot...
mfornero/buildroot
board/mathworks/socfpga/scripts/postimage_common.py
Python
gpl-2.0
4,337
import examples.kristen_support import imagepipe.traversals as uf import imagepipe.wrapped_functions as wf from imagepipe import core_functions as cf # Goal of this pipeline # 1. Detect the number of cells that were properly stained/transfected # quantification only for successfully transfected cells #...
chiffa/Image_pipe
examples/Kristen_pipeline.py
Python
bsd-3-clause
2,699
##################################### # # # Arena Boss Code # # By: Mateo Aguirre # # and Calvin Adams # # # ##################################### #Starts up the game import pygame from pygame.locals ...
eadamsatx/arena-boss
arenabossmenu.py
Python
gpl-2.0
1,307
# coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
google-research/google-research
simulation_research/signal_processing/spherical/spherical_harmonics_test.py
Python
apache-2.0
4,604
# Copyright 2018 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...
tombstone/models
official/recommendation/stat_utils.py
Python
apache-2.0
3,179