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 |
|---|---|---|---|---|---|
# Uses python3
import sys
def lcm_naive(a, b):
for l in range(1, a*b + 1):
if l % a == 0 and l % b == 0:
return l
return a*b
if __name__ == '__main__':
input = sys.stdin.read()
a, b = map(int, input.split())
print(lcm_naive(a, b))
| travisrobinson/coursera-specializations | data-structures-and-algorithms/algorithmic-toolbox/week-2/week2_algorithmic_warmup/4_least_common_multiple/lcm.py | Python | cc0-1.0 | 275 |
print ("Hello World !!")
| ronas/PythonGNF | Eduardo/L01.ExeSeq01.py | Python | gpl-3.0 | 25 |
import pytest
import sqlalchemy as sa
from sqlalchemy_utils import IntRangeType
intervals = None
inf = -1
try:
import intervals
from infinity import inf
except ImportError:
pass
@pytest.fixture
def Building(Base):
class Building(Base):
__tablename__ = 'building'
id = sa.Column(sa.Int... | JackWink/sqlalchemy-utils | tests/types/test_int_range.py | Python | bsd-3-clause | 9,664 |
# postcode.py - functions for handling Dutch postal codes
#
# Copyright (C) 2013 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (... | arthurdejong/python-stdnum | stdnum/nl/postcode.py | Python | lgpl-2.1 | 2,481 |
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* ... | cypsun/FreeCAD | src/Mod/Arch/ArchWindow.py | Python | lgpl-2.1 | 53,323 |
from opensfm import dataset
def get_all_track_observations(gcp_database, track_id):
print(f"Getting all observations of track {track_id}")
data = dataset.DataSet(gcp_database.path)
tracks_manager = data.load_tracks_manager()
track_obs = tracks_manager.get_track_observations(track_id)
return {shot_... | oscarlorentzon/OpenSfM | annotation_gui_gcp/geometry.py | Python | bsd-2-clause | 1,098 |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function, division
"""
For standalone use only
Generate all 288 solutions to 2 by 2 sudoku i.e. 4 by 4 grids with 2 by 2 subgrids using 1,2,3,4.
$ python list_all_22.py | head
1234341221434321
1234341223414123
1234341241232341
1234341243212143
1234342... | walterv/sudoku_22 | list_all_22.py | Python | unlicense | 643 |
import pandas as pd
import numpy as np
import sys
import matplotlib.pyplot as plt
plt.rcParams['figure.facecolor']='white'
from Code.config import get_path
from clean import clean
def sales_by_stand_size(df):
"""
:param df:
:return:
"""
''' Sales by stand size: Could use net/gross/chargeab... | ShipJ/Code | Projects/SpringAutumnFair/src/analysis/springautumn.py | Python | mit | 10,209 |
from nagi import db
db.setup('localhost', 'test', 'test', 'nagi', pool_opt={'minconn': 3, 'maxconn': 10})
def create_lb(lid=2, name='unittest'):
r = db.query_one('SELECT lid from leaderboards WHERE lid=%s', (lid,))
if r:
return False
db.execute('INSERT INTO leaderboards VALUES(%s, %s, "base")', (... | whiteclover/Nagi | t/data.py | Python | gpl-2.0 | 1,052 |
#!/usr/bin/env python3
# Copyright 2020 Google LLC.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
import math
import os
import random
import time
from google.cloud.spanner_v1 import Client
REGION =... | googleapis/python-spanner-django | run_testing_worker.py | Python | bsd-3-clause | 2,045 |
#-+--------------------------------------------------------------------
# Igatools a general purpose Isogeometric analysis library.
# Copyright (C) 2012-2015 by the igatools authors (see authors.txt).
#
# This file is part of the igatools library.
#
# The igatools library is free software: you can use it, redistribute... | TheProjecter/igatools | source/geometry/grid_tools.inst.py | Python | gpl-3.0 | 1,637 |
#!/usr/bin/env python3
import sys
mm = 0.001
from openems import OpenEMS, Box, Cylinder, Port, Metal, Dielectric
import numpy as np
em = OpenEMS('microstrip', EndCriteria = 1e-5, fmin = 0e6, fmax = 60e9, fsteps = 1601)
copper = Metal(em, 'copper')
sub = Dielectric(em, 'substrate', eps_r=3.2)
foil_thickness = 0.036*mm... | dlharmon/pyopenems | examples/microstrip.py | Python | gpl-3.0 | 1,493 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-21 00:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Catego... | Brunux/shityjobs | categories/migrations/0001_initial.py | Python | mit | 862 |
import numpy as np
from pysc2.lib import point
from pysc2.lib import transform
if __name__ == "__main__":
# path = "C:/Users/chensy/Desktop/pysc2 source/data/demo1/"
orders = np.loadtxt("new_order.txt")
label = orders[:, 1]
# action_type: 0 : move, 1 : build_pylon, 2 : build_forge, 3: build_cannon
... | pangzhenjia/pysc2-source | pysc2/my_agent/data_reduce/data_sample.py | Python | apache-2.0 | 2,347 |
"""
@created_at 2015-05-11
@author Exequiel Fuentes Lettura <efulet@gmail.com>
"""
from klass_exception import KlassException
class Klass:
"""Define a sample class"""
def __init__(self):
pass
def new_method(self):
raise KlassException("Not implemented yet")
def __str__... | efulet/python-project | project/lib/module/klass.py | Python | mit | 391 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | Axam/nsx-web | nailgun/nailgun/objects/task.py | Python | apache-2.0 | 10,890 |
# -*- coding: UTF-8 -*-
import pandas
class Group(object):
def __init__(self):
self.arrayDeFrames = []
self.ENTITY_NULL = "nulo"
def removeEmptyEntities(self, dataFrame):
return dataFrame[dataFrame.LATITUDE.astype(str) != self.ENTITY_NULL]
def main(self, files, filename, SSPDS=True):
for file in files:
... | netodeolino/TCC | TCC 02/Code Files/Agrupar Arquivos/groupFiles.py | Python | mit | 1,037 |
#
# Copyright (C) 2009, 2011 Brad Howes.
#
# This file is part of Pyslimp3.
#
# Pyslimp3 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, or (at your option) any later version.
#
# Pyslimp3 is... | bradhowes/pyslimp3 | server/Animator.py | Python | gpl-3.0 | 9,139 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# Copyright 2017, Matthew Pounsett <matt@conundrum.com>
# ------------------------------------------------------------
from __future__ import unicode_literals
| mpounsett/arke | arke/__init__.py | Python | apache-2.0 | 247 |
from django.conf import settings
from django.conf.urls import include, patterns, url
import amo
from . import views
def fireplace_route(path, name=None):
"""
Helper function for building Fireplace URLs. `path` is the URL route,
and `name` (if specified) is the name given to the route.
"""
kwargs ... | ngokevin/zamboni | mkt/commonplace/urls.py | Python | bsd-3-clause | 3,372 |
#!/usr/bin/env python
#
# Copyright (C) 2008 Ferry Boender
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This ... | fboender/miniorganizer | src/lib/miniorganizer/__init__.py | Python | gpl-3.0 | 928 |
#!/usr/bin/env python
"""Test cppcheck-htmlreport."""
import os
import contextlib
import shutil
import subprocess
import sys
import tempfile
if sys.version_info < (2, 7):
# For TestCase.assertIn().
import unittest2 as unittest
else:
import unittest
ROOT_DIR = os.path.split(os.path.abspath(os.path.dirname... | bartlomiejgrzeskowiak/cppcheck | htmlreport/test_htmlreport.py | Python | gpl-3.0 | 3,581 |
""""
Copyright 2010 Shahriyar Amini
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 ... | samini/cache | framework/CacheServiceV1/tools/convertDB.py | Python | apache-2.0 | 2,035 |
import tensorflow as tf
from tfsnippet.ops import convert_to_tensor_and_cast
from tfsnippet.utils import (DocInherit,
TensorWrapper,
register_tensor_wrapper_class,
get_default_session_or_error)
__all__ = ['ScheduledVariable', 'Anne... | korepwx/tfsnippet | tfsnippet/scaffold/scheduled_var.py | Python | mit | 6,184 |
class APIException(Exception):
def __init__(self, error, code='NOT_IMPLEMENTED'):
self.error = error
self.code = code
class APIBadRequest(APIException):
def __init__(self, error):
super(APIBadRequest, self).__init__(error, 'BAD_REQUEST')
class APIForbidden(APIException):
def __init... | melissiproject/server | melisi/mlscommon/exceptions.py | Python | agpl-3.0 | 528 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'CandidateList.mpg_html_report'
db.delete_column(u'polyorg_candidatelist', 'mpg_html_report... | hasadna/open-shot | polyorg/migrations/0004_auto__del_field_candidatelist_mpg_html_report__del_field_candidatelist.py | Python | bsd-3-clause | 12,968 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-07 16:19
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | HMSBeagle1831/rapidscience | rlp/bibliography/migrations/0004_auto_20160607_1619.py | Python | mit | 1,117 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2017 CERN.
#
# INSPIRE 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 ... | inspirehep/inspire-next | tests/unit/theme/test_theme_jinja2filters.py | Python | gpl-3.0 | 35,487 |
# Copyright (c) 2012 VMware, Inc. All Rights Reserved.
# This file is part of ATOMac.
#@author: Nagappan Alagappan <nagappan@gmail.com>
#@copyright: Copyright (c) 2009-12 Nagappan Alagappan
#http://ldtp.freedesktop.org
# ATOMac is free software; you can redistribute it and/or modify
# it under the terms of the GNU G... | pyatom/pyatom | atomac/ldtpd/utils.py | Python | gpl-2.0 | 32,208 |
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015 MinIO, 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/lic... | minio/minio-py | examples/presigned_post_policy.py | Python | apache-2.0 | 1,357 |
"""The tests for the mochad switch platform."""
import unittest
import pytest
from homeassistant.components import switch
from homeassistant.components.mochad import switch as mochad
from homeassistant.setup import setup_component
import tests.async_mock as mock
from tests.common import get_test_home_assistant
@py... | tchellomello/home-assistant | tests/components/mochad/test_switch.py | Python | apache-2.0 | 2,257 |
import asyncio
import discord
import re
import os
import random
import string
import json
import time
import html
import codecs
from random import shuffle
from discord.ext import commands
class CardsAgainstHumanity:
# Init with the bot reference, and a reference to the deck file
def __init__(self, bot, fil... | jonyroda97/redbot-amigosprovaveis | cogs/cah.py | Python | gpl-3.0 | 73,657 |
"""
Some useful graphics functions
"""
import util
import binary
from numpy import *
from pylab import *
# def plotLinearClassifier(h, X, Y):
# """
# Draw the current decision boundary, margin and data
# """
# if type(h.weights) == ndarray:
# nx,mx,ny,my = axis()
# # find the point ... | jeffreyrivera/ciml | projects/p1/mlGraphics.py | Python | gpl-2.0 | 3,553 |
# -*- encoding: utf-8 -*-
"""
Строка со специальными символами
"""
s = 'a\0b\0c'
print s
print len(s)
| h4/fuit-webdev | examples/lesson2/1.4/1.4.8.py | Python | mit | 132 |
##
# Copyright 2011-2017 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | damianam/easybuild-framework | easybuild/tools/repository/__init__.py | Python | gpl-2.0 | 1,270 |
##
# Copyright 2009-2020 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | pescobar/easybuild-easyblocks | easybuild/easyblocks/a/armadillo.py | Python | gpl-2.0 | 2,930 |
import sublime
import sublime_plugin
import json
import os
try:
# ST3
from ..utils.cli import CLI
except ImportError:
# ST2
from bower.utils.cli import CLI
class InstallDependenciesCommand(sublime_plugin.WindowCommand):
def config_path(self):
try:
project_file_path = self.windo... | benschwarz/sublime-bower | bower/commands/install_dependencies.py | Python | mit | 649 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Simple python program to convert OpenCL code to string
# Copyright 2017 Wanghong Lin
#
# 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
#
# ... | consultit/Ely | doc/clext.py | Python | lgpl-3.0 | 4,776 |
"""
Back compatibility utils module. It will import the appropriate
set of tools
"""
from __future__ import division, absolute_import, print_function
import warnings
# 2018-04-04, numpy 1.15.0
warnings.warn("Importing from numpy.testing.utils is deprecated, "
"import from numpy.testing instead.",
... | Eric89GXL/numpy | numpy/testing/utils.py | Python | bsd-3-clause | 1,219 |
#! /usr/bin/env python
import re
import os
# Definition taken from
#
# http://www.geotoolkit.org/modules/referencing/supported-codes.html
#
# download file and use extract_epsgCodes_with_forcedXY.py to extract
# http://www.geotoolkit.org/modules/referencing/supported-codes.html'
# extract pattern
# <tr><td class=... | 52North/IlwisCore | core/resources/extract_epsgCodes_with_forcedXY.py | Python | gpl-3.0 | 843 |
from ds.vortex.core import baseNode
from ds.vortex.core import plug as plugs
class InRangeNode(baseNode.BaseNode):
def __init__(self, name):
"""
:param name: str, the name of the node
"""
baseNode.BaseNode.__init__(self, name)
def initialize(self):
baseNode.BaseNode.in... | dsparrow27/vortex | src/ds/vortex/nodes/comparison/inRange.py | Python | mit | 1,292 |
"""
2-input XOR example -- this is most likely the simplest possible example.
"""
from __future__ import print_function
import os
import neat
import visualize
# 2-input XOR inputs and expected outputs.
xor_inputs = [(0.0, 0.0), (0.0, 1.0), (1.0, 0.0), (1.0, 1.0)]
xor_outputs = [ (0.0,), (1.0,), (1.0,), ... | drallensmith/neat-python | examples/xor/evolve-feedforward-partial.py | Python | bsd-3-clause | 2,330 |
import sys
x=1001
print(sys.getrecursionlimit())
sys.setrecursionlimit(x)
print(sys.getrecursionlimit())
| srinivasanmit/all-in-all | interview_qns/recursion_limit.py | Python | gpl-3.0 | 109 |
#!/usr/bin/env python
# encoding: utf-8
from t import T
import requests,urllib2,json,urlparse
class P(T):
def __init__(self):
T.__init__(self)
def verify(self,head='',context='',ip='',port='',productname={},keywords='',hackinfo=''):
target_url = "http://"+ip+":9200/_nodes/stats"
result ... | nanshihui/PocCollect | component/elasticsearch/elasticsearch_nodestate.py | Python | mit | 1,117 |
import json
from django import template
from django.conf import settings
from geotrek.tourism.models import TouristicContentCategory
register = template.Library()
@register.assignment_tag
def touristic_content_categories():
categories = {
str(category.pk): {
'type1_label': category.type1_l... | mabhub/Geotrek | geotrek/tourism/templatetags/tourism_tags.py | Python | bsd-2-clause | 923 |
# Version: 0.12
"""
The Versioneer
==============
* like a rocketeer, but for versions!
* https://github.com/warner/python-versioneer
* Brian Warner
* License: Public Domain
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, and pypy
[]... | markovmodel/pystallone | versioneer.py | Python | bsd-2-clause | 36,530 |
'''
Castle Defense Screen
Displays the game screen
By Katie and Paulo
'''
import Tkinter as tk
import math
class Screen(tk.Tk):
def __init__(self, *args, **kwargs):
########## Important Variables ############
# Current viewing location
self.current_view_x = 0
self.current_view_y = 10
# Number cells ... | pacarvalho/CastleDefense | Screen.py | Python | gpl-3.0 | 6,896 |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
"""
import json
import datetime
from django.test import TestCase
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
fr... | mostateresnet/django-ticket | issues/tests.py | Python | mit | 31,259 |
'''
Created on 2013-10-21
@author: zhangzhi
@contact: z2care@gmail.com
'''
from abc import abstractmethod
from datetime import datetime
class Message(object):
def __init__(self, type_name):
self.type = type_name
self.limit = None
self.text = None
self.time = None
def send(sel... | z2care/DP4Py | Creational/Builder/Builder.py | Python | gpl-2.0 | 1,639 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-10 11:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gem', '0035_merge_20190125_1240'),
]
operations = [
migrations.AddField(
... | praekelt/molo-gem | gem/migrations/0036_gemsettings_fb_enable_chat_bot.py | Python | bsd-2-clause | 522 |
#!/usr/bin/python
from __future__ import print_function, absolute_import
import os, sys, time
if not 'SMC' in os.environ:
os.environ['SMC'] = os.path.join(os.environ['HOME'], '.smc')
SMC = os.environ['SMC']
if not os.path.exists(SMC):
os.makedirs(SMC)
# ensure that PATH starts with ~/bin, so user can custom... | sagemathinc/smc | src/smc_pyutil/smc_pyutil/start_smc.py | Python | agpl-3.0 | 1,043 |
class abstract_identity_iterator():
""" an identity iterator to provide pre-defined identities"""
def __init__(self):
pass
def next(self):
""" Should return a pair (<adid>, <android_id>) """
pass
class abstract_experiment:
""" an experiment to be provided to run_once function... | tonyyanga/android-ad | appium_exec/abstract_experiment.py | Python | gpl-3.0 | 912 |
import datetime
import logging
import os
import shutil
from typing import Any, Dict, Iterable, List, Optional, Tuple
import boto3
import ujson
from bs4 import BeautifulSoup
from django.conf import settings
from django.db import connection
from django.db.models import Max
from django.utils.timezone import now as timezo... | synicalsyntax/zulip | zerver/lib/import_realm.py | Python | apache-2.0 | 58,863 |
from distutils.core import setup
setup(
name = 'podict',
packages = ['podict'], # this must be the same as the name above
version = '0.1',
description = 'A command-line version Oxford Dictionary',
author = 'Sheng Wang',
author_email = 'wang_s1998@163.com',
url = 'https://github.com/peterldowns/mypackage',... | JamesQFreeman/Pod | setup.py | Python | mit | 537 |
"""
Django settings for cream 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, ...)
impo... | sirmmo/dj-cream | cream/cream/settings.py | Python | mit | 1,969 |
from schema_factory import BaseSchema, FloatNode, StringNode
class GeographyMixin(object):
@property
def srid(self):
return 4326
class Location(GeographyMixin, BaseSchema):
"""Mock Schema example.
"""
lat = FloatNode()
lng = FloatNode()
toponym = StringNode(default='')
@sta... | agile4you/SchemaFactory | example.py | Python | gpl-3.0 | 608 |
import pytest
from pock import any_values
from pock import mock, when, verify, any_value, VerificationError
def test_mocking_a_method():
method_mock = mock()
when(method_mock).some_method('some_arg').then_return('some_value')
assert method_mock.some_method('some_arg') == 'some_value'
verify(method_mo... | atbentley/pock | tests/functional.py | Python | mit | 2,484 |
import os
import unittest
class GlobalsPostTest(unittest.TestCase):
FILE = '/etc/hiera/globals.yaml'
def test_has_globals_yaml(self):
self.assertTrue(os.path.isfile(self.FILE),
'Globals yaml not found!')
def test_has_use_neutron_key(self):
globals_file = open(self... | xarses/fuel-library | deployment/puppet/osnailyfacter/modular/globals/globals_post.py | Python | apache-2.0 | 573 |
from exchangelib.errors import ErrorItemNotFound
from exchangelib.folders import Inbox
from exchangelib.items import Message
from .test_basics import BaseItemTest
class ItemHelperTest(BaseItemTest):
TEST_FOLDER = "inbox"
FOLDER_CLASS = Inbox
ITEM_CLASS = Message
def test_save_with_update_fields(self... | ecederstrand/exchangelib | tests/test_items/test_helpers.py | Python | bsd-2-clause | 5,388 |
""" Interface to invoke a thread to start he volume slicer """
# Copyright (C) 2009-2010, Ecole Polytechnique Federale de Lausanne (EPFL) and
# University Hospital Center and University of Lausanne (UNIL-CHUV)
#
# Modified BSD License
import logging
logger = logging.getLogger('root.'+__name__)
from threading import ... | LTS5/connectomeviewer | cviewer/visualization/volume/thread_volslice.py | Python | bsd-3-clause | 1,464 |
import traceback
from nltk.corpus import stopwords
try:
import enchant
enchant_enabled = True
except Exception:
print "Missing enchant!!!!"
enchant_enabled = False
import re
import sys
import nltk
import string
# nltk.download('punkt')
# nltk.download('averaged_perceptron_tagger')
class Normalize... | Griesbacher/ContentAnalytics | normalizer.py | Python | gpl-3.0 | 5,298 |
from django.apps import AppConfig
class TournamentConfig(AppConfig):
name = 'tournament'
| nmalaguti/mini-halite | tournament/apps.py | Python | mit | 95 |
"""
Basic Boilerplate settings to be used as a base for all projects.
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/re... | maherpk/django-boilerplate | conf/settings/base.py | Python | mit | 2,781 |
#-*- coding:utf-8 -*-
from rrd.store import graph_db_conn as db_conn
class Endpoint(object):
def __init__(self, id, endpoint, ts):
self.id = str(id)
self.endpoint = endpoint
self.ts = ts
def __repr__(self):
return "<Endpoint id=%s, endpoint=%s>" %(self.id, self.id)
__str__ ... | Cepave/dashboard | rrd/model/endpoint.py | Python | apache-2.0 | 2,945 |
"""Support shorthand import of our classes into the namespace.
"""
from .loader import Loader
from .reporter import Reporter
| loum/trols-stats | trols_stats/interface/__init__.py | Python | gpl-2.0 | 125 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import numpy as np
from eqcorrscan.utils.correlate import *
class CorrelateTests(unittest.TestCase):
def test_same_various_methods(self):
tem... | eqcorrscan/ci.testing | eqcorrscan/tests/correlate_test.py | Python | lgpl-3.0 | 920 |
import socket #for sockets
import sys #for exit
try:
#create an AF_INET, STREAM socket (TCP)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error, msg:
print 'Failed to create socket. Error code: ' + str(msg[0]) + ' , Error message : ' + msg[1]
sys.exit();
print 'Socket Creat... | janusnic/21v-python | unit_18/client/c3.py | Python | mit | 574 |
"""SCons.Platform
SCons platform selection.
This looks for modules that define a callable object that can modify a
construction environment as appropriate for a given platform.
Note that we take a more simplistic view of "platform" than Python does.
We're looking for a single string that determines a set of
tool-ind... | Uli1/mapnik | scons/scons-local-2.4.0/SCons/Platform/__init__.py | Python | lgpl-2.1 | 10,485 |
""" This module provides a lexical scanner component for the `parser` package.
"""
class SettingLexer(object):
""" Simple lexical scanner that tokenizes a stream of configuration data.
See ``SettingParser`` for further information about grammar rules and
specifications.
Example Usage:... | xtrementl/focus | focus/parser/lexer.py | Python | mit | 9,227 |
# TOOL test-multiple-inputs.py: "Test multiple inputs in Python" (Multiple input output test.)
# INPUT input{...} TYPE GENERIC
# INPUT other TYPE GENERIC
# OUTPUT output
# OUTPUT OPTIONAL missing_output.txt
import shutil
shutil.copyfile('other', 'output')
| chipster/chipster-tools | tools/misc/python/test-multiple-inputs.py | Python | mit | 260 |
from __future__ import absolute_import, print_function
from ._version import get_versions
import os
try:
from .__conda_version__ import conda_version
__version__ = conda_version.replace("'","")
del conda_version
except ImportError:
__version__ = get_versions()['version']
del get_versions
_notebook... | sahat/bokeh | bokeh/__init__.py | Python | bsd-3-clause | 8,912 |
import collections
import re
import furl
from django.core.urlresolvers import resolve, reverse, NoReverseMatch
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from rest_framework import exceptions, permissions
from rest_framework import serializers as ser
from rest_framework.field... | cwisecarver/osf.io | api/base/serializers.py | Python | apache-2.0 | 58,011 |
"""
Copyright (c) 2012-2014 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | gkadillak/rockstor-core | src/rockstor/storageadmin/views/group.py | Python | gpl-3.0 | 5,119 |
import click
from arrow.cli import pass_context, json_loads
from arrow.decorators import custom_exception, str_output
@click.command('load_gff3')
@click.argument("organism", type=str)
@click.argument("gff3", type=str)
@click.option(
"--source",
help="URL where the input dataset can be found.",
type=str
)
... | erasche/python-apollo | arrow/commands/annotations/load_gff3.py | Python | mit | 559 |
import sys
sys.setrecursionlimit = 100000
n, m = raw_input().strip().split(' ')
n, m = [int(n), int(m)]
sources = set(range(n))
G = [[] for i in xrange(n)]
for a0 in xrange(m):
u, v = raw_input().strip().split(' ')
u, v = [int(u), int(v)]
G[u - 1].append(v - 1)
if v - 1 in sources:
sources.rem... | opethe1st/CompetitiveProgramming | Hackerrank/WorldCodeSprint/WorldCodeSprint11/CityConstruction.py | Python | gpl-3.0 | 1,940 |
"""
Test whether the boundary recovery is working in on a 1D mesh.
To be working, a linearly varying field should be exactly recovered.
This is tested for:
- the lowest-order density space recovered to DG1
"""
from firedrake import (PeriodicIntervalMesh, IntervalMesh,
SpatialCoordinate, FiniteE... | firedrakeproject/dcore | tests/recovery_tests/test_recovery_1d.py | Python | mit | 2,310 |
# Copyright (c) 2015 Tanium Inc
#
# Generated from console.wsdl version 0.0.1
#
#
from .base import BaseType
class VersionAggregate(BaseType):
_soap_tag = 'version'
def __init__(self):
BaseType.__init__(
self,
simple_properties={'version_string': str,
... | tanium/pytan | lib/taniumpy/object_types/version_aggregate.py | Python | mit | 571 |
#------------------------------------------------------------------------------#
# Copyright 2016-2017 Golden Sierra Game Development Class #
# This file is part of Verloren (GSHS_RPG). #
# ... | turtlewit/GSHS_RPG | src/states.py | Python | gpl-3.0 | 15,756 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | EvanK/ansible | lib/ansible/modules/cloud/google/gcp_sql_instance_facts.py | Python | gpl-3.0 | 15,144 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | kinnou02/navitia | source/jormungandr/tests/traveler_profile_tests.py | Python | agpl-3.0 | 3,132 |
import i18n
class EngineCommand(object):
type = "Engine"
description = "Do nothing with engine"
def execute(self):
pass
def undo(self):
pass
class AddScore(EngineCommand):
def __init__(self, engine, score):
self.engine = engine
self.last_score = engine.score
... | the-dalee/gnome-2048 | core/model/commands/engine.py | Python | mit | 1,148 |
# -*- coding: utf-8 -*-
import os
import numpy
import math
from scipy import interpolate
from scipy import optimize
import matplotlib.pyplot as plt
from rmtk.vulnerability.common import utils
def calculate_fragility(capacity_curves,gmrs,damage_model,damping,hysteresis_model,damping_model):
no_damage_states = ... | dynaryu/rmtk | rmtk/vulnerability/derivation_fragility/equivalent_linearization/vidic_etal_1994/vidic_etal_1994.py | Python | agpl-3.0 | 3,052 |
from discord import Guild
from bot.database import ServerConfig
from bot.lib.configuration import BotConfiguration
class GuildConfiguration:
"""
Allows management of configuration for guilds, for example an anouncement channel for welcome messages.
It can handle "global" configurations by passing None as... | jvicu2001/alexis-bot | bot/lib/guild_configuration.py | Python | mit | 11,022 |
from pyramid import testing
from pytest import fixture
from pytest import raises
from pytest import mark
@fixture
def integration(config):
config.include('adhocracy_core.content')
config.include('adhocracy_core.sheets.workflow')
@fixture
def registry(registry_with_content):
return registry_with_content
... | fhartwig/adhocracy3.mercator | src/adhocracy_core/adhocracy_core/sheets/test_workflow.py | Python | agpl-3.0 | 8,925 |
import subprocess
def add_ruby_version_segment(powerline):
try:
p1 = subprocess.Popen(["ruby", "-v"], stdout=subprocess.PIPE)
p2 = subprocess.Popen(["sed", "s/ (.*//"], stdin=p1.stdout, stdout=subprocess.PIPE)
version = p2.communicate()[0].decode("utf-8").rstrip()
if os.environ.has... | ceholden/powerline-shell | segments/ruby_version.py | Python | mit | 527 |
#!/usr/bin/env python
# Copyright 2015 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.
"""Usage: collect_idls_into_json.py path_file.txt json_file.json
This script collects and organizes interface information and that info... | danakj/chromium | third_party/WebKit/Tools/Scripts/webkitpy/bindings/collect_idls_into_json.py | Python | bsd-3-clause | 14,314 |
import numpy as np
import scipy.spatial.distance as dist
from matplotlib.backends.backend_pdf import PdfPages
import matplotlib.pyplot as plt
import matplotlib.lines as mplines
import scipy.cluster.hierarchy as clust
import os
def kabsch(coord, ref,app):
C = np.dot(np.transpose(coord), ref)
V, S, W = np.linalg.svd(C... | jEschweiler/Urease | urease_software/cluster.py | Python | gpl-3.0 | 5,877 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | maartenq/ansible | lib/ansible/modules/cloud/google/gcp_compute_global_address.py | Python | gpl-3.0 | 11,150 |
import SSLbottle as blt
from KalutServer.Exceptions import *
from KalutServer.Model.Communicator import Communicator
import KalutServer.conf as myconf
import json
def build_standart_response(data, status='OK', errMsg=None):
return {
'Status' : status,
'Data' : data,
'ErrMsg' : errMsg
}
... | TwoUnderscorez/KalutServer | KalutServer/RESTfulAPI/server.py | Python | apache-2.0 | 2,760 |
from __future__ import absolute_import, division, print_function
import yaml
import os
import sys
def read_configuration_file(configuration_file):
list_of_paths = list()
list_of_paths.append(configuration_file)
with open(configuration_file, 'r') as fh:
configuration = yaml.safe_load(fh.read())
... | stcorp/legato | legato/config.py | Python | bsd-3-clause | 1,480 |
from elasticsearch import Elasticsearch
from elasticsearch import helpers
hosts = ['172.18.52.171', '172.18.52.172','172.18.52.173' ,'172.18.52.174']
es = Elasticsearch('172.18.52.171')
query={"query" : {"match_all" : {}}}
scanResp= helpers.scan(client= es, query=query, scroll= "10m", timeout="10m")
ts = set()
for res... | Svolcano/python_exercise | elk/get_all_from_es.py | Python | mit | 576 |
#!/usr/bin/env python
# Copyright (c) 2011-2020, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
"""
Interpolation
^^^^^^^^^^^^^
Interpolation allows to transfer data from one set of locations to another.
This includes for example:
- interpolating the data from a polar grid to... | wradlib/wradlib | wradlib/ipol.py | Python | mit | 57,761 |
"""
Function-like objects that creates cubic clusters.
"""
import numpy as np
from ase.cluster.factory import ClusterFactory
from ase.data import reference_states as _refstate
class HexagonalFactory(ClusterFactory):
spacegroup = 191
xtal_name = 'hexagonal'
def get_lattice_constant(self, latticeconstant)... | JConwayAWT/PGSS14CC | lib/python/multimetallics/ase/cluster/hexagonal.py | Python | gpl-2.0 | 2,743 |
# 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/recoveryservices/azure-mgmt-recoveryservicessiterecovery/azure/mgmt/recoveryservicessiterecovery/aio/_configuration.py | Python | mit | 3,868 |
# Copyright 2014 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 in writing, ... | quom/google-cloud-python | datastore/google/cloud/datastore/entity.py | Python | apache-2.0 | 5,710 |
__author__ = 'leppin'
from django.conf.urls import patterns, url
from .views import project_choice, project_new, project_edit, all_projects, new_proj_contact_type, proj_edit_adrtype
from .views import proj_adrtype_view
urlpatterns = patterns('',
url(r'^choice/$', project_choice, name='proj_choi... | oerb/immotask | projects/urls.py | Python | gpl-3.0 | 1,041 |
import glob
import pandas as pd
import numpy as np
pd.set_option('display.max_columns', 50) # print all rows
import os
os.chdir("/gpfs/commons/home/biederstedte-934/evan_projects/correct_phylo_files")
normalB = glob.glob("binary_position_RRBS_normal_B_cell*")
mcell = glob.glob("binary_position_RRBS_NormalBCD19pCD27... | evanbiederstedt/RRBSfun | trees/chrom_scripts/normal_chr02.py | Python | mit | 25,843 |
import json
from pprint import pprint as pp
import re
import requests
from app.clients import tripadvisorkey
TRIP_ADVISOR_API = "https://api.tripadvisor.com/api/partner/2.0/location/{}"
params = { "key": tripadvisorkey }
TA_ids = ["d4868306", "d2701835", "d2368658"]
def fetchTABusiness(bizId):
url = TRIP_ADVISO... | liuche/prox-server | samples/tripadvisor-test.py | Python | mpl-2.0 | 615 |
# -*- coding: utf-8 -*-
from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = [
url(r'^properties/', include('userproperty.urls')),
url(r'^admin/', include(admin.site.urls)),
]
| arteria/django-userproperty | tests/urls.py | Python | bsd-2-clause | 243 |
#!/usr/bin/env python
import threading
import time
import random
import sock
import sp_exceptions
import handler
from world_model import WorldModel
class Agent:
def __init__(self):
# whether we're connected to a server yet or not
self.__connected = False
# set all variables and important... | jasontbradshaw/soccerpy | agent.py | Python | mit | 13,506 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.