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
"""MegaStates: A 'MegaState' is a state which absorbs and implements multiple AnalyzerState-s in a manner that is beneficial in terms of code size, computational speed, or both. All MegaState-s shall be derived from class MegaState, and thus are committed to the described interface. The final product of...
coderjames/pascal
quex-0.63.1/quex/engine/analyzer/mega_state/core.py
Python
bsd-2-clause
26,146
from email.mime.text import MIMEText from email.utils import formatdate import smtplib from flask import Blueprint, request, render_template, redirect, url_for, abort, current_app, flash, g from flask.ext.babel import _ from werkzeug.exceptions import ServiceUnavailable from sqlalchemy import func from sqlalchemy.orm...
TobiasLohner/SkyLines
skylines/frontend/views/users.py
Python
agpl-3.0
4,343
from __future__ import absolute_import, unicode_literals ###################### # MEZZANINE SETTINGS # ###################### # The following settings are already defined with default values in # the ``defaults.py`` module within each of Mezzanine's apps, but are # common enough to be put here, commented out, for con...
simodalla/mezzanine_mailchimper
project_template/settings.py
Python
bsd-3-clause
14,784
# Copyright (c) 2016 Cyso < development [at] cyso . com > # # This file is part of omniconf, a.k.a. python-omniconf . # # 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 3....
cyso/omniconf
omniconf/tests/backends/test_json.py
Python
lgpl-3.0
2,458
# Copyright (c) 2018, Frappe Technologies and contributors # For license information, please see license.txt # don't remove this function it is used in tests def test_method(): '''test function''' return 'overridden'
mhbu50/erpnext
erpnext/regional/france/utils.py
Python
gpl-3.0
222
import os import sys import argparse from django.conf import settings class QuickDjangoTest(object): """ A quick way to run the Django test suite without a fully-configured project. Example usage: >>> QuickDjangoTest('app1', 'app2') Based on a script published by Lukasz Dziedzia at: ...
Anaethelion/django-mapentity
quicktest.py
Python
bsd-3-clause
3,994
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import errno import os import shutil import sys import tempfile import time from datetime import datetime, timedelta from io import BytesIO try: import threading except ImportError: import dummy_threading as threading from djang...
chrisfranzen/django
tests/regressiontests/file_storage/tests.py
Python
bsd-3-clause
23,517
from amqplib import client_0_8 as amqp queue_name = "Game1" queue_exchange = "Game1" queue_rooting_key = "Game1" consumer_tag = "Game1" # connect to server lConnection = amqp.Connection(host="localhost:5672", userid="guest", password="guest", virtual_host="/", insist=False) lChannel = lConnection.channel() lChanne...
Vallher/siemienskathon
staff/quetest.py
Python
apache-2.0
874
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-04-23 19:51 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('zerver', '0075_attachment_path_id_unique'), ] operations = [ migrations.AddField( model_name='userprofi...
amanharitsh123/zulip
zerver/migrations/0076_userprofile_emojiset.py
Python
apache-2.0
567
import sys import platform import twisted import scrapy from scrapy.command import ScrapyCommand class Command(ScrapyCommand): def syntax(self): return "[-v]" def short_desc(self): return "Print Scrapy version" def add_options(self, parser): ScrapyCommand.add_options(self, pars...
openhatch/oh-mainline
vendor/packages/scrapy/scrapy/commands/version.py
Python
agpl-3.0
850
#!/usr/bin/env python2 from os import path import sys import wordcloud d = path.dirname(__file__) # Read the whole text. text = open(path.join(d, 'alice.txt')).read() # Separate into a list of (word, frequency). words = wordcloud.process_text(text, max_features=2000) # Compute the position of the words. elements = w...
0x0all/word_cloud
examples/more.py
Python
mit
504
from nba_ss_db import CONFIG CONFIG['DB_NAME'] = 'test_db' CONFIG['DB_PATH'] = 'tests/test_db/databases' from nba_ss_db import db def init_test_db(): db.utils.drop_tables() db.initialize.init_db() db.utils.execute_sql("""CREATE TABLE IF NOT EXISTS player_ids (PLAYER_ID text...
jsonchin/nba_stats_scraper_db_storage
tests/test_setup.py
Python
apache-2.0
358
def checkio(land): result = 0 rocks = unmatched(land) if len(rocks) == 0: return len(land) * len(land[0]) for i in range(len(land)): for j in range(len(land[i])): temp = count(land, i, j, rocks, len(land), len(land[i])) if temp > result: result = ...
edwardzhu/checkio-solution
CheckIO/Scientific Expedition/landingStrip.py
Python
mit
1,747
# Copyright 2014 Netflix, 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...
JaguarSecurity/SMG
env-config/config-local.py
Python
apache-2.0
1,982
# Basic OBJ file viewer. needs objloader from: # http://www.pygame.org/wiki/OBJFileLoader # LMB + move: rotate # RMB + move: pan # Scroll wheel: zoom in/out import sys, pygame from pygame.locals import * from pygame.constants import * from OpenGL.GL import * from OpenGL.GLU import * # IMPORT OBJECT LOADER from objloa...
jennifersalas/3D_CA
objefileviewer.py
Python
agpl-3.0
2,135
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. import pytest from shuup.notify.base import Event from shuup_test...
shoopio/shoop
shuup_tests/notify/test_event.py
Python
agpl-3.0
852
#!/usr/bin/env python import argparse import os import shutil import string import subprocess import sys import tempfile BUFFSIZE = 1048576 # Translation table for reverse Complement, with ambiguity codes. DNA_COMPLEMENT = string.maketrans("ACGTRYKMBDHVacgtrykmbdhv", "TGCAYRMKVHDBtgcayrmkvhdb") def reverse(sequence)...
ASaiM/tools-iuc
tools/meme/fimo_wrapper.py
Python
mit
6,150
# 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...
alexgorban/models
research/slim/datasets/dataset_utils.py
Python
apache-2.0
7,141
import os import pickle import shutil import time from datetime import datetime from os.path import exists, join, relpath from threading import Thread from typing import List, Union, Optional, Dict, Tuple import numpy as np import tensorflow as tf from tensorflow.python.training.adadelta import AdadeltaOptimizer from ...
allenai/document-qa
docqa/trainer.py
Python
apache-2.0
27,581
# corpus.views # Views for the corpus application # # Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> # Created: Sun Jul 17 19:33:46 2016 -0400 # # Copyright (C) 2016 District Data Labs # For license information, see LICENSE.txt # # ID: views.py [2de4867] benjamin@bengfort.com $ """ Views for the corpus ...
DistrictDataLabs/partisan-discourse
corpus/views.py
Python
apache-2.0
4,376
""" helloworld.py Author: E Dennison Credit: I figured this out on my own Assignment: Write and submit a Python program that prints the following: Hello, world! """ print("Hello, world!")
tiggerntatie/Hello-world
helloworld.py
Python
mit
192
# vim: set et ts=4 sw=4 sts=4 ai: from distutils.core import setup import dispass.dispass long_desc = '''DisPass is a passphrase generator for GNU/Linux, \*BSD, MacOS X and Windows. It enables you to generate unique passphrases formed from a master password and a label, helping you get rid of the bad habit of using a...
ryuslash/DisPass
setup.py
Python
isc
1,721
""" flcliapi - Freelance Pattern agent class Model 3: uses ROUTER socket to address specific services Author: Min RK <benjaminrk@gmail.com> """ import threading import time import zmq from zhelpers import zpipe # If no server replies within this time, abandon request GLOBAL_TIMEOUT = 3000 # msecs # PING interva...
soscpd/bee
root/tests/zguide/examples/Python/flcliapi.py
Python
mit
6,939
import tensorflow as tf import numpy as np class rec(object): def __init__(self, sentence_length,num_classes, vocab_size, embedding_size, filter_sizes,num_filters): # Placeholders for input, output, and dropout self.input_x = tf.placeholder(tf.int32, [None, paragraph_length], name = "input_x") self.input_y = t...
xXDavidHuangXx/reccomendation
main/rec.py
Python
apache-2.0
1,031
import collections import unittest from typing import List import utils class Solution: def minJumps(self, arr: List[int]) -> int: n = len(arr) d = collections.defaultdict(list) for i, num in enumerate(arr): d[num].append(i) q = collections.deque() q.append((0...
chrisxue815/leetcode_python
problems/test_1345.py
Python
unlicense
1,144
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """ ...
jvrsantacruz/XlsxWriter
xlsxwriter/test/comparison/test_chart_format19.py
Python
bsd-2-clause
1,761
# -*- coding: utf-8 -*- """ Created on Tue Feb 14 14:49:00 2017 @author: camacho """ import Kernel;reload(Kernel);kl=Kernel import Kernel_likelihood;reload(Kernel_likelihood);lk=Kernel_likelihood import Kernel_optimization;reload(Kernel_optimization);opt=Kernel_optimization import RV_function;reload(RV_function);RVf...
jdavidrcamacho/Tests_GP
02 - Programs being tested/05 - opt initial tests/Tests1_Kernel_opt.py
Python
mit
8,509
from . import EVE_BASE_URL from . xml import EveXml from . general import skilltree import urllib from urllib2 import urlopen import lxml EVE_ACCOUNT = EVE_BASE_URL + 'account/Characters.xml.aspx' EVE_CHARSHEET = EVE_BASE_URL + 'char/CharacterSheet.xml.aspx' EVE_INDUSTRY = EVE_BASE_URL + 'char/IndustryJobs.xml.aspx' EV...
pkovac/evedustrial
eve/character.py
Python
mit
3,543
# coding=utf-8 import os import tempfile import traceback import pytest import h2 from mitmproxy import options from mitmproxy.proxy.config import ProxyConfig import mitmproxy.net from ....mitmproxy.net import tservers as net_tservers from mitmproxy import exceptions from mitmproxy.net.http import http1, http2 fro...
xaxa89/mitmproxy
test/mitmproxy/proxy/protocol/test_http2.py
Python
mit
30,081
"""The tests for the Demo vacuum platform.""" import unittest from homeassistant.components import vacuum from homeassistant.components.vacuum import ( ATTR_BATTERY_LEVEL, ATTR_BATTERY_ICON, ATTR_STATUS, ATTR_FAN_SPEED, mqtt) from homeassistant.components.mqtt import CONF_COMMAND_TOPIC from homeassistant.const...
ewandor/home-assistant
tests/components/vacuum/test_mqtt.py
Python
apache-2.0
8,296
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0014_verbose_name_for_group'), ] operations = [ migrations.AddField( model_name='person', nam...
efornal/mollys
app/migrations/0015_add_field_person_ldap_user_password.py
Python
gpl-3.0
466
#!/usr/bin/env python import os import mako from mako.lookup import TemplateLookup from circuits.web import Server, Controller, Static DEFAULTS = {} templates = TemplateLookup( directories=[os.path.join(os.path.dirname(__file__), "tpl")], module_directory="/tmp", output_encoding="utf-8" ) def render(...
eriol/circuits
examples/web/makotemplates.py
Python
mit
852
# Status: ported, except for tests and --abbreviate-paths. # Base revision: 64070 # # Copyright 2001, 2002, 2003 Dave Abrahams # Copyright 2006 Rene Rivera # Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0....
flingone/frameworks_base_cmds_remoted
libs/boost/tools/build/src/build/property.py
Python
apache-2.0
19,263
import time import json import requests from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from bs4 import BeautifulSoup as BS from pymongo import MongoClient client = MongoClient() db = client.temp5 ## database that we are using r=...
arjun-krishna/WhenBus
server/data/MTCData/Data_Scrapping/MasterBusInfoScrapper.py
Python
mit
3,141
# 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 # d...
openstack/manila
manila/policies/share_server.py
Python
apache-2.0
9,783
from __future__ import unicode_literals from netmiko.base_connection import BaseConnection class CheckPointGaiaSSH(BaseConnection): """ Implements methods for communicating with Check Point Gaia firewalls. """ def session_preparation(self): """ Prepare the session after the connect...
michaelrosejr/pyaos6
netmiko/checkpoint/checkpoint_gaia_ssh.py
Python
mit
774
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
AutorestCI/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2016_09_01/models/virtual_network_gateway_sku.py
Python
mit
1,754
# MajorMajor - Collaborative Document Editing Library # Copyright (C) 2013 Ritchie Wilson # # 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)...
ritchiewilson/majormajor
tests/document/test_document_helpers.py
Python
gpl-3.0
5,647
# Copyright (c) 2014 Greg James, Visual6502.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, modify, merge, p...
ericmjonas/Sim2600
sim2600/nmosFet.py
Python
cc0-1.0
1,841
#!/usr/bin/python # -*- coding: utf-8 -*- # Distributed under the terms of the CC-BY-SA 3.0 . # Reza (User:Reza1615) Code structure + Developing the code import re,codecs,os,wikipedia,query bot_address=u'/home/reza/compat/' faSite = wikipedia.getSite('fa') #---------------- SimilarPersianCharacters=ur'\u0643\...
PersianWikipedia/Database-reports
zzcleaning_redirects.py
Python
mit
8,870
# # 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/internal/http_client_test.py
Python
apache-2.0
4,661
import os import requests # pip install requests # The authentication key (API Key). # Get your own by registering at https://app.pdf.co API_KEY = "******************************************" # Base URL for PDF.co Web API requests BASE_URL = "https://api.pdf.co/v1" # Source PDF file SourceFile = ".\\sample.pdf" # C...
bytescout/ByteScout-SDK-SourceCode
PDF.co Web API/PDF Search Tables/Python/PDF Table Search from Uploaded File/PdfTableSearchFromUploadedFile.py
Python
apache-2.0
2,752
# Copyright (c) 2018 PaddlePaddle 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 app...
QiJune/Paddle
python/paddle/trainer_config_helpers/tests/configs/projections.py
Python
apache-2.0
2,317
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime from django.utils.timezone import utc class Migration(migrations.Migration): dependencies = [ ('billing', '0004_auto_20150204_2042'), ] operations = [ migrations.AddF...
pombredanne/srvup-rest-framework
src/billing/migrations/0005_auto_20150206_2201.py
Python
apache-2.0
1,311
""" Descriptive HTTP status codes, for code readability. See RFC 2616 - http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html And RFC 6585 - http://tools.ietf.org/html/rfc6585 """ from __future__ import unicode_literals def is_informational(code): return code >= 100 and code <= 199 def is_success(code): r...
Max201/cleave
cleave/http/status.py
Python
apache-2.0
3,504
# -*- coding: utf-8 -*- from __future__ import unicode_literals import logging import django from django.core import signals from django.core.cache.backends.base import BaseCache logging.basicConfig() logger = logging.getLogger(__name__) def get_cache(backend, **kwargs): from django.core import cache as dj_cach...
Kub-AT/django-cache-fallback
cache_fallback/cache.py
Python
mit
2,454
#Calculating with dictionaries prices = { 'ACME': 45.23, 'AAPL': 612.78, 'IBM': 205.55, 'HPQ': 37.20, 'FB': 10.75 } print(zip(prices.keys(),prices.values())) for elem in zip(prices.keys(),prices.values()): print(elem) min_price = min(zip(prices.values(),prices.keys())) print("Min Price: ",min_price)...
ishank296/python-cookbook
Chapter_1/calculating_with_dict.py
Python
gpl-3.0
929
# Copyright 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 in...
scrapinghub/keystone
keystone/trust/backends/kvs.py
Python
apache-2.0
4,003
#! /usr/bin/env python # Copyright (C) 2014 Mikael Arguedas # # 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...
LCAS/spqrel_tools
ros_ws/src/naoqi_bridge/naoqi_tools/scripts/run_blender_script.py
Python
mit
5,418
import torch import torch.nn.functional as F from .abstract_metrics import AverageMetric from ..registry import register_metric class Accuracy(AverageMetric): """ Computes the accuracy over predictions Args: None Returns: An accuracy metric that can maintain its own internal state. ...
abhmul/PyJet
pyjet/metrics/accuracy_metrics.py
Python
mit
3,831
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2013, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This progra...
akhilaananthram/nupic.research
sequence_prediction/mackey_glass/swarm/permutations.py
Python
gpl-3.0
3,797
#!/usr/bin/env python3 # 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...
cloudnull/os-ansible-deployment
doc/source/conf.py
Python
apache-2.0
12,114
# Copyright 2017-present Adtran, 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 writ...
opencord/voltha
voltha/extensions/alarms/onu/onu_active_alarm.py
Python
apache-2.0
2,273
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings from opaque_keys.edx.django.models import CourseKeyField class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MO...
CredoReference/edx-platform
common/djangoapps/credo_modules/migrations/0002_credostudentproperties.py
Python
agpl-3.0
1,101
#!/usr/bin/env python3 # -*- mode:python; tab-width:4; c-basic-offset:4; intent-tabs-mode:nil; -*- # ex: filetype=python tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent smartindent # # Universal Password Changer (UPwdChg) # Copyright (C) 2014-2018 Cedric Dufour <http://cedric.dufour.name> # Author: Cedric Du...
alex-dot/upwdchg
tests/python-tokenreader-test.py
Python
gpl-3.0
7,822
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com> # Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz> # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html """Scikit learn interface for :class:`~gensim.models.atmodel.AuthorTopicModel...
midnightradio/gensim
gensim/sklearn_api/atmodel.py
Python
gpl-3.0
10,965
''' ''' from __future__ import print_function import sys from collections import OrderedDict import warnings # from contextlib import contextmanager import tensorflow as tf from tfclusterdefs import JobType, DevType __all__ = ('JobType', 'DevType', 'TFClusterManagerFacade',) class TFClusterManagerFacade(object): ...
avolkov1/keras_experiments
src/keras_exp/distrib/cluster_mgrs/tfcmgr.py
Python
unlicense
14,072
''' Decide on a JSONField implementation based on available packages. There are two possible options, preferred in the following order: - JSONField from django-jsonfield with django-jsonfield-compat - JSONField from django-mysql (needs MySQL 5.7+) Raises an ImportError if USE_JSONFIELD is True but none of these ...
justquick/django-activity-stream
actstream/jsonfield.py
Python
bsd-3-clause
1,189
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2017-04-23 19:37 ''' Миграция ''' from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): ''' Добавляем опциональные поля ''' dependencies = [ ('lawe', '0006_remove_account_unit'), ] operation...
DronMDF/laweb
lawe/migrations/0007_auto_20170423_1937.py
Python
apache-2.0
1,029
from urllib3._collections import HTTPHeaderDict class MetaDataHydrator: def hydrate_from_headers(self, metadata_entity, http_input_headers): for k, v in http_input_headers.items(): attr_name = k.replace(MetaDataDescriptor.prefix + '-', '') attr_name = attr_name.lower().replace('-'...
eloylp/scirocco-pyclient
sciroccoclient/metadata.py
Python
agpl-3.0
5,508
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('products', '0016_product_default'), ] operations = [ migrations.RemoveField( model_name='collection', ...
vanabo/mattress
src/products/migrations/0017_auto_20170226_2043.py
Python
mit
531
# -*- coding: utf-8 -*- # Generated by Django 1.9a1 on 2015-10-13 09:44 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('application', '0004_auto_20151013_1513'), ] operations = [ migrations.AlterF...
DheerendraRathor/ldap-oauth2
application/migrations/0005_auto_20151013_1514.py
Python
gpl-3.0
543
""" Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integers in each column are sorted in ascending from top to bottom. For example, Consider the following matrix: [ [1, 4, 7, 11...
dichen001/Go4Jobs
JackChen/divide&conquer/240. Search a 2D Matrix II.py
Python
gpl-3.0
1,045
class Tokenizer: def __init__(self, token, kind,): self.valor = token self.tipo = kind def setValue(self, booleano): self.booleano = booleano
raphaelmendes18/avaliadorDeProposicoesLogicas
avaliadorDeProposicoesLogicas/classes.py
Python
gpl-2.0
154
from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.plugins.callback.default import CallbackModule as DefaultCallbackModule # noqa from datetime import datetime # noqa class CallbackModule(DefaultCallbackModule): CALLBACK_VERSION = 2.0 CALLBACK_TYPE = 'stdo...
ivandeex/dz
ansible/lib/plugins/callback/vanko.py
Python
mit
1,667
from pymc import Model, Normal, Metropolis, MvNormal import numpy as np import pymc as pm from itertools import product from theano.tensor import log def simple_model(): mu = -2.1 tau = 1.3 with Model() as model: x = Normal('x', mu, tau, shape=2, testval=[.1]*2) return model.test_point, model,...
nmmarquez/pymc
pymc3/tests/models.py
Python
apache-2.0
2,189
# sybase/pyodbc.py # Copyright (C) 2005-2018 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 """ .. dialect:: sybase+pyodbc :name: PyODBC :dbapi: pyodbc :connectstr...
fernandog/Medusa
ext/sqlalchemy/dialects/sybase/pyodbc.py
Python
gpl-3.0
2,102
# Copyright 2020 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
deepmind/meltingpot
meltingpot/python/configs/substrates/collaborative_cooking_impassable.py
Python
apache-2.0
1,514
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from __future__ import division, unicode_literals """ FIXME: Proper module docstring """ __author__ = "Shyue Ping Ong" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "0.1" __maintainer...
aykol/pymatgen
pymatgen/entries/tests/test_entry_tools.py
Python
mit
1,311
# -*- coding: utf-8 -*- import json import os import random import requests import re import subprocess import string from django import forms from django.shortcuts import render from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from django.core.mail import send_mail from djang...
osamak/medcloud-registration
register/temp/views.py
Python
agpl-3.0
9,644
# -*- coding: utf-8 -*- """ ========================================================= SVM-Kernels ========================================================= Three different types of SVM-Kernels are displayed below. The polynomial and RBF are especially useful when the data-points are not linearly separable. """ # Co...
manhhomienbienthuy/scikit-learn
examples/svm/plot_svm_kernels.py
Python
bsd-3-clause
1,970
""" SHOPPING LISTS ITEMS MANAGEMENT """ from string import ascii_letters from datetime import date class ShoppingListItems(object): """ CLASS FOR ADDING, EDITING AND DELETING SHOPPING LIST ITEMS """ def __init__(self): self.list_of_shopping_list_items = [] def get_user_items(self, user, list_nam...
parseendavid/Andela-Developer-Challenge---Shopping-List-V2.0
app/shopping_lists_items.py
Python
mit
3,239
""" Week 7 Mini-project Descprition: Implementation of Spaceship Author: Itamar M. B. Lourenço Date: 2014-11-05 """ import simplegui import math import random # globals for user interface WIDTH = 800 HEIGHT = 600 score = 0 lives = 3 time = 0.5 TURN_FACTOR = math.radians(4) # degrees to radians THRUST_FAC...
italou/interactive-python-2014
week7-ship.py
Python
mit
13,611
#!/bin/python3 # -*- coding: utf-8 -*- from runner import Runner class FullRunner(Runner): def setup(self): self['number of years'] = 300 self['use all planets'] = False self['use planets'] = ['Sun', 'Earth', 'Jupiter', 'Venus', 'Mercury', 'Saturn', 'Neptune'...
Caronthir/FYS3150
Project3/analysis/fullsystem.py
Python
mit
1,022
''' mostly for 2d polygons ''' import numpy as np def center(poly): return poly.mean(axis=0) def area(x,y): """ Calculate the area of a polygon given as x(...),y(...) Implementation of Shoelace formula """ # http://stackoverflow.com/questions/24467972/calculate-area-of-polygon-given-x-y-coo...
radjkarl/fancyTools
fancytools/geometry/polygon.py
Python
gpl-3.0
1,888
'''The Monty Hall Problem Modelled as a Bayesian Belief Network''' from bayesian.factor_graph import * ''' As BBN: GuestDoor ActualDoor \ / MontyDoor p(M|G,A) As Factor Graph: fGuestDoor fActualDoor | ...
kamijawa/ogc_server
bayesian/examples/factor_graphs/monty_hall_sampled.py
Python
mit
1,998
class Edge(): def __init__(self): self.origin = None self.goal = None self.value = None self.isDouble = False self.pX = [] # To Draw self.pY = []
ejherran/acaest
Grafos/general/Edge.py
Python
gpl-3.0
250
""" Word scoring Christopher Von Bargen, <cdvonbargen@gmail.com> Copyright (c) 2017 """ class Tile: """ """ def __init__(self, letter): """ """ self.letter = letter class TilePool: """ """ def __init__(self): """ """ self.pool = [] def ...
cdvonbargen/wordjerks
python/tile_pool.py
Python
gpl-3.0
756
import distutils.dir_util import glob import os import shutil import subprocess import time from cassandra.concurrent import execute_concurrent_with_args from dtest import (Tester, cleanup_cluster, create_ccm_cluster, create_ks, debug, get_test_path) from tools.assertions import assert_one from too...
snazy/cassandra-dtest
snapshot_test.py
Python
apache-2.0
23,150
from helper import unittest, PillowTestCase, hopper from PIL import Image, IptcImagePlugin TEST_FILE = "Tests/images/iptc.jpg" class TestFileIptc(PillowTestCase): # Helpers def dummy_IptcImagePlugin(self): # Create an IptcImagePlugin object without initializing it class FakeImage(object): ...
liorvh/infernal-twin
build/pillow/Tests/test_file_iptc.py
Python
gpl-3.0
1,685
from datetime import * from dateutil.relativedelta import * from eventtools.conf import settings import calendar WEEKDAY_MAP = { calendar.MONDAY: MO, calendar.TUESDAY: TU, calendar.WEDNESDAY: WE, calendar.THURSDAY: TH, calendar.FRIDAY: FR, calendar.SATURDAY: SA, calendar.SUNDAY: SU, } def ...
ixc/glamkit-eventtools
eventtools/utils/dateranges.py
Python
bsd-3-clause
3,790
""" Yammer OAuth2 support """ import logging from urllib import urlencode from urlparse import parse_qs from django.utils import simplejson from django.utils.datastructures import MergeDict from social_auth.backends import BaseOAuth2, OAuthBackend, USERNAME from social_auth.exceptions import AuthCanceled from social_...
eahneahn/free
djangoproject/social_auth/backends/contrib/yammer.py
Python
agpl-3.0
3,276
# encoding: utf-8 # Copyright 2013 maker # License """ Finance integration with Events module Provides Liabilities as EventRenderer instances """ from maker.finance.models import Liability from maker.core.models import Object from maker.events.rendering import EventRenderer from django.db.models import Q impo...
alejo8591/maker
finance/events.py
Python
mit
1,017
# Generated by Django 2.2.9 on 2020-01-31 22:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('symposion_speakers', '0004_make_speaker_slugs_unique'), ] operations = [ migrations.AddField( model_name='speaker', ...
pydata/conf_site
symposion/speakers/migrations/0005_speaker_github_username.py
Python
mit
457
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('fundraising', '0001_initial'), ] operations = [ migrations.CreateModel( name='Donation', fields=[ ...
gnarf/djangoproject.com
fundraising/migrations/0002_auto_20150117_1728.py
Python
bsd-3-clause
1,761
"""Contains the SwitchController class which is responsible for reading switch states and posting events to the framework. """ # switch_controller.py # Mission Pinball Framework # Written by Brian Madden & Gabe Knuth # Released under the MIT License. (See license info at the end of this file.) # Documentation and mor...
spierepf/mpf
mpf/system/switch_controller.py
Python
mit
26,529
# Amara, universalsubtitles.org # # Copyright (C) 2018 Participatory Culture Foundation # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your op...
pculture/unisubs
apps/messages/notify.py
Python
agpl-3.0
6,266
import logging from autotest.client.shared import error from autotest.client import utils @error.context_aware def run_timerdevice_tscwrite(test, params, env): """ Timer device tscwrite test: 1) Check for an appropriate clocksource on host. 2) Boot the guest. 3) Download and compile the newest ms...
sathnaga/virt-test
qemu/tests/timerdevice_tscwrite.py
Python
gpl-2.0
1,871
#!/usr/bin/env python """ This example shows how to create a zip file in python using the built in python module 'zipfile' References: - https://stackoverflow.com/questions/1855095/how-to-create-a-zip-archive-of-a-directory """ import zipfile zipfile_handle = zipfile.ZipFile('/tmp/demo.zip', 'w', zipfile.ZIP_DEFLAT...
veltzer/demos-python
src/examples/short/zipfile/create_zip_simple.py
Python
gpl-3.0
624
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe.model.document import Document class StandardReply(Document): pass
gangadharkadam/letzfrappe
frappe/email/doctype/standard_reply/standard_reply.py
Python
mit
257
from datetime import date from django import db from django import forms from django.forms.models import modelform_factory, ModelChoiceField from django.conf import settings from django.test import TestCase from models import Person, RealPerson, Triple, FilePathModel, Article, \ Publication, CustomFF, Author, Aut...
andim27/magiccamp
tests/regressiontests/model_forms_regress/tests.py
Python
bsd-3-clause
11,548
# Processes Damped Harmonic Motion From a Logger Pro Utility # # Copyright (c) 2016 George L. # # # import sys print("Processor Copyright (c) 2016 George L.\n") THRESHOLD = int(input("what is your equilibuium position?: ")) NUM = int(input("how many types of data in one run?: ")) TOL = float(input("What is your toleran...
TheToppestKek/DHM-Data-Processor
Processor.py
Python
gpl-3.0
3,749
# -*- coding: utf-8 -*- import pytest from mitmproxy.test import tutils from mitmproxy.net import http def _test_passthrough_attr(message, attr): assert getattr(message, attr) == getattr(message.data, attr) setattr(message, attr, b"foo") assert getattr(message.data, attr) == b"foo" def _test_decoded_a...
mosajjal/mitmproxy
test/mitmproxy/net/http/test_message.py
Python
mit
8,776
from .variables import * from . import armadillo as arma def Get(node): if len(node) != 1: if not len(node): node.error("Zero arguments in a vec call") return "%(name)s()" elif len(node) == 2 and node[1].cls == "Int" and node[1].value == "1": pass #spe...
jonathf/matlab2cpp
src/matlab2cpp/rules/vec.py
Python
bsd-3-clause
2,188
#!/usr/bin/python # Copyright 2003 Dave Abrahams # Copyright 2003, 2006 Vladimir Prus # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) # Test main target alternatives. import BoostBuild import string t = BoostBuild.Tester(...
NixaSoftware/CVis
venv/bin/tools/build/v2/test/alternatives.py
Python
apache-2.0
3,072
import datetime import json import platform def get_platform(): """ Utility function for determining the current operating system. """ return 'macos' if platform.uname().system == 'Darwin' else 'windows' class DatetimeEncoder(json.JSONEncoder): """ Converts a python object, where datetime and timede...
VISTAS-IVES/pyvistas
source/vistas/core/utils.py
Python
bsd-3-clause
1,836
# 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 ...
lmazuel/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/virtual_network_gateway_py3.py
Python
mit
5,611
#!/usr/bin/python3 """Sorts input lines by order of decreasing line length. Read std input, then emit output lines in decreasing/increasing order of line length. """ from collections import defaultdict import getopt import os import sys import script_utils as u flag_reverse = True def usage(msgarg): """Print ...
thanm/devel-scripts
llsort.py
Python
apache-2.0
1,262
""" LTI Provider view functions """ from __future__ import absolute_import import logging import six from django.conf import settings from django.http import Http404, HttpResponseBadRequest, HttpResponseForbidden from django.views.decorators.csrf import csrf_exempt from opaque_keys import InvalidKeyError from opaque...
ESOedX/edx-platform
lms/djangoapps/lti_provider/views.py
Python
agpl-3.0
5,989
from random import randint from micromouse import maze class Mouse: x = 0 y = 0 maze = [] visited = [] n_distance = 0 e_distance = 0 s_distance = 0 w_distance = 0 def __init__(self, x, y, some_maze): print "Micromouse initialized. Hello world!" self.x = x s...
onu-opensource/micromouse_python
micromouse/mouse.py
Python
mit
2,148