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 |
|---|---|---|---|---|---|
# -*-coding:utf-8-*-
# 标准库
import time
import sys
import codecs
import os
import json
import io
# 第三方库
import requests
from huzhifeng import dumpObj, hasKeys
from openpyxl import load_workbook
from openpyxl import Workbook
# Set default encoding to utf-8
reload(sys)
sys.setdefaultencoding('utf-8')
# requests.packages... | hitjackma/12306Spider | query.py | Python | gpl-3.0 | 11,179 |
#!/usr/bin/env python3
import os, sys
sys.path.append('../modules')
import numpy as np
import matplotlib.pyplot as plt
import raytracing as rt
import visualize as vis
import ray_utilities
if __name__ == '__main__':
# Create a spectrometer using a simple 4f system and diffraction grating
f = 50 ... | vishwa91/OptSys | examples/grating.py | Python | mit | 2,828 |
from django.contrib import admin
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.conf import settings
from django.contrib.auth import views as auth_views
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/login/$', auth_views.login, {'tem... | BaileySN/SheepGuard | SheepGuard/urls.py | Python | gpl-3.0 | 808 |
import matplotlib.pyplot as plt
plt.style.use('science')
def make_patch_spines_invisible(ax):
ax.set_frame_on(True)
ax.patch.set_visible(False)
for sp in ax.spines.values():
sp.set_visible(False)
fig, host = plt.subplots()
fig.subplots_adjust(right=0.75)
par1 = host.twinx()
par2 = host.twinx()
... | InnovArul/codesmart | computer_vision/paperplots/example.py | Python | gpl-2.0 | 1,602 |
import random
from zen.graph import Graph
from zen.digraph import DiGraph
from zen.exceptions import ZenException
__all__ = ['local_attachment']
def local_attachment(n, m, r, **kwargs):
"""
Generate a random graph using the local attachment model.
**Args**:
* ``n`` (int): the number of nodes to add to the g... | networkdynamics/zenlib | src/zen/generating/local.py | Python | bsd-3-clause | 2,686 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from textw... | jtrobec/pants | contrib/scrooge/tests/python/pants_test/contrib/scrooge/tasks/test_scrooge_gen.py | Python | apache-2.0 | 4,867 |
# 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-batch/azure/batch/models/cloud_job.py | Python | mit | 9,338 |
class Solution:
# @return a boolean
def isInterleave(self, s1, s2, s3):
if len(s1) + len(s2) != len(s3):
return False
opt = [[False for i in xrange(len(s2)+1)] for i in xrange(len(s1)+1)]
opt[0][0] = True
for i in xrange(1, len(s1)+1):
op... | lsingal/leetcode | python/dynamic_programming/InterleavingString.py | Python | mit | 1,501 |
import _plotly_utils.basevalidators
class SizerefValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="sizeref", parent_name="scatterpolar.marker", **kwargs
):
super(SizerefValidator, self).__init__(
plotly_name=plotly_name,
parent_na... | plotly/python-api | packages/python/plotly/plotly/validators/scatterpolar/marker/_sizeref.py | Python | mit | 468 |
from datetime import datetime, time
from hashlib import md5
class CrawlUtils(object):
def __init__(self):
super(CrawlUtils, self).__init__()
@classmethod
def get_guid(self, _url):
"""Generates an unique identifier for a given item."""
# hash based solely in the url field
... | trujunzhang/djzhang-targets | cwitune/cwitune/utils/crawl_utils.py | Python | mit | 349 |
#! /usr/bin/env python
# Solving a 9x9 Sudoku puzzle (54 numbers missing).
#
# Copyright (C) 2013 Efstathios Chatzikyriakidis <contact@efxa.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Sof... | rfribeiro/sudoku-ga | examples/ga/example-6.py | Python | gpl-3.0 | 1,499 |
# -*- coding: utf-8 -*-
# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#
# weboob 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... | laurent-george/weboob | modules/marmiton/browser.py | Python | agpl-3.0 | 1,560 |
# -*- coding: utf-8 -*-mode
import numpy as np
import sys
from scipy.optimize import fmin_bfgs
class logisticRegression:
def __init__(self):
# do nothing particularly
pass
def fit(self,data,label):
# data is to be given in a two dimensional numpy array (nData,nVariables)
# label is to be given in an one d... | kyoheiotsuka/logisticRegression | logisticRegression.py | Python | mit | 2,207 |
# Copyright (c) 2016, German Neuroinformatics Node (G-Node)
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of the Project.
from __future__ import (absolute_import, division,... | stoewer/nixpy | nixio/pycore/util/names.py | Python | bsd-3-clause | 967 |
from __future__ import with_statement
import datetime
import os
import unittest
from datafeed.exchange import *
from datafeed.providers.yahoo import *
class YahooSecurityTest(unittest.TestCase):
def test_abbr_sha(self):
s = YahooSecurity(SH(), '600028')
self.assertEqual(s._abbr, 'SS')
def ... | yinhm/datafeed | datafeed/providers/tests/test_yahoo.py | Python | apache-2.0 | 6,087 |
#!/usr/bin/env python2
# transpiled with BefunCompile v1.3.0 (c) 2017
import sys
import zlib, base64
_g = ("AR+LCAAAAAAABACVjr0OgzAMhF8lUsriiGID4ecURX2QCMasnjLx8A2dWqoO9XLW2b7PxfxRUcCsQhDWntCzDoSBdSSMrJ5Q3paLivBNeQWtygtoUZ5Bs/IEmpR9+Mov"
+ "e7G/6Wgl1EwT4sp5pghwivDeNZxTlQ627NHZkGDD7trjPHKvv4f2fnuYA53zPmVuqsB88CNE8nZ2... | Mikescher/Project-Euler_Befunge | compiled/Python2/Euler_Problem-034.py | Python | mit | 2,461 |
from django.db import models
# Create your models here.
class Poll(models.Model):
name = models.CharField(max_length=255, verbose_name="Poll Name!!", help_text="It's the name. OF YOUR POLL!")
int_field = models.IntegerField(help_text="For no reason an int field, put a number in it!")
| pombredanne/django-rest-angular | polls/models.py | Python | gpl-3.0 | 294 |
"""The tests for the MQTT discovery."""
from pathlib import Path
import re
from unittest.mock import AsyncMock, patch
import pytest
from homeassistant import config_entries
from homeassistant.components import mqtt
from homeassistant.components.mqtt.abbreviations import (
ABBREVIATIONS,
DEVICE_ABBREVIATIONS,
... | jawilson/home-assistant | tests/components/mqtt/test_discovery.py | Python | apache-2.0 | 34,443 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | karllessard/tensorflow | tensorflow/python/saved_model/nested_structure_coder.py | Python | apache-2.0 | 17,543 |
#!/usr/bin/env python
import unittest
from markdown_to_pdf import *
def local_link_callback(link, markdown_filepath):
if link[0] == '#':
return '#parsed-local-link'
else:
return '#parsed-remote-link'
class TestMarkdownToPdf( unittest.TestCase ):
def test_is_a_markdown_header(self):
... | Fiware/tools.Md2pdf | markdown_to_pdf/test_markdown_to_pdf.py | Python | mit | 13,579 |
# -*- coding: cp1252 -*-
'''
FizzBuzz.py
* Para a sequência de números de 1 até 100
* imprimir os números em ordem crescente substituindo
* múltiplos de 3 por Fizz, múltiplos de 5 por Buzz
* e múltiplos de 3 e 5 por FizzBuzz
* Entrada: nenhuma
* Saída: FizzBuzz
*
* Autor: Fabrício Olivetti de França
* Discipl... | folivetti/PI-UFABC | AULA_03/Python/FizzBuzz.py | Python | mit | 560 |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | IsCoolEntertainment/debpkg_libcloud | libcloud/loadbalancer/drivers/cloudstack.py | Python | apache-2.0 | 6,048 |
from django.shortcuts import render
from django.shortcuts import resolve_url
from django.shortcuts import get_object_or_404
from django.contrib import messages
from django.core.urlresolvers import reverse_lazy
from django.views.generic import FormView
from django.views.generic.detail import SingleObjectMixin
from .for... | usa-mimi/tutorial | tutorial/polls/views.py | Python | mit | 1,765 |
# Copyright (C) 2018 Philipp Hörist <philipp AT hoerist.com>
#
# This file is part of nbxmpp.
#
# 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 opt... | gajim/python-nbxmpp | nbxmpp/modules/eme.py | Python | gpl-3.0 | 1,740 |
#!/usr/bin/env python
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list ... | EpicCM/SPH-D700-Kernel | external/webkit/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium_mac.py | Python | gpl-2.0 | 6,074 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('head', '0003_remove_doner_contact_number'),
]
operations = [
migrations.CreateModel(
name='Organization',
... | ayys/bloodData | head/migrations/0004_auto_20150417_1248.py | Python | gpl-3.0 | 820 |
"""Interface for all the algorithms in MSAF."""
import numpy as np
import msaf.utils as U
class SegmenterInterface:
"""This class is an interface for all the segmenter algorithms included
in MSAF. These segmenters must inherit from it and implement one of the
following methods:
processFlat()
... | urinieto/msaf | msaf/algorithms/interface.py | Python | mit | 5,024 |
# -*- coding: utf-8 -*-
from __future__ import print_function
| kentfrazier/Exhibitionist | exhibitionist/util/__init__.py | Python | bsd-3-clause | 62 |
from django.contrib import admin
from .models import Hub
admin.site.register(Hub)
| iver56/useat-api | hub/admin.py | Python | mit | 83 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use t... | AlexOugh/horizon | openstack_dashboard/api/keystone.py | Python | apache-2.0 | 26,092 |
#要注意 javascript 轉 python 語法差異
#document.getElementById -> doc[]
#module Math -> math
#Math.PI -> math.pi
#abs -> fabs
#array 可用 list代替
import math
import time
from browser import doc
import browser.timer
# 點類別
class Point(object):
# 起始方法
def __init__(self, x, y):
self.x = x
self.y = y
... | 2014c2g5/2014cadp | wsgi/local_data/brython_programs/brython_fourbar1.py | Python | gpl-3.0 | 11,960 |
#!/usr/bin/env python2
"""
Convert genbank to multifasta of proteins.
USAGE:
cat file.gb | gb2protein.py > file.faa
NOTE:
It's designed to work with gb files coming from GenBank. gene is used as gene_id and transcript_id (locus_tag if gene not present).
Only entries having types in allowedTypes = ['gene','CDS','tRNA'... | lpryszcz/bin | gb2protein.py | Python | gpl-3.0 | 2,381 |
from gym import core
class ArgumentEnv(core.Env):
calls = 0
def __init__(self, arg):
self.calls += 1
self.arg = arg
def test_env_instantiation():
# This looks like a pretty trivial, but given our usage of
# __new__, it's worth having.
env = ArgumentEnv('arg')
assert env.arg ==... | xpharry/Udacity-DLFoudation | tutorials/reinforcement/gym/gym/tests/test_core.py | Python | mit | 353 |
#!/usr/bin/env python
import os
def get_project_root_path():
try:
project_path = os.environ['ICE_HOME']
except:
project_path = os.path.split(os.path.abspath(os.path.dirname(__file__)))[0]
return project_path
def get_area_filepath():
project_path = get_project_root_path()
area_file... | mitkin/avhrr-sic-analysis | satistjenesten/utils.py | Python | mit | 392 |
# ===================================================================
#
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributio... | Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/Cryptodome/Cipher/_mode_cbc.py | Python | gpl-2.0 | 8,915 |
"""
05-complex-sequences.py - Exploring generators that sequence values.
This example explores two more generators that sequence values.
**EventSlide** ::
EventSlide(values, segment, step, startpos=0, wraparound=True,
occurrences=inf, stopEventsWhenDone=True)
EventSlide plays sub-melodies of leng... | belangeo/pyo | pyo/examples/22-events/05-complex-sequences.py | Python | lgpl-3.0 | 1,878 |
from Bio import SeqIO
import re
def extract(fasta, chrom, start = None, end = None):
''' Function to extract sequence from a FASTA file which is then
returned as a string. Function takes four arguments:
1) fasta - Input fasta file.
2) chrom - Chromosome name.
3) start - First base of sequen... | adam-rabinowitz/ngs_analysis | fasta/faProcess.py | Python | gpl-2.0 | 2,749 |
import theano
from theano import tensor as T
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
import numpy as np
from load import mnist
srng = RandomStreams()
def floatX(X):
return np.asarray(X, dtype=theano.config.floatX)
def init_weights(shape):
return theano.shared(floatX(np.random.ra... | escherba/Theano-Tutorials | 4_modern_net.py | Python | mit | 2,247 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('official_account', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Response',
fields... | doraemonext/wechat-platform | wechat_platform/system/response/migrations/0001_initial.py | Python | bsd-2-clause | 2,392 |
# -*- coding:utf-8 -*-
#
#
# Copyright (C) 2015 Clear ICT Solutions <info@clearict.com>.
# All Rights Reserved.
#
# 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 ver... | Clear-ICT/odoo-addons | fleet_engine_number/models/fleet.py | Python | agpl-3.0 | 978 |
from django.db import models
class MonthlyWeatherByCity(models.Model):
month = models.IntegerField()
boston_temp = models.DecimalField(max_digits=5, decimal_places=1)
houston_temp = models.DecimalField(max_digits=5, decimal_places=1)
new_york_temp = models.DecimalField(max_digits=5, decimal_places=1)
... | pgollakota/django-chartit | demoproject/demoproject/models.py | Python | bsd-2-clause | 2,689 |
"""
This code was originally published by the following individuals for use with
Scilab:
Copyright (C) 2012 - 2013 - Michael Baudin
Copyright (C) 2012 - Maria Christopoulou
Copyright (C) 2010 - 2011 - INRIA - Michael Baudin
Copyright (C) 2009 - Yann Collette
Copyright (C) 2009 - CEA - Jean-Ma... | idaholab/raven | framework/contrib/pyDOE/doe_factorial.py | Python | apache-2.0 | 7,243 |
from .mpdserializer import CommandError
assert CommandError
from .mpdserializer import ConnectionError
assert ConnectionError
from .mpdserializer import MPDError
assert MPDError
from .mpdserializer import ProtocolError
assert ProtocolError
from .mpdserializer import deserialize_hello
assert deserialize_hello
from ... | duganchen/qmpdsocket | qmpdsocket/mpdserializer/__init__.py | Python | mit | 671 |
# encoding: utf-8
u'''MCL — Organ Folder'''
from ._base import IIngestableFolder, Ingestor, IngestableFolderView
from .interfaces import IOrgan
from five import grok
class IOrganFolder(IIngestableFolder):
u'''Folder containing body systems, also known as organs.'''
class OrganIngestor(Ingestor):
u'''RDF i... | MCLConsortium/mcl-site | src/jpl.mcl.site.knowledge/src/jpl/mcl/site/knowledge/organfolder.py | Python | apache-2.0 | 544 |
# модули брать тут https://pypi.python.org/pypi/
import os, sys, json
import test_ext
def f():
return test_ext.fext()
#print (test_ext.x)
f() | a-langer/lo_report | rununo/test.py | Python | apache-2.0 | 171 |
def extractNewbietranslatorsWordpressCom(item):
'''
Parser for 'newbietranslators.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Monster Factory', 'Monster Factory', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNewbietranslatorsWordpressCom.py | Python | bsd-3-clause | 654 |
"""
tests for dnstest_checks.py check_renamed_name() and verify_renamed_name()
The latest version of this package is available at:
<https://github.com/jantman/pydnstest>
##################################################################################
Copyright 2013-2017 Jason Antman <jason@jasonantman.com>
This... | jantman/pydnstest | pydnstest/tests/dnstest_check_rename_test.py | Python | agpl-3.0 | 16,335 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Quantization'] , ['LinearTrend'] , ['Seasonal_MonthOfYear'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Quantization/model_control_one_enabled_Quantization_LinearTrend_Seasonal_MonthOfYear_SVR.py | Python | bsd-3-clause | 168 |
import sys
from SpaceDock.config import _cfg, _cfgi
from SpaceDock.database import db, init_db
from SpaceDock.objects import User
from SpaceDock.email import send_confirmation
init_db()
if sys.argv[1] == 'delete_user':
user = User.query.filter(User.username == sys.argv[2]).first()
if not user:
... | EIREXE/SpaceDock | admin.py | Python | mit | 459 |
#!/usr/bin/python3
import argparse
import code
import readline
import signal
import sys
from parse import Argparser, premain, SigHandler_SIGINT,PythonInterpreter
from utils import ParseFlags
def getWASMModule():
module_path = sys.argv[1]
interpreter = PythonInterpreter()
module = interpreter.parse(module_... | bloodstalker/mutator | bruiser/wasm/dwasm.py | Python | gpl-3.0 | 855 |
"""
This module contains celery task functions for handling the sending of bulk email
to a course.
"""
import re
import random
import json
from time import sleep
from dogapi import dog_stats_api
from smtplib import SMTPServerDisconnected, SMTPDataError, SMTPConnectError, SMTPException
from boto.ses.exceptions import (... | pku9104038/edx-platform | lms/djangoapps/bulk_email/tasks.py | Python | agpl-3.0 | 33,371 |
from guess_language import guess_language
from FilterHelper import removeLinks
class LanguageFilter:
def __init__(self, language):
"""The language should be a ISO 639-1 code of a language supported by https://bitbucket.org/spirit/guess_language"""
self.language = language
def filterTweet(self, data):
return g... | JoelHoskin/CatHack | LanguageFilter.py | Python | mit | 378 |
# -*- coding: utf-8 -*-
"""
这是一个用以获取用户豆瓣数据的爬虫,使得用户可以进行数据的本地备份。
支持:
1.豆瓣电影,豆瓣读书【暂不支持】
2.csv文件为逗号分割符文件。
@author: DannyVim
"""
import urllib2 as ur
from bs4 import BeautifulSoup as bs
import sys
import time
reload(sys)
sys.setdefaultencoding('utf8')
# BASE URL
def basepage(wa):
m_wish = 'http://movie.douban.com/p... | DannyVim/ToolsCollection | Outdated/db_movie.py | Python | gpl-2.0 | 2,485 |
import RPi.GPIO as GPIO
import time
import numpy as np
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
red_led = 17 # LED is in GPIO 4
yellow_led = 27 # Yello LED is in GPIO 27
green_led = 22 # Green LED is in GPIO 22
red_button = 14 # Red Button is in GPIO 14
yellow_button = 15 # Yellow Button is in GPIO 15
green_bu... | lizhuoli1126/MarkdownScript | Raspberry Pi/reaction.py | Python | mit | 4,439 |
#!/usr/bin/python
import ansible.runner
import ansible.playbook
import ansible.inventory
from ansible import callbacks
from ansible import utils
import json
# the fastest way to set up the inventory
# hosts list
hosts = ["127.0.0.1"]
# set up the inventory, if no group is defined then 'all' group is used by default
e... | oriolrius/programming-ansible-basics | test_modules.py | Python | mit | 798 |
# -*- coding: utf-8 -*-
"""
flask_konch
~~~~~~~~~~~
An improved shell commmand for the Flask CLI.
:copyright: (c) 2017 by Steven Loria
:license: MIT, see LICENSE for more details.
"""
__version__ = '1.2.0.post0'
__author__ = 'Steven Loria'
__license__ = 'MIT'
__all__ = [
'EXTENSION_NAME',
]
... | sbhtw/flask-konch | flask_konch/__init__.py | Python | mit | 351 |
import os
import sys
from flask import Flask, Response
from flask.ext.cors import CORS
from google.protobuf.descriptor_pb2 import FileDescriptorSet
from google.protobuf.json_format import MessageToJson
base_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
path = os.path.join(base_path, 'pb')
sys.... | opendoor-labs/pilgrim3 | pilgrim3/app.py | Python | mit | 1,402 |
# Copyright 2017 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | jdubs/cloud-custodian | tools/c7n_traildb/trailes.py | Python | apache-2.0 | 9,204 |
from common import pack
class Decimator:
def __init__(self, L_b, D=1):
assert L_b % D == 0, (
'Decimation block length must be a multiple of the dec. factor')
self._D = D
self._pkr = pack.Packer(L_b)
def push(self, x):
packed = self._pkr.push(x)
if packed ... | cuauv/software | hydrocode/modules/pinger/decimate.py | Python | bsd-3-clause | 395 |
# This file is part of Pebble.
# Pebble 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 of the License, or (at your option) any later version.
# Pebble is distributed in the hope th... | villind/pebble | pebble/functions.py | Python | lgpl-3.0 | 5,408 |
"""
This module will send messages to the facebook servers which in turn will send those messages to the user whom's user
is passed.
Messages can pe pure text based or be other types like images,videos,location and some special ones from Facebook i.e
Templates
"""
import os
from .exception import raise_error, QuickRep... | hundredeir/Facebook_PyBot | Facebook/send.py | Python | lgpl-3.0 | 13,018 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... | BorgERP/borg-erp-6of3 | verticals/hotel61/hotel/wizard/hotel_wizard.py | Python | agpl-3.0 | 1,725 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('movielists', '0017_auto_20150412_1342'),
]
operations = [
migrations.CreateModel(
name='Comment',
fi... | kiriakosv/movie-recommendator | moviesite/movielists/migrations/0018_comment.py | Python | mit | 775 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | lib/spack/spack/compilers/nag.py | Python | lgpl-2.1 | 2,901 |
from molly.conf.provider import Provider
class BaseGeolocationProvider(Provider):
def reverse_geocode(self, lon, lat):
return []
def geocode(self, query):
return []
from cloudmade import CloudmadeGeolocationProvider
from places import PlacesGeolocationProvider
| mollyproject/mollyproject | molly/geolocation/providers/__init__.py | Python | apache-2.0 | 308 |
from django.db import models
class PeriodCancellation(models.Model):
name = models.CharField(max_length=50, blank=True, null=True)
name.help_text = "Recommended. Makes identifying the cancellation easier. E.g. Monday after Easter"
period = models.ForeignKey('Period', related_name='cancellations', on_delet... | gitsimon/tq_website | courses/models/period_cancellation.py | Python | gpl-2.0 | 590 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import posixpa... | sharad/calibre | src/calibre/gui2/dnd.py | Python | gpl-3.0 | 11,090 |
#!/usr/bin/python
#
# Copyright (c) 2009 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of ... | weizhenwei/leetcode | tools/cpplint.py | Python | bsd-3-clause | 235,110 |
from django.db import models
from muddery.worlddata import model_base
# ------------------------------------------------------------
#
# game's basic settings
#
# ------------------------------------------------------------
class game_settings(model_base.game_settings):
"""
Game's basic settings.
"""
... | MarsZone/DreamLand | muddery/game_template/worlddata/models.py | Python | bsd-3-clause | 12,624 |
# postgresql/pypostgresql.py
# Copyright (C) 2005-2013 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
"""Support for the PostgreSQL database via py-postgresql.
Connecting
-----... | coolbombom/CouchPotatoServer | libs/sqlalchemy/dialects/postgresql/pypostgresql.py | Python | gpl-3.0 | 2,155 |
# 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-cdn/azure/mgmt/cdn/models/purge_parameters.py | Python | mit | 1,055 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('browser', '0037_auto_20170222_1847'),
]
operations = [
#migrations.AddField(
# model_name='compare',
# ... | MRCIEU/melodi | browser/migrations/0038_auto_20170222_1851.py | Python | mit | 1,491 |
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe':{'bundle_files':1, 'includes':["sip"]}},
windows = [{'script': "AlarmSetup.py"}],
license="MIT",
package_data={"AlarmClock": ["Resources/bell.png"]},
zipfile = None,
)
| amjith/PyAlarmTimer | setup_win.py | Python | mit | 317 |
from django.apps import AppConfig
class HealthApp(AppConfig):
name = "normandy.health"
label = "health"
verbose_name = "Normandy Health"
def ready(self):
# Import for side-effect: registers signal handler
import normandy.health.signals # NOQA
| mozilla/normandy | normandy/health/apps.py | Python | mpl-2.0 | 279 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
from data_setup import run_rpmdeplint
def test_prints_usage_when_no_... | default-to-open/rpmdeplint | acceptance_tests/test_usage.py | Python | gpl-2.0 | 958 |
from __future__ import unicode_literals
from typing import NoReturn, Text, Any, List
import logging
import collections
import uuid
from vstutils.utils import raise_context, ModelHandlers
from .base import BModel, BQuerySet, models
logger = logging.getLogger('polemarch')
class HookHandlers(ModelHandlers):
when_t... | vstconsulting/polemarch | polemarch/main/models/hooks.py | Python | agpl-3.0 | 2,474 |
# -*- coding: utf-8 -*-
#
# 2016-04-08 Cornelius Kölbel <cornelius@privacyidea.org>
# Avoid consecutive if-statements
# 2015-02-25 Cornelius Kölbel <cornelius@privacyidea.org>
# Initial writup
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU... | wheldom01/privacyidea | privacyidea/lib/machines/hosts.py | Python | agpl-3.0 | 5,767 |
#!/usr/bin/env sage -python
import sys
from sage.all import *
if len(sys.argv) != 2:
print "Usage: %s <n>"%sys.argv[0]
print "Outputs the prime factorization of n."
sys.exit(1)
print factor(sage_eval(sys.argv[1]))
| ctorney/socialInfluence | test.py | Python | mit | 231 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2014 Lukáš Lalinský
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License... | antlarr/picard | picard/oauth.py | Python | gpl-2.0 | 9,132 |
# -*- coding: utf-8 -*-
#
# This file is part of NINJA-IDE (http://ninja-ide.org).
#
# NINJA-IDE 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
# any later version.
#
# NIN... | ninja-ide/ninja-ide | ninja_ide/gui/notification.py | Python | gpl-3.0 | 3,469 |
"""
Test scenarios for the crowdsource hinter xblock.
"""
import json
import unittest
from nose.plugins.attrib import attr
from django.core.urlresolvers import reverse
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFacto... | Learningtribes/edx-platform | openedx/tests/xblock_integration/test_crowdsource_hinter.py | Python | agpl-3.0 | 12,130 |
import datetime
import random
from colour import Color
from cue_csgo.helpers import color_gradient
class BaseRender(object):
require_color_info = False
def __init__(self, keyboard, settings, require_color_info=None):
self.keyboard = keyboard
self.settings = settings
if require_color_... | Fire-Proof/cue-csgo | cue_csgo/renders.py | Python | mit | 8,100 |
# Inspired from http://stackoverflow.com/a/8759188/817766
from threading import currentThread
from meteography.dataset import DataSet
_request_cache = {}
_installed_middleware = False
def get_dataset_cache():
assert _installed_middleware, 'RequestCacheMiddleware not loaded'
return _request_cache[currentThr... | rthouvenin/meteography | meteography/django/broadcaster/request_cache.py | Python | mit | 1,339 |
# Copyright (c) 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | tellesnobrega/sahara | sahara/service/validations/shares.py | Python | apache-2.0 | 2,431 |
# loops through all fields in a shp/dbf and outputs moran's I, z-score, and p-value of each to a csv table
import os
import pysal
import csv
import time
import numpy as np
from osgeo import ogr
begin_time = time.clock()
#open shp
shp = "PATH.shp"
#gdal layer reader
driver = ogr.GetDriverByName('ESRI Shapefile')
dat... | jamaps/open_geo_scripts | morans_I.py | Python | mit | 1,544 |
from __future__ import unicode_literals
import json
import logging
import requests
from requests.exceptions import HTTPError
from requests_hawk import HawkAuth
# The Python client release process is documented here:
# https://treeherder.readthedocs.io/common_tasks.html#releasing-a-new-version-of-the-python-client
__... | tojon/treeherder | treeherder/client/thclient/client.py | Python | mpl-2.0 | 24,194 |
#
# 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... | maropu/spark | python/pyspark/pandas/utils.py | Python | apache-2.0 | 33,908 |
import datetime
import decimal
import itertools
import re
import time
import urllib2
import uuid
import warnings
from operator import itemgetter
try:
import dateutil
except ImportError:
dateutil = None
else:
import dateutil.parser
import pymongo
import gridfs
from bson import Binary, DBRef, SON, ObjectId
... | starsirius/mongoengine | mongoengine/fields.py | Python | mit | 66,293 |
import os
import pickle
from studio import fs_tracker
def clientFunction(args, files):
print('client function call with args ' +
str(args) + ' and files ' + str(files))
modelfile = 'model.dat'
filename = files.get('model') or \
os.path.join(fs_tracker.get_artifact('modeldir'), modelfile... | studioml/studio | studio/completion_service/completion_service_testfunc_saveload.py | Python | apache-2.0 | 734 |
#!/usr/bin/env python
"""
Util to count which clients are most used.
Example usage:
utils/source.py tweets.jsonl > sources.html
"""
import json
import fileinput
from collections import defaultdict
summary = defaultdict(int)
for line in fileinput.input():
tweet = json.loads(line)
source = tweet["source"]
... | DocNow/twarc | utils/source.py | Python | mit | 1,412 |
#!/usr/bin/env python
"""
Django administration utility.
"""
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "credentials.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| edx/credentials | manage.py | Python | agpl-3.0 | 301 |
# -*- coding: utf-8 -*-
# Copyright © 2016 Manuel Kaufmann
# 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, mod... | getnikola/plugins | v7/meta_template/meta_template.py | Python | mit | 2,442 |
"""
This is Victor Stinner's pure-Python implementation of PEP 383: the "surrogateescape" error
handler of Python 3.
Source: misc/python/surrogateescape.py in https://bitbucket.org/haypo/misc
"""
# This code is released under the Python license and the BSD 2-clause license
import codecs
import sys
from future impor... | thonkify/thonkify | src/lib/future/utils/surrogateescape.py | Python | mit | 6,133 |
#!/usr/bin/env python
from sys import argv
from argparse import ArgumentParser
from collections import OrderedDict
from shutil import which
from subprocess import check_output, PIPE
from yaml import load, dump
arg_rules = OrderedDict([
(("-f", "--freeze-conda"), {
"help": "Write Conda and Pip configs separ... | LankyCyril/Snakeknot | snakecharmer/__main__.py | Python | mit | 2,501 |
from __future__ import absolute_import
from sfepy.linalg import norm_l2_along_axis
from examples.quantum.quantum_common import common
def fun_v(ts, coor, mode=None, **kwargs):
if not mode == 'qp': return
out = {}
C = 0.5
val = C * norm_l2_along_axis(coor, axis=1, squared=True)
val.shape = (val.s... | lokik/sfepy | examples/quantum/oscillator.py | Python | bsd-3-clause | 461 |
#!/usr/bin/env python
"""
Written by nickcooper-zhangtonghao
Github: https://github.com/nickcooper-zhangtonghao
Email: nickcooper-zhangtonghao@opencloud.tech
Note: Example code For testing purposes only
This code has been released under the terms of the Apache-2.0 license
http://opensource.org/licenses/Apache-2.0
"""... | pathcl/pyvmomi-community-samples | samples/add_nic_to_vm.py | Python | apache-2.0 | 5,081 |
#!/usr/bin/env python3
# Simplified from Python Cookbook
def flatten(items):
'''Flattens nested lists.'''
for x in items:
if isinstance(x, list):
yield from flatten(x)
else:
yield x
k = int(input('Block size: ').strip())
print('Enter a list of numbers separated by spac... | spaceporn/dailyprogrammer-challenges | easy/014/014.py | Python | mit | 507 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | var/spack/repos/builtin/packages/cbtf-lanl/package.py | Python | lgpl-2.1 | 3,486 |
# 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.
"""Provides a work around for various adb commands on android gce instances.
Some adb commands don't work well when the device is a cloud vm, namely
'push' ... | js0701/chromium-crosswalk | build/android/devil/android/sdk/gce_adb_wrapper.py | Python | bsd-3-clause | 4,853 |
# Copyright 2018 OpenStack Fundation
#
# 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 o... | openstack/networking-bgpvpn | networking_bgpvpn/neutron/db/migration/alembic_migrations/versions/rocky/expand/7a9482036ecd_add_standard_attributes.py | Python | apache-2.0 | 1,167 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.