code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/python
#
# Copyright (c) 2016 Matt Davis, <mdavis@ansible.com>
# Chris Houseknecht, <house@redhat.com>
#
# 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 Soft... | adityacs/ansible | lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py | Python | gpl-3.0 | 60,330 |
import gc
import os
import sys
import shlex
import subprocess
sys.path.insert(0, os.getcwd())
sys.path.insert(0, os.path.join(os.getcwd(), os.pardir))
from nose import SkipTest
from celery import current_app
from celery.tests.utils import unittest
import suite
GET_RSIZE = "/bin/ps -p %(pid)s -o rss="
QUICKTEST = i... | waseem18/oh-mainline | vendor/packages/celery/funtests/suite/test_leak.py | Python | agpl-3.0 | 3,713 |
# Path management utilities for Sublime plugin dev.
# TODO: This will eventually be moved to a separate package.
import sublime
import os
def rootAtPackagesDir(*leaf):
return os.path.join(sublime.packages_path(), *leaf)
| SublimeText/PowershellUtils | sublimepath.py | Python | mit | 232 |
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list o... | apple/swift | utils/build_swift/tests/build_swift/test_defaults.py | Python | apache-2.0 | 4,351 |
'''
This module should be run to recreate the files that we generate automatically
(i.e.: modules that shouldn't be traced and cython .pyx)
'''
from __future__ import print_function
import os
import struct
def is_python_64bit():
return (struct.calcsize('P') == 8)
root_dir = os.path.join(os.path.dirname(__file... | idea4bsd/idea4bsd | python/helpers/pydev/build_tools/generate_code.py | Python | apache-2.0 | 5,381 |
# 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... | nburn42/tensorflow | tensorflow/python/keras/utils/generic_utils_test.py | Python | apache-2.0 | 2,330 |
import sys
import unittest
from django.conf import settings
from django.contrib.admindocs import utils, views
from django.contrib.admindocs.views import get_return_data_type, simplify_regex
from django.contrib.sites.models import Site
from django.db import models
from django.db.models import fields
from django.test im... | auready/django | tests/admin_docs/test_views.py | Python | bsd-3-clause | 14,791 |
# Copyright (C) 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 in writ... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/google-api-python-client/oauth2client/appengine.py | Python | bsd-3-clause | 17,978 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Peter Mounce <public@neverrunwithscissors.com>
#
# 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... | gundalow/ansible-modules-extras | windows/win_webpicmd.py | Python | gpl-3.0 | 1,852 |
"""
Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's
Smalltalk testing framework.
This module contains the core framework classes that form the basis of
specific test cases and suites (TestCase, TestSuite etc.), and also a
text-based utility class for running the tests and reporting the resu... | mzdaniel/oh-mainline | vendor/packages/mechanize/test-tools/unittest/__init__.py | Python | agpl-3.0 | 2,508 |
#!/usr/bin/python
#
# Copyright 2011 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 b... | kbdick/RecycleTracker | recyclecollector/scrap/gdata-2.0.18/samples/apps/orgunit_quick_start_example.py | Python | gpl-3.0 | 15,135 |
# Copyright 2018 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | asajeffrey/servo | etc/start_servo.py | Python | mpl-2.0 | 992 |
"""Tests for polynomial module.
"""
from __future__ import division
import numpy as np
import numpy.polynomial.polynomial as poly
from numpy.testing import *
def trim(x) :
return poly.polytrim(x, tol=1e-6)
T0 = [ 1]
T1 = [ 0, 1]
T2 = [-1, 0, 2]
T3 = [ 0, -3, 0, 4]
T4 = [ 1, 0, -8, 0, 8]
T5 = [ 0... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/numpy/polynomial/tests/test_polynomial.py | Python | agpl-3.0 | 16,770 |
import os
from os.path import join
import numpy
from numpy.distutils.misc_util import Configuration
from sklearn._build_utils import get_blas_info
def configuration(parent_package="", top_path=None):
config = Configuration("manifold", parent_package, top_path)
libraries = []
if os.name == 'posix':
... | YinongLong/scikit-learn | sklearn/manifold/setup.py | Python | bsd-3-clause | 1,279 |
from django.template import TemplateDoesNotExist
from django.test import (
Client, RequestFactory, SimpleTestCase, override_settings,
)
from django.utils.translation import override
from django.views.csrf import CSRF_FAILURE_TEMPLATE_NAME, csrf_failure
@override_settings(ROOT_URLCONF='view_tests.urls')
class Csrf... | auready/django | tests/view_tests/tests/test_csrf.py | Python | bsd-3-clause | 4,007 |
#!/usr/bin/env python
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm.load_dna('../data/fm_train_dna.dat')
testdat = lm.load_dna('../data/fm_test_dna.dat')
parameter_list = [[traindat,testdat,4,0,False, False],[traindat,testdat,4,0,False,False]]
def kernel_comm_word_string_modular (fm_train_dna=traind... | c4goldsw/shogun | examples/undocumented/python_modular/kernel_comm_word_string_modular.py | Python | gpl-3.0 | 1,453 |
"""Read and write configuration settings
"""
from milc import cli
def print_config(section, key):
"""Print a single config setting to stdout.
"""
cli.echo('%s.%s{fg_cyan}={fg_reset}%s', section, key, cli.config[section][key])
def show_config():
"""Print the current configuration to stdout.
"""
... | kmtoki/qmk_firmware | lib/python/qmk/cli/config.py | Python | gpl-2.0 | 3,720 |
#!/usr/bin/env python
#
# Copyright (c) 2012 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.
"""DEPRECATED!
TODO(bulach): remove me once all other repositories reference
'test_runner.py perf' directly.
"""
import optparse... | hugegreenbug/libgestures | include/build/android/bb_run_sharded_steps.py | Python | bsd-3-clause | 1,441 |
#!/usr/bin/python
#/****************************************************************************
#* *
#* OpenNI 2.x Alpha *
#* Copyright (C) 2012 PrimeSense Ltd. ... | atuleu/debian-openni2 | Packaging/Harvest.py | Python | apache-2.0 | 17,431 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | tejaswi2492/pmip6ns3.13new | src/tools/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 172,830 |
from __future__ import division, absolute_import, print_function
import os
import sys
import types
import re
from numpy.core.numerictypes import issubclass_, issubsctype, issubdtype
from numpy.core import ndarray, ufunc, asarray
__all__ = [
'issubclass_', 'issubsctype', 'issubdtype', 'deprecate',
'deprecate_... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/site-packages/numpy/lib/utils.py | Python | gpl-3.0 | 36,893 |
foo = 'ns1!'
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| Eddy0402/Environment | vim/ycmd/third_party/jedi/test/test_evaluate/namespace_package/ns1/pkg/__init__.py | Python | gpl-3.0 | 214 |
# -*- coding: utf-8 -*-
"""
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 program is distributed in ... | Arno-Nymous/pyload | module/database/StorageDatabase.py | Python | gpl-3.0 | 1,952 |
#!/usr/bin/env python
# Copyright 2014 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.
"""Simple tool to generate NMF file by just reformatting given arguments.
This tool is similar to native_client_sdk/src/tools/create_n... | boundarydevices/android_external_chromium_org | ppapi/tests/create_nonsfi_test_nmf.py | Python | bsd-3-clause | 2,605 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
import frappe
import unittest
test_records = frappe.get_test_records('Note')
class TestNote(unittest.TestCase):
pass
| indictranstech/omnitech-frappe | frappe/desk/doctype/note/test_note.py | Python | mit | 225 |
# Originally contributed by Sjoerd Mullender.
# Significantly modified by Jeffrey Yasskin <jyasskin at gmail.com>.
"""Fraction, infinite-precision, real numbers."""
from decimal import Decimal
import math
import numbers
import operator
import re
import sys
__all__ = ['Fraction', 'gcd']
def gcd(a, b):
"""Calcu... | lfcnassif/MultiContentViewer | release/modules/ext/libreoffice/program/python-core-3.3.0/lib/fractions.py | Python | lgpl-3.0 | 23,033 |
#!/usr/bin/env python
#
# Copyright 2008,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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 optio... | EttusResearch/gnuradio | gnuradio-runtime/examples/mp-sched/synthetic.py | Python | gpl-3.0 | 4,544 |
import json
from allauth.socialaccount.providers.oauth.client import OAuth
from allauth.socialaccount.providers.oauth.views import (OAuthAdapter,
OAuthLoginView,
OAuthCallbackView)
from .provider import T... | tejesh95/Zubio.in | zubio/allauth/socialaccount/providers/twitter/views.py | Python | mit | 1,493 |
# coding: utf-8
from __future__ import unicode_literals
import itertools
from .common import InfoExtractor
from ..utils import (
qualities,
compat_str,
parse_duration,
parse_iso8601,
str_to_int,
)
class GigaIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?giga\.de/(?:[^/]+/)*(?P<id>[^/]+... | spvkgn/youtube-dl | youtube_dl/extractor/giga.py | Python | unlicense | 3,820 |
# -*- coding: cp1252 -*-
# No part of the content of this file was derived from the works of David Giffin.
##
# <p>Copyright © 2005-2008 Stephen John Machin, Lingfo Pty Ltd</p>
# <p>This module is part of the xlrd package, which is released under a BSD-style licence.</p>
#
# <p>Provides function(s) for dealing with M... | qianqians/meter | xlrd/xldate.py | Python | lgpl-2.1 | 7,895 |
from django.db.backends.creation import NO_DB_ALIAS
from django.db.backends.postgresql_psycopg2.base import DatabaseWrapper as Psycopg2DatabaseWrapper
from django.contrib.gis.db.backends.postgis.creation import PostGISCreation
from django.contrib.gis.db.backends.postgis.introspection import PostGISIntrospection
from dj... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/base.py | Python | gpl-2.0 | 1,002 |
a = list(i for in range(100) if x % 3 == 0)
xs = a | asedunov/intellij-community | python/testData/refactoring/introduceVariable/noRedundantParenthesisAroundGeneratorExpression.after.py | Python | apache-2.0 | 50 |
"""
CherryPy implements a simple caching system as a pluggable Tool. This tool tries
to be an (in-process) HTTP/1.1-compliant cache. It's not quite there yet, but
it's probably good enough for most sites.
In general, GET responses are cached (along with selecting headers) and, if
another request arrives for the same r... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/cherrypy/cherrypy/lib/caching.py | Python | bsd-3-clause | 17,413 |
"""Low-level memory management tracking"""
VERBOSITY = 0 # TODO: use logging
class Bitmap(object):
"""Just a raw bitmap for reserving the pages"""
def __init__(self, size, verbosity):
self._size = size
self._bits = 0
self._verbosity = verbosity
self._bits_allocd = 0
def _m... | CyanogenMod/android_kernel_htc_flounder | scripts/tracing/dma-api/smmu.py | Python | gpl-2.0 | 7,013 |
from datetime import datetime, tzinfo
import pytz
from django.template import Library, Node, TemplateSyntaxError
from django.utils import timezone
register = Library()
# HACK: datetime instances cannot be assigned new attributes. Define a subclass
# in order to define new attributes in do_timezone().
class datetim... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/templatetags/tz.py | Python | mit | 5,400 |
#
# 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... | lhfei/spark-in-action | spark-3.x/src/main/python/mllib/pca_rowmatrix_example.py | Python | apache-2.0 | 1,712 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
| appknox/xysec_adb | xysec_adb/pylib/linker/__init__.py | Python | apache-2.0 | 163 |
import py
html = py.xml.html
class my(html):
"a custom style"
class body(html.body):
style = html.Style(font_size = "120%")
class h2(html.h2):
style = html.Style(background = "grey")
class p(html.p):
style = html.Style(font_weight="bold")
doc = my.html(
my.head(),
my.... | youtube/cobalt | third_party/web_platform_tests/tools/py/doc/example/genhtmlcss.py | Python | bsd-3-clause | 426 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import time
import re
import unittest
zncz_pocz = 'godz_pocz'
zncz_kon = 'godz_kon'
etkt_pocz = 'BEGIN:'
etkt_kon = 'END:'
znak_daty_pocz = 7
znak_daty_kon = 32
rozmiar_daty = 19
wzorcowa_data_pocz = 'BEGIN: 2012.12.29_13.01.23 END: 0000.00.00_00.00.00'
sama_wzorcowa_data =... | kwadrat/ipij_vim | rdzen_vim.py | Python | isc | 6,361 |
#!/usr/bin/env python
#
# Electrum - lightweight ParkByte client
# Copyright (C) 2014 Thomas Voegtlin
#
# 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 withou... | parkbyte/electrumparkbyte | gui/qt/qrwindow.py | Python | mit | 3,180 |
import codecs
import sys
import six
def read(filepath):
with codecs.open(filepath, 'r', 'utf8') as f:
content = f.read()
return content
def write(s):
if six.PY2:
s = s.encode('utf8')
s = '%s\n' % s
sys.stdout.write(s)
| numerodix/luna | luna/util.py | Python | mit | 259 |
#
# Copyright (c), 2016-2020, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@... | sissaschool/xmlschema | xmlschema/validators/wildcards.py | Python | mit | 37,107 |
import tak
from . import tps
import attr
import re
@attr.s
class PTN(object):
tags = attr.ib()
moves = attr.ib()
@classmethod
def parse(cls, text):
head, tail = text.split("\n\n", 1)
tags_ = re.findall(r'^\[(\w+) "([^"]+)"\]$', head, re.M)
tags = dict(tags_)
tail = re.sub(r'{[^}]+}', ' ', ... | nelhage/taktician | python/tak/ptn/ptn.py | Python | mit | 2,895 |
from flask import Flask
from flask_bootstrap import Bootstrap
from flask_moment import Moment
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_pagedown import PageDown
bootstrap = Bootstrap()
moment = Moment()
db = SQLAlchemy()
pagedown = PageDown()
login_manager = LoginManager(... | ukgovdatascience/classifyintentsapp | app/__init__.py | Python | mit | 1,824 |
from scoring_engine.engine.basic_check import BasicCheck, CHECKS_BIN_PATH
class RDPCheck(BasicCheck):
required_properties = []
CMD = CHECKS_BIN_PATH + '/rdp_check {0} {1} {2} {3}'
def command_format(self, properties):
account = self.get_random_account()
return (
account.userna... | pwnbus/scoring_engine | scoring_engine/checks/rdp.py | Python | mit | 410 |
# -*- coding: utf-8 -*-
#
# inventory/projects/api/views.py
#
"""
Project API Views
"""
__docformat__ = "restructuredtext en"
import logging
from decimal import Decimal
from django.contrib.auth import get_user_model
from rest_framework.generics import (
ListCreateAPIView, RetrieveUpdateDestroyAPIView, RetrieveUp... | cnobile2012/inventory | inventory/projects/api/views.py | Python | mit | 5,580 |
from json import loads
from re import search
from lxml import html
try:
from pyokc.errors import AuthenticationError, ProfileNotFoundError
except ImportError:
from errors import AuthenticationError, ProfileNotFoundError
CHAR_REPLACE = {
"′": "'",
'″': '"',
'“': '"',
'”': '"',
"’": "'",
... | tfmorris/pyokc | pyokc/helpers.py | Python | mit | 12,502 |
from flask import Flask, render_template, session, redirect, url_for, escape, request
from Model.Gateway.AuthenticationGateway import AuthenticationGateway
from Controller.API.ServerController import ServerController
from Controller.API.ChartController import ChartController
from Controller.API.DataController import Da... | darneymartin/ChartIT | src/View/Server.py | Python | mit | 2,318 |
# -*- coding: utf-8 -*-
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
from scrapy_redis.spiders import RedisCrawlSpider
class BaiduSpider(RedisCrawlSpider):
"""Spider that reads urls from redis queue (myspider:start_urls)."""
name = 'baidu'
redis_key = 'crawler:start_keywo... | scrapycloud/scrapy-cluster | crawler/crawler/spiders/baidu.py | Python | mit | 979 |
#!/usr/bin/python
from pygame import mixer
from threading import Timer
from random import randint
from xml.etree import ElementTree as XmlEt
import argparse
from utils import LOGGER
from sounds import SoundPool
# @brief constrain - constrains x to interval [mi, ma]
def constrain(x, mi, ma):
return min(ma, max(m... | Manewing/pyAmbient | pyambient.py | Python | mit | 7,575 |
# Copyright (c) 2013 MetaMetrics, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, d... | gilt/nova | nova/core/cfn_pyplates/options.py | Python | mit | 1,386 |
from bs4 import BeautifulSoup
import requests
import os
import re
import time
import dbm
import csv
import pandas as pd
def _count_words(s):
"""count the number of words in a paragraph
Args:
[String] s
Return:
[INT] number of words in the string
"""
return len(s.split(" "))
def get_page(url):
"""get the pag... | sfu-discourse-lab/SFU_Comment_Extractor | Source_Code/data_cleanup/repair_gnm_article_text.py | Python | mit | 1,779 |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class RegisterForm(UserCreationForm):
invitation = forms.CharField(max_length=8)
class Meta:
model = User
fields = ('username', 'password1', 'password2', 'invitation')
c... | AtenrevCode/scChat | users/forms.py | Python | mit | 542 |
from drongo.response import Response
import unittest
class TestResponse(unittest.TestCase):
def test_response(self):
resp = Response()
def start_response(status, headers):
pass # TODO: Add more checks here
resp.set_cookie('hello', 'world', domain='localhost', secure=True)
... | drongo-framework/drongo | tests/test_response.py | Python | mit | 978 |
from gomatic.go_cd_configurator import HostRestClient, GoCdConfigurator
from gomatic.gocd.agents import Agent
from gomatic.gocd.materials import GitMaterial, PipelineMaterial
from gomatic.gocd.pipelines import Tab, Job, Pipeline, PipelineGroup
from gomatic.gocd.tasks import FetchArtifactTask, ExecTask, RakeTask
from go... | jimarnold/gomatic | gomatic/__init__.py | Python | mit | 484 |
# mdx_journal (c) Ian Dennis Miller
from setuptools import setup
import os
import re
# from https://github.com/flask-admin/flask-admin/blob/master/setup.py
def fpath(name):
return os.path.join(os.path.dirname(__file__), name)
def read(fname):
return open(fpath(fname)).read()
file_text = read(fpath('mdx_j... | iandennismiller/mdx_journal | setup.py | Python | mit | 1,319 |
import argparse, collections, configparser, json, math, mysql.connector as sql, praw, os, requests, sys, time
from datetime import datetime
from pprint import pprint
from mysql.connector import errorcode
from requests import HTTPError
from requests import ConnectionError
from fcntl import flock, LOCK_EX, LOCK_NB
# Pri... | pmaconi/RedditGoggles | reddit-goggles.py | Python | mit | 11,792 |
__author__ = 'Sulantha'
| sulantha2006/Conversion | Python/RUSRandomForest/__init__.py | Python | mit | 24 |
import numpy as np
from pystella.rf import Band
from pystella.rf.rad_func import Flux2MagAB
from pystella.util.phys_var import phys
__author__ = 'bakl'
class Star:
def __init__(self, name, spec=None, is_flux_eq_luminosity=False):
"""Creates a Star with Spectrum instance. Required parameters: name."""
... | baklanovp/pystella | pystella/rf/star.py | Python | mit | 7,789 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rvagaming-django.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mosbasik/rvagaming-django | rvagaming-django/manage.py | Python | mit | 259 |
import platform
import socket
import sys
from mule_local.JobGeneration import *
from mule.JobPlatformResources import *
from . import JobPlatformAutodetect
import multiprocessing
# Underscore defines symbols to be private
_job_id = None
def _whoami(depth=1):
"""
String of function name to recycle code
... | schreiberx/sweet | mule/platforms/50_ppeixoto_usp_gnu/JobPlatform.py | Python | mit | 4,663 |
class Solution(object):
def wordBreak(self, s, wordDict):
"""
:type s: str
:type wordDict: List[str]
:rtype: List[str]
"""
if len(wordDict) < 1:
return []
n = len(s)
f = [[] for _ in range(n + 1)]
f[0] = True
for i in range... | foomango/leetcode | src/python/140_word_break_ii/solution.py | Python | mit | 1,461 |
from typing import Optional
from gear.cloud_config import get_azure_config, get_gcp_config, get_global_config
from hailtop.aiocloud import aioazure, aiogoogle
from hailtop.aiotools.fs import AsyncFS, AsyncFSFactory
def get_identity_client(credentials_file: Optional[str] = None):
if credentials_file is None:
... | hail-is/hail | gear/gear/clients.py | Python | mit | 1,942 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-06-02 15:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('boards', '0071_auto_20170530_1711'),
('recurrent_card... | diegojromerolopez/djanban | src/djanban/apps/recurrent_cards/migrations/0002_auto_20170602_1726.py | Python | mit | 2,903 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'openlc.views.home', name='home'),
# url(r'^blog/', include('blog.urls'))... | Gorgel/khd_projects | khd_projects/khd_projects/urls.py | Python | mit | 890 |
'''
Copyright 2013 Cosnita Radu Viorel
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute... | rcosnita/fantastico | fantastico/samples/simple_component/simple_urls.py | Python | mit | 1,965 |
#!/usr/bin/env python
#coding: utf-8
"""
https://leetcode.com/problems/spiral-matrix-ii/
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
"... | caoxudong/code_practice | leetcode/59_spiral_matrix_ii.py | Python | mit | 1,960 |
from __future__ import print_function
from __future__ import division
from builtins import input
import subprocess
from time import sleep
from pivotpi import *
try:
import wx
except ImportError:
raise ImportError,"The wxPython module is required to run this program"
total_servos = 8
horizontal_spacer = 20
v... | karan259/PivotPi | Software/Python/Control_Panel/pivot_control_with_sliders.py | Python | mit | 7,313 |
#!/usr/bin/env python3
# Copyright (c) 2016-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test Hierarchical Deterministic wallet function."""
import os
import shutil
from test_framework.test_... | qtumproject/qtum | test/functional/wallet_hd.py | Python | mit | 7,811 |
from django.db import models
from pygments.lexers import get_all_lexers
from pygments.styles import get_all_styles
LEXERS = [item for item in get_all_lexers() if item[1]]
LANGUAGE_CHOICES = sorted([(item[1][0], item[0]) for item in LEXERS])
STYLE_CHOICES = sorted((item, item) for item in get_all_styles())
class Snip... | caderache2014/django-rest-tutorial | tutorial/snippets/models.py | Python | mit | 819 |
# -*- coding: utf-8 -*-
from easy_karabiner.factory import *
def test_create_keymap():
raw_keymap = [
'KeyToKey',
['ctrl'],
['f12'],
]
k = KeymapCreater.create(raw_keymap)
s = '''
<autogen> __KeyToKey__
KeyCode::CONTROL_L,
KeyCode::F12
</... | loggerhead/Easy-Karabiner | tests/test_factory.py | Python | mit | 11,690 |
import discord
from discord.ext import commands
class Mycog:
"""My custom cog that does stuff!"""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def mycom(self):
"""This does stuff!"""
#Your code will go here
await self.bot.say("I can do stuff!")
d... | heartsdale/heartsdale-cogs | limin.py | Python | mit | 363 |
"""
Copyright (c) 2016 Keith Sterling
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute,... | dkamotsky/program-y | src/programy/parser/exceptions.py | Python | mit | 3,289 |
import asyncio
import json
import shlex
import subprocess
import time
import urllib.request
from unittest import mock
import pytest
from sanic_testing.testing import ASGI_PORT as PORT
from sanic.app import Sanic
from sanic.worker import GunicornWorker
@pytest.fixture(scope="module")
def gunicorn_worker():
com... | channelcat/sanic | tests/test_worker.py | Python | mit | 5,289 |
import os
from flask import Flask
from flask.ext.sqlalchemy import SQLAlchemy
import flask.ext.restless
app = Flask(__name__)
app.config.from_object('config')
#flask-sqlalchemy
db = SQLAlchemy(app)
from app import models, views
from app.models import Fact, Log
#API
manager = flask.ext.restless.APIManager(app, flask... | chelnak/BotStats | app/__init__.py | Python | mit | 466 |
#!/usr/bin/env python
from codetalker.pgm import Grammar
from codetalker.pgm.tokens import STRING, ID, NUMBER, WHITE, NEWLINE, IdToken
from codetalker.pgm.special import star
from codetalker.pgm.errors import TokenError
def start(rule): rule | ID
g1 = Grammar(start=start, tokens=[ID,WHITE], idchars='$')
def test_1(... | jaredly/codetalker | tests/tokenize/idchars.py | Python | mit | 737 |
#!/usr/bin/python3
from scrapers.scrape import scrape_page
# if you want to use this scraper without the RESTful api webservice then
# change this import: from scrape import scrape_page
import re
try:
import pandas as pd
pandasImported = True
except ImportError:
pandasImported = False
BASE_URL = "http://... | ajpotato214/Finance-Data-Scraper-API | finance_data_scraper/scrapers/finviz.py | Python | mit | 4,390 |
#!/usr/bin/python
import sys
if len(sys.argv) != 4:
print "USAGE: insert_cog_desc.py <desc_file> <in_cog> <out_cog>"
sys.exit(1)
descriptions = dict()
for line in open(sys.argv[1], 'rU'):
data = line.strip().split(' ', 2)
cog_id = data[1]
cog_abbrev = data[0][1:-1]
cog_descr = data[2]
descriptions[cog_id] = ... | fandemonium/code | tiedje-scripts/insert_cog_desc.py | Python | mit | 604 |
#coding:utf8
from flask.ext.sqlalchemy import SQLAlchemy
from . import app
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///relative/../../test.db'
db = SQLAlchemy(app)
| prikevs/PasteSite | paste/database.py | Python | mit | 173 |
from __future__ import unicode_literals
"""
Core HamlPy filters.
The implementation of these should match https://github.com/haml/haml/blob/master/lib/haml/filters.rb as closely as
possible. Where we differ is that we don't compile Stylus, Coffeescript etc into CSS or Javascript - but place the
content into suitable <... | Psycojoker/HamlPy | hamlpy/parser/filters.py | Python | mit | 5,088 |
NAMES = ["Agatha", "Bernard", "Lucy", "Russle", "April", "Sammy"]
| jl4ge/cs3240-labdemo | names.py | Python | mit | 67 |
from backend.components.base_component import BaseComponent
from backend.misc.sys_types import Et
class Element(BaseComponent):
table_name = "elements"
COL_MODULE_ID, COL_REG, = 3, 4,
column_headers_and_types = BaseComponent.column_headers_and_types + [['module_id', 'integer'], ['register', 'integer']]
... | dzon4xx/system | backend/components/element.py | Python | mit | 4,504 |
print "here we go" #comment comment comment
#more comments herei
print 'hi # there'
| sdwebster/learn-python-the-hard-way-solutions | 02/ex2.py | Python | mit | 84 |
"""
https://leetcode.com/problems/construct-the-rectangle/
https://leetcode.com/submissions/detail/107452214/
"""
import math
class Solution(object):
def constructRectangle(self, area):
"""
:type area: int
:rtype: List[int]
"""
W = int(math.sqrt(area))
while area ... | vivaxy/algorithms | python/problems/construct_the_rectangle.py | Python | mit | 598 |
import datetime
from pathlib import PosixPath as PythonPathClass
from subprocess import Popen as PythonPopenClass
# TODO: find a better value
END_OF_TIME = datetime.datetime(2100, 1, 1)
BEGINNING_OF_TIME = datetime.datetime(1970, 1, 1)
class BaseTask:
_indent_level = 0
silent = False
_child_tasks = []
... | rayene/buildall | buildall/core.py | Python | mit | 4,402 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djb.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| AVatch/django-rest-boilerplate | djb/manage.py | Python | mit | 246 |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
from django.utils.html import format_html
# Représente un type de liste : BDE, BDA, BDS...
# nom : nom du type
# deux_tours : booléen qui indique s'il y aura deux tours pour ce type de liste
class TypeListe(models.Mode... | mbahri/vote_ensimag | votes/models.py | Python | mit | 4,084 |
'''
Starts a channel on a queuemanager
MQWeb runs on localhost and is listening on port 8081.
'''
import json
import httplib
import socket
import argparse
parser = argparse.ArgumentParser(
description='MQWeb - Python sample - Start Channel',
epilog="For more information: http://www.mqweb.org"
)
parser.add_argument... | fbraem/mqweb | samples/python/channel_start.py | Python | mit | 1,189 |
# -*- coding: utf-8 -*-
from django.db import models
from appls.login.models import BaseUser
class Country(models.Model):
"""
Model for Country
"""
name = models.CharField(max_length=100, blank=False, default='default category')
class Meta:
ordering = ('name',)
class City(models.Mode... | pasha369/Points | points/appls/points/models/country.py | Python | mit | 561 |
import sublime
import sublime_plugin
import re
from xml.dom import minidom
try:
from Expression import expression
except ImportError as error:
sublime.error_message("Dependency import failed; please read readme for " +
"Method plugin for installation instructions; to disable this " +
"message remove this pl... | shagabutdinov/sublime-method | method.py | Python | mit | 6,962 |
import pandas as pd
from enviropy import Enviropy
def read_csv(fname):
df = pd.read_csv(fname)
return Enviropy(df) | jentjr/enviropy | enviropy/io/file.py | Python | mit | 123 |
from urlparse import urlparse
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from cabot.cabotapp.models import Service
from cabot.metricsapp.models import MetricsSourceBase, ElasticsearchStatusCheck, GrafanaInstance, GrafanaPanel
class TestM... | Affirm/cabot | cabot/metricsapp/tests/test_views.py | Python | mit | 4,754 |
# Copyright 2015 The Brotli Authors. All rights reserved.
#
# Distributed under MIT license.
# See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
import os
import sys
import platform
import re
import unittest
try:
from setuptools import Extension
from setuptools import setup
except:
... | sergey-dryabzhinsky/dedupsqlfs | lib-dynload/brotli/setup.py | Python | mit | 10,320 |
# Copyright (C) 2016, zordsdavini
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distri... | cortesi/qtile | libqtile/extension/dmenu.py | Python | mit | 7,038 |
# -*- coding: utf-8 -*-
import collections
import logging
import sys
import selenium.webdriver
from selenium.webdriver.support.ui import WebDriverWait
from . import exceptions
from . import filters
from . import flush_strategies
from . import producers
from . import record_factories
from . import scrapers
from . imp... | dnguyen0304/clare | clare/clare/application/room_list_watcher/factories.py | Python | mit | 6,716 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-26 12:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('marketplace', '0010_packageresource_recommended'),
]
operations = [
migrati... | MOOCworkbench/MOOCworkbench | marketplace/migrations/0011_auto_20170526_1215.py | Python | mit | 462 |
# =============================================================================
# Author: Teerapat Jenrungrot - https://github.com/mjenrungrot/
# FileName: 10433.py
# Description: UVa Online Judge - 10433
# =============================================================================
while True:... | mjenrungrot/competitive_programming | UVa Online Judge/v104/10433.py | Python | mit | 619 |
from turbodbc import connect, make_options, Megabytes
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
options = make_options(read_buffer_size=Megabytes(20),
autocommit=True)
conn = connect(dsn='drill', turbodbc_options=options)
sql = "select * from dfs.`/test.csv`"
cursor = conn.cursor()
... | ctownsen357/Dockerfiles | apache-drill/tst_turbo.py | Python | mit | 408 |
import os
import json
try:
import yaml
except ImportError:
yaml = None
def root():
''' Assuming that this function is in root.utils, returns the root directory
of the project. '''
path, _ = os.path.split(__file__)
return os.path.abspath(path)
def loadfile(filename, _format=None):
''' Lo... | kreativitea/RandomData | utils.py | Python | mit | 739 |
class Solution:
def compress(self, chars) -> int:
n = len(chars)
if n == 1:
return 1
l = r = 0
while r < n:
current = chars[r]
count = 0
while r < n and chars[r] == current:
r += 1
count += 1
... | civilian/competitive_programing | leetcode/4/443/best.py | Python | mit | 990 |