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 |
|---|---|---|---|---|---|
VERSION = (0, 1, 0, 'dev', 1)
| avelino/django-tags | tags/__init__.py | Python | mit | 30 |
#!/usr/bin/env python
#
# testing for Simulator
#
# Bo Peng (bpeng@rice.edu)
#
# $LastChangedRevision$
# $LastChangedDate$
#
import unittest, os, sys
from simuOpt import setOptions
setOptions(quiet=True)
new_argv = []
for arg in sys.argv:
if arg in ['short', 'long', 'binary', 'mutant', 'lineage']:
setOptio... | BoPeng/simuPOP | test/test_04_simulator.py | Python | gpl-2.0 | 7,539 |
from collections import Counter
import pickle
import argparse
def create_pq():
return []
def add_last(pq, c):
pq.append(c)
def root(pq):
return 0
def set_root(pq, c):
if len(pq) != 0:
pq[0] = c
def get_data(pq, p):
return pq[p]
def children(pq, p):
if 2*p + 2 < len(pq):
re... | louridas/rwa | content/notebooks/huffman.py | Python | bsd-2-clause | 6,690 |
from flask import Flask, jsonify, request
from dbFuncs import db, User
app = Flask(__name__)
@app.route("/foo/<bar>", methods=['POST'])
def bar(bar):
return jsonify({"success": True})
@app.route("/users/add", methods=['POST'])
def add_users():
username = request.args.get('username', '')
email = request.... | frankcash/Misc | FlaskExamples/Example4/index.py | Python | mit | 628 |
import warnings
from ... import features
from .ancillary_feature import AncillaryFeature
def compute_emodulus_legacy(mm):
"""This is how it was done in Shape-Out 1"""
calccfg = mm.config["calculation"]
deprecation_check_model_lut(calccfg)
lut_identifier = calccfg["emodulus lut"]
medium = calccfg[... | ZellMechanik-Dresden/dclab | dclab/rtdc_dataset/feat_anc_core/af_emodulus.py | Python | gpl-2.0 | 10,014 |
from setuptools import setup, find_packages
XMODULES = [
"book = xmodule.backcompat_module:TranslateCustomTagDescriptor",
"chapter = xmodule.seq_module:SequenceDescriptor",
"conditional = xmodule.conditional_module:ConditionalDescriptor",
"course = xmodule.course_module:CourseDescriptor",
"customta... | franosincic/edx-platform | common/lib/xmodule/setup.py | Python | agpl-3.0 | 3,291 |
from . import orbit, mergers, bhacc_hist, hosts
from .util import *
def writebhmark(simname, step, Name=None, iord=False, massrange=False):
if not Name:
f = open('BH.' + step + '.mark', 'w')
else:
f = open(Name, 'w')
s = pynbody.load(simname + '.' + step)
f.write(str(len(s)) + ' ' + st... | mtremmel/Simpy | Simpy/BlackHoles/__init__.py | Python | gpl-2.0 | 1,783 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3_generated_test_cases_create_test_case_sync.py | Python | apache-2.0 | 1,589 |
# -*- coding: utf-8 -*-
#
# Build configuration file, created by
# sphinx-quickstart on Mon Dec 29 15:52:13 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration value... | ringing-lib/ringing-lib-python | docs/source/conf.py | Python | gpl-3.0 | 8,777 |
# ./application.py
from flask import Flask, jsonify, make_response, request, session, redirect
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.tools import argparser
import isodate
import string
import random
import requests
import base64
import os
import urllib
import ba... | achang97/YouTunes | application.py | Python | mit | 15,630 |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unitte... | cliffano/swaggy-jenkins | clients/python-legacy/generated/test/test_all_view.py | Python | mit | 1,387 |
# -*- coding: utf-8 -*-
"""
flaskbb.forum.models
~~~~~~~~~~~~~~~~~~~~
It provides the models for the forum
:copyright: (c) 2014 by the FlaskBB Team.
:license: BSD, see LICENSE for more details.
"""
from datetime import datetime, timedelta
from flask import url_for, abort
from flaskbb.extensions ... | mattcaldwell/flaskbb | flaskbb/forum/models.py | Python | bsd-3-clause | 32,514 |
# Copyright (C) 2009 William.os4y@gmail.com
#
# 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, version 2 of the License.
#
# This program is distributed in the hope that it will be... | william-os4y/fapws3 | fapws/contrib/sessions.py | Python | gpl-2.0 | 5,414 |
#!/usr/bin/env python
import sys
import getopt, parser_generator, grammar_parser, interpreter
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Please give one argument, the input filename."
sys.exit(1)
cs164_grammar_file = './cs164c.grm'
cs164_input_file = sys.argv[1]
cs164_lib... | michelle/sink | 164/main_164.py | Python | mit | 754 |
import os
import requests # pip install requests
# The authentication key (API Key).
# Get your own by registering at https://app.pdf.co
API_KEY = "******************************************"
# Base URL for PDF.co Web API requests
BASE_URL = "https://api.pdf.co/v1"
# Source PDF file
SourceFile = ".\\sample.pdf"
def... | bytescout/ByteScout-SDK-SourceCode | PDF.co Web API/Invoice Parser API/Python/Get Invoice Info From Uploaded File/GetInvoiceInfoFromUploadedFile.py | Python | apache-2.0 | 2,505 |
#!/usr/bin/env python
"""Generate a sequence diagram using websequencediagrams.com
Thanks to websequencediagrams.com for the sample Python code for accessing their
API!
Usage:
python generate_sequence_diagram.py input.txt output.png
"""
from __future__ import print_function
try:
from urllib import urlencode
... | bibhrajit/openxc-androidStudio | docs/sequences/generate_sequence_diagram.py | Python | bsd-3-clause | 1,463 |
"""
Copyright (C) 2004-2015 Pivotal Software, Inc. All rights reserved.
This program and the accompanying materials are made available under
the terms of the 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
... | CraigHarris/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/fts/fts_transitions/test_fts_transitions.py | Python | apache-2.0 | 58,441 |
from base import Base as BaseTestCase
from roletester.actions.nova import server_create
from roletester.actions.nova import server_delete
from roletester.actions.nova import server_show
from roletester.actions.nova import server_wait_for_status
from roletester.exc import NovaNotFound
from roletester.scenario import Sce... | chalupaul/roletester | roletester/roletests/test_sample.py | Python | apache-2.0 | 1,662 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2008, 2009, 2010, 2011, 2013 CERN.
##
## Invenio 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
## Licens... | jmartinm/invenio | modules/miscutil/lib/textutils_unit_tests.py | Python | gpl-2.0 | 30,192 |
"""
Deep learning and Reinforcement learning library for Researchers and Engineers
"""
from __future__ import absolute_import
try:
install_instr = "Please make sure you install a recent enough version of TensorFlow."
import tensorflow
except ImportError:
raise ImportError("__init__.py : Could not import T... | zjuela/LapSRN-tensorflow | tensorlayer/__init__.py | Python | apache-2.0 | 677 |
"""Templatetags for the markdown_utils app."""
import markdown
from django import template
from django.template.defaultfilters import stringfilter
from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe
register = template.Library()
@register.assignment_tag
@stringfilter
def r... | bitmazk/django-markdown-utils | markdown_utils/templatetags/markdown_utils_tags.py | Python | mit | 642 |
# -*- 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 'Song.running_seconds'
db.delete_column(u'core_song', 'running_seconds')
# Adding ... | chrispitzer/toucan-sam | toucansam/core/migrations/0005_auto__del_field_song_running_seconds__add_field_song_run_time.py | Python | gpl-2.0 | 3,377 |
# Copyright 2012, 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 ag... | ge0rgi/cinder | cinder/tests/unit/scheduler/test_rpcapi.py | Python | apache-2.0 | 10,644 |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# pushrebase.py - server-side rebasing of pushed changesets
"""rebases commits during push
The pushrebase extension allows the server to rebase incom... | facebookexperimental/eden | eden/scm/edenscm/hgext/pushrebase/__init__.py | Python | gpl-2.0 | 56,145 |
"""
WSGI config for project_name project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATI... | mikexine/tweetset | tweetset/tweetset/wsgi.py | Python | mit | 1,153 |
# -*- coding: utf-8 -*-
import system_tests
class TestCvePoC(metaclass=system_tests.CaseMeta):
url = "https://github.com/Exiv2/exiv2/issues/208"
filename = "$data_path/2018-01-09-exiv2-crash-001.tiff"
commands = ["$exiv2 " + filename]
retval = [1]
stdout = [""]
stderr = [
"""$exiv2_... | AlienCowEatCake/ImageViewer | src/ThirdParty/Exiv2/exiv2-0.27.5-Source/tests/bugfixes/github/test_CVE_2017_17722.py | Python | gpl-3.0 | 409 |
from gym.envs.algorithmic.copy_ import CopyEnv
from gym.envs.algorithmic.repeat_copy import RepeatCopyEnv
from gym.envs.algorithmic.duplicated_input import DuplicatedInputEnv
from gym.envs.algorithmic.reverse import ReverseEnv
from gym.envs.algorithmic.reversed_addition import ReversedAdditionEnv
| xpharry/Udacity-DLFoudation | tutorials/reinforcement/gym/gym/envs/algorithmic/__init__.py | Python | mit | 298 |
#!/usr/bin/env python
'''
An API and a command line interface for MySchool.
Commands can be seen in the cheatsheet on my GitHub.
In version 0.0.*, this script only runs on UNIX systems.
'''
##########################################################
__author__ = 'Darri Steinn Konradsson'
__copyright__ = 'Copyright 2016,... | darrikonn/MySchool_Command_Line | myschool_cmd.py | Python | gpl-3.0 | 17,809 |
import pyxb.bundles.opengis.sos_1_0 as sos
import pyxb.utils.utility
import sys
import traceback
# Import to define bindings for namespaces that appear in instance documents
import pyxb.bundles.opengis.sampling_1_0 as sampling
import pyxb.bundles.opengis.swe_1_0_1 as swe
import pyxb.bundles.opengis.tml
for f in sys.a... | jonfoster/pyxb-upstream-mirror | pyxb/bundles/opengis/examples/check_sos.py | Python | apache-2.0 | 648 |
from __future__ import absolute_import
from __future__ import division
import logging
import time
import functools
import random
import warnings
import json
from tornado.ioloop import PeriodicCallback
import tornado.httpclient
import tornado.gen
from ._compat import integer_types
from ._compat import iteritems
from ... | mreiferson/pynsq | nsq/reader.py | Python | mit | 32,984 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
test_records = frappe.get_test_records('Project') | BhupeshGupta/erpnext | erpnext/projects/doctype/project/test_project.py | Python | agpl-3.0 | 235 |
# -*- coding:utf-8 -*-
import datetime
import pandas as pd
def year_qua(date):
mon = date[5:7]
mon = int(mon)
return[date[0:4], _quar(mon)]
def _quar(mon):
if mon in [1, 2, 3]:
return '1'
elif mon in [4, 5, 6]:
return '2'
elif mon in [7, 8, 9]:
... | shiguol/tushare | tushare/util/dateu.py | Python | bsd-3-clause | 2,184 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
''' Nose test generators
Need function load / save / roundtrip tests
'''
from __future__ import division, print_function, absolute_import
import os
from os.path import join as pjoin, dirname
from glob import glob
from io import BytesIO
from tempfile import mkdtemp
fro... | nvoron23/scipy | scipy/io/matlab/tests/test_mio.py | Python | bsd-3-clause | 41,907 |
#!/usr/bin/python
import sys
sys.path.append('/usr/share/mandriva/')
from mcc2.backends.grub.service import Grub
if __name__ == '__main__':
Grub.main() | wiliamsouza/mandriva-control-center | bin/grub-mechanism.py | Python | gpl-2.0 | 157 |
"""Kodi notification service."""
import logging
import aiohttp
import voluptuous as vol
from homeassistant.const import (
ATTR_ICON,
CONF_HOST,
CONF_PASSWORD,
CONF_PORT,
CONF_PROXY_SSL,
CONF_USERNAME,
)
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassista... | fbradyirl/home-assistant | homeassistant/components/kodi/notify.py | Python | apache-2.0 | 3,029 |
#!/usr/bin/env python
## \file adjoint.py
# \brief python package for running adjoint problems
# \author T. Lukaczyk, F. Palacios
# \version 5.0.0 "Raven"
#
# SU2 Original Developers: Dr. Francisco D. Palacios.
# Dr. Thomas D. Economon.
#
# SU2 Developers: Prof. Juan J. Alonso's group at St... | pawhewitt/Dev | SU2_PY/SU2/run/adaptation.py | Python | lgpl-2.1 | 2,501 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tango_with_django.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| jatinshah/django_projects | tango_with_django/manage.py | Python | mit | 260 |
import sys
import time
import json
import feedparser
from time import mktime
from django.utils.datetime_safe import datetime
from django.utils.timezone import utc
from logging import getLogger
from bs4 import BeautifulSoup
from ..models import RSSMessage, RSSAccount
log = getLogger(__name__)
class JSONEncoder(js... | MadeInHaus/django-social | social/tasks/rss_updater.py | Python | mit | 3,911 |
'''
ASX Listener by Prodge
github.com/prodge
prodge.net
prodge@prodge.net
Released under the MIT licence
'''
import sys
import re
import json
import requests
from argparse import ArgumentParser
from time import sleep
# Url of the asx search page
BASE_URL = 'http://www.asx.com.au/... | Prodge/ASXListenerCLI | asxlistener.py | Python | mit | 7,089 |
from nose import with_setup
from nose.tools import assert_equal
import pandas as pd
from catdtree.classification import C45
def test_fit():
tree_str_exp = u'''Root
|--> Weight <= 58
| |--> Eye Color is Green
| |--> Eye Color is Blue
|--> Weight > 58
| |--> Height <= 1.9
| | |--> Money in Bank <= 32... | idanivanov/catdtree | tests/classification/test_C45.py | Python | mit | 1,664 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017 Mario Frasca <mario@anche.no>.
# Copyright 2017 Jardín Botánico de Quito
#
# This file is part of ghini.desktop.
#
# ghini.desktop is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | Ghini/ghini.desktop | scripts/importpictures.py | Python | gpl-2.0 | 3,221 |
import collections
import unittest
import utils
# O(capacity) space. Hash table, linked list, ordered dict.
class LRUCache:
# O(1) time. O(1) space.
def __init__(self, capacity: int):
self.capacity = capacity
self.cache = collections.OrderedDict()
# O(1) time. O(1) space.
def get(sel... | chrisxue815/leetcode_python | problems/test_0146_ordered_dict.py | Python | unlicense | 872 |
__author__ = 'Ivan Dortulov'
import os
import fcntl
import struct
from collections import OrderedDict
class Pydb(object):
INTEGER = 0
STRING = 1
CONSTRAINT_TYPES = {"not null": 0,
"primary key": 1}
LOGGING = True
DOCUMENT_ROOT = os.getcwd() + "/Databases/"
uchar_t = ... | IceCubeDev/hackerschool | DBEngine/Python/Pydb.py | Python | gpl-2.0 | 7,467 |
import sublime, sublime_plugin
import os
import subprocess
import threading
class OpenTerminalHere(sublime_plugin.TextCommand):
def run(self, edit):
view = self.view
file_path = view.file_name()
dirname = os.path.dirname(file_path)
th = GnomeTerminalThread(dirname)
th.star... | zeffii/sublimetext_productivity | Packages/User/open_terminal_here.py | Python | mit | 717 |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import copy
import grp
import inspect
import optparse
import os
import pwd
import textwrap
import types
from gunicorn import __version__
from gunicorn.errors import ConfigError
from gunicorn... | pschanely/gunicorn | gunicorn/config.py | Python | mit | 21,831 |
import numpy as np
import ray
__all__ = ["zeros", "zeros_like", "ones", "eye", "dot", "vstack", "hstack", "subarray", "copy", "tril", "triu", "diag", "transpose", "add", "subtract", "sum", "shape", "sum_list"]
@ray.remote
def zeros(shape, dtype_name="float", order="C"):
return np.zeros(shape, dtype=np.dtype(dtype_n... | amplab/ray | lib/python/ray/array/remote/core.py | Python | bsd-3-clause | 2,045 |
"""
##########################################################################
#
# QGIS-meshing plugins.
#
# Copyright (C) 2012-2013 Imperial College London and others.
#
# Please see the AUTHORS file in the main source directory for a
# full list of copyright holders.
#
# Dr Adam S. Candy, adam.candy@imp... | adamcandy/QGIS-Meshing | plugins/boundary_identification/shapefile.py | Python | lgpl-2.1 | 39,227 |
# -*- coding: utf-8 -*-
REPO_BACKENDS = {}
REPO_TYPES = []
class RepositoryTypeNotAvailable(Exception):
pass
try:
from brigitte.backends import libgit
REPO_BACKENDS['git'] = libgit.Repo
REPO_TYPES.append(('git', 'GIT'))
except ImportError:
from brigitte.backends import git
REPO_BACKENDS['git... | stephrdev/brigitte | brigitte/backends/__init__.py | Python | bsd-3-clause | 680 |
# -*- coding: utf-8-unix; -*-
#
# Copyright © 2014, Nicolas CANIART <nicolas@caniart.net>
#
# This file is part of vcs-ssh.
#
# vcs-ssh is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# vcs-s... | cans/vcs-ssh | ssh_harness/tests/mod4tests.py | Python | gpl-2.0 | 953 |
#!/usr/bin/env python3
###############################################################################
# #
# Copyright 2019. Triad National Security, LLC. All rights reserved. #
# This program was produced under U.S. Government contrac... | CSD-Public/stonix | src/tests/rules/unit_tests/zzzTestRuleConfigurePasswordPolicy.py | Python | gpl-2.0 | 7,397 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This file is part of html_widget_embedded_picture, an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# html_widget_embedded_picture is free software:
# you can redistribute... | acsone/acsone-addons | html_widget_embedded_picture/ir_mail_server.py | Python | agpl-3.0 | 4,025 |
import unittest
from katas.kyu_6.temperature_converter import convert_temp
class ConvertTemperatureTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(convert_temp(100, 'C', 'F'), 212)
def test_equals_2(self):
self.assertEqual(convert_temp(-30, 'De', 'K'), 393)
def test... | the-zebulan/CodeWars | tests/kyu_6_tests/test_temperature_converter.py | Python | mit | 664 |
from django import forms
from django.contrib.admin.widgets import AdminSplitDateTime
from django.forms import BaseFormSet, formset_factory
RADIO_CHOICES = (("1", "Radio 1"), ("2", "Radio 2"))
MEDIA_CHOICES = (
("Audio", (("vinyl", "Vinyl"), ("cd", "CD"))),
("Video", (("vhs", "VHS Tape"), ("dvd", "DVD"))),
... | dyve/django-bootstrap3 | example/app/forms.py | Python | bsd-3-clause | 4,237 |
from ddt import ddt, data
from unittest import TestCase
from reversion_compare.admin import CompareVersionAdmin
from ..admin import TimeBlockAdmin, TimeSlotAdmin, ConInfoAdmin, LocationAdmin, GameAdmin, PaymentOptionAdmin
@ddt
class AdminVersionTest(TestCase):
@data(TimeBlockAdmin, TimeSlotAdmin, ConInfoAdmin, Lo... | a-lost-shadow/shadowcon | convention/tests/test_admin.py | Python | gpl-3.0 | 474 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-25 18:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ctdata', '0009_jobpage_job_title'),
]
operations = [
migrations.AddField(
... | CT-Data-Collaborative/ctdata-wagtail-cms | ctdata/migrations/0010_jobpage_overview.py | Python | mit | 498 |
from AccessControl import ClassSecurityInfo
from Acquisition import aq_base, aq_inner
from Products.Archetypes.Registry import registerWidget, registerPropertyType
from Products.Archetypes.Widget import TypesWidget
from Products.Archetypes.utils import shasattr
from Products.CMFCore.utils import getToolByName
from arch... | DeBortoliWines/Bika-LIMS | bika/lims/browser/widgets/serviceswidget.py | Python | agpl-3.0 | 5,268 |
from django.shortcuts import get_object_or_404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from polls.models import Question
from polls.serializers import QuestionSerializer
class QuestionBaseListView(APIView):
def get(self, request):
... | lzac/pycon8-drf | polls/views/api/v1_cbv.py | Python | gpl-3.0 | 1,520 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-migration | crm_partner_categorization/__openerp__.py | Python | agpl-3.0 | 1,475 |
"""
Files Pipeline
See documentation in topics/media-pipeline.rst
"""
import functools
import hashlib
import os
import os.path
import time
import logging
from email.utils import parsedate_tz, mktime_tz
from six.moves.urllib.parse import urlparse
from collections import defaultdict
import six
try:
from cStringIO i... | wujuguang/scrapy | scrapy/pipelines/files.py | Python | bsd-3-clause | 18,110 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-04-06 07:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('squealy', '0005_parameter_dropdown_api'),
]
operations = [
migrations.Creat... | dakshgautam/squealy | squealy/migrations/0006_database.py | Python | mit | 655 |
# Generated by Django 2.0.6 on 2018-07-06 16:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('iati_codelists', '0004_auto_20180430_1400'),
]
operations = [
migrations.CreateModel(
name='TagVocabulary',
fields=[... | openaid-IATI/OIPA | OIPA/iati_codelists/migrations/0005_tagvocabulary.py | Python | agpl-3.0 | 570 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
# Copyright (C) 2010-2021 Ulrich von Zadow
#
# 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
# vers... | libavg/libavg | samples/plugin.py | Python | lgpl-2.1 | 1,248 |
# -*- coding: utf-8 -*-
# Copyright 2011 Takeshi KOMIYA
#
# 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... | aboyett/blockdiag | src/blockdiag/imagedraw/png.py | Python | apache-2.0 | 14,863 |
"""Admin and review teams.
Revision ID: 55b1ef63bee
Revises: 18052b0cd282
Create Date: 2014-04-19 19:30:27.529641
"""
# revision identifiers, used by Alembic.
revision = '55b1ef63bee'
down_revision = '18052b0cd282'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column(
'profile',... | hasgeek/funnel | migrations/versions/55b1ef63bee_admin_and_review_tea.py | Python | agpl-3.0 | 944 |
# Copyright (c) 2015 RIPE NCC
#
# 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 the h... | RIPE-NCC/ripe-atlas-cousteau | ripe/atlas/cousteau/api_meta_data.py | Python | gpl-3.0 | 6,704 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jvrsantacruz/XlsxWriter | xlsxwriter/test/comparison/test_escapes07.py | Python | bsd-2-clause | 1,253 |
import pymongo
from flask import Flask
from flask_admin import Admin
def setup():
app = Flask(__name__)
app.config['SECRET_KEY'] = '1'
app.config['CSRF_ENABLED'] = False
conn = pymongo.Connection()
db = conn.tests
admin = Admin(app)
return app, db, admin
| Widiot/simpleblog | venv/lib/python3.5/site-packages/flask_admin/tests/pymongo/__init__.py | Python | mit | 289 |
import sys
from datetime import datetime
def log(msg):
msg = "[DEBUG {0}] {1}\n".format(datetime.now(), msg)
#for channel in (sys.stderr,):
for channel in (sys.stderr, sys.stdout):
channel.write(msg)
| TartuNLP/nazgul | log.py | Python | mit | 210 |
# This file is part of Geeky Notes
#
# Geeky Notes is a CLI Simplenote client
# <https://github.com/dmych/gn>
#
# Copyright (c) Dmitri Brechalov, 2010-2011
#
# Geeky Notes 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 Softwar... | dmych/gn | api.py | Python | gpl-3.0 | 5,234 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
#from . import report_order_line
#from . import order_report_nex # Estado de Cuenta - Used by Patient - Moved
from . import report_sale_product
from . import order_admin
from . import ticket
from . import order
from . import order_business
from . ... | gibil5/openhealth | models/order/__init__.py | Python | agpl-3.0 | 535 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutHashes in the Ruby Koans
#
from runner.koan import *
class AboutDictionaries(Koan):
def test_creating_dictionaries(self):
empty_dict = dict()
self.assertEqual(dict, type(empty_dict))
self.assertEqual(dict(), empty_dict)
... | exaroth/python_koans | python2/koans/about_dictionaries.py | Python | mit | 2,000 |
import logging
from django.db.models import Q
from django.http import HttpResponse
from django.utils import timezone
from zentral.contrib.mdm.models import (ArtifactType, ArtifactVersion,
Channel, CommandStatus,
DeviceCommand, UserCommand)
... | zentralopensource/zentral | zentral/contrib/mdm/commands/utils.py | Python | apache-2.0 | 7,279 |
from time import sleep
from picamera import PiCamera
from datetime import datetime, timedelta
def wait():
# Calculate the delay to the start of the next hour
next_hour = (datetime.now() + timedelta(hour=1)).replace(
minute=0, second=0, microsecond=0)
delay = (next_hour - datetime.now()).seconds
... | tfroehlich82/picamera | docs/examples/timelapse2.py | Python | bsd-3-clause | 512 |
import os
import sys
import platform
import subprocess
import setuptools
import pathlib
import sysconfig
import copy
import distutils
from pkg_resources import get_distribution
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext, copy_file
from distutils import log
from distutils... | lief-project/LIEF | setup.py | Python | apache-2.0 | 17,676 |
# Copyright (c) 2016-2020 Chris Cummins.
#
# clgen 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.
#
# clgen is distributed in the hope... | ChrisCummins/clgen | deeplearning/clgen/corpuses/atomizers.py | Python | gpl-3.0 | 7,783 |
# Challenges:
# 1. Implement, as best as you can, the identity function in your favorite language (or the second favorite, if your favorite language happens to be Haskell).
# 2. Implement the composition function in your favorite language. It takes two functions as arguments and returns a function that is their composi... | sujeet4github/MyLangUtils | CategoryTheory_BartoszMilewsky/PI_01_Category_Essense_Of_Composition/Ex_1_2_3.py | Python | gpl-3.0 | 752 |
from database import Database
class Types(object):
integer = "INTEGER" # integer
text = "TEXT" # includes varchars and unlimited text
blob = "BLOB" # data
real = "REAL" # real
numeric = "NUMERIC" # date/bool/numeric
class Model(object):
def __init__(self, row=None):
# objects don't *ha... | piercefreeman/GoFetch | gofetch/model.py | Python | mit | 6,238 |
#!/usr/bin/env python
# coding: UTF-8
# 计算两个经纬度之间的距离,单位千米
import math
import MySQLdb
import numpy
from preprocess import settings
def init_gps(users, return_gps=False):
conn = MySQLdb.connect(host=settings.HOST, user=settings.USER, passwd=settings.PASSWORD, db=settings.DB)
cursor = conn.cursor()
result =... | pengyuan/markov2tensor | tensor_factorization/util.py | Python | mit | 2,523 |
#!/usr/bin/env python
import subprocess
import praw
from hashlib import sha1
from flask import Flask
from flask import Response
from flask import request
from cStringIO import StringIO
from base64 import b64encode
from base64 import b64decode
from ConfigParser import ConfigParser
import OAuth2Util
import os
import mar... | foobarbazblarg/stayclean | stayclean-2019-december/serve-signups-with-flask.py | Python | mit | 8,591 |
# LICENCE: This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will... | pbougue/navitia | source/jormungandr/jormungandr/planner.py | Python | agpl-3.0 | 4,389 |
from django.utils.encoding import python_2_unicode_compatible
from allauth.socialaccount import app_settings
from allauth.account.models import EmailAddress
from ..models import SocialApp, SocialAccount, SocialLogin
from ..adapter import get_adapter
class AuthProcess(object):
LOGIN = 'login'
CONNECT = 'conn... | sih4sing5hong5/django-allauth | allauth/socialaccount/providers/base.py | Python | mit | 5,951 |
'''
Copyright 2016, 2017 Aviva Bulow
This file is part of Fealden.
Fealden 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.
... | aviva-bulow/fealden-0.2 | fealden/sensor.py | Python | gpl-3.0 | 16,846 |
#!/usr/bin/python
# Copyright 2017 Telstra Open Source
#
# 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 appl... | nikitamarchenko/open-kilda | services/mininet/kilda/mininet/flow_tool.py | Python | apache-2.0 | 8,134 |
"""@@@"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" """
""" timecalc.py """
""" """
""" Accepts a timespan and returns the d... | LiamMayfair/utils | timecalc.py | Python | mit | 1,752 |
from typing import Dict, Optional
import torch
from allennlp.data import Vocabulary
from allennlp.models.heads.head import Head
from allennlp.modules import FeedForward, Seq2VecEncoder
from allennlp.training.metrics import CategoricalAccuracy
@Head.register("classifier")
class ClassifierHead(Head):
"""
A c... | allenai/allennlp | allennlp/models/heads/classifier_head.py | Python | apache-2.0 | 5,334 |
import sys
import copy
def loadFile( name ):
storage = []
with open(name) as file:
for line in file:
l = []
elements = line.replace("\n", "").split()
for element in elements:
if not element.isdigit():
print("ERROR")
... | malja/cvut-python | cviceni06/biggest.py | Python | mit | 4,185 |
import os
import unittest
from ..weights import W
from ..util import lat2W
from ..spatial_lag import lag_spatial, lag_categorical
import numpy as np
class Test_spatial_lag(unittest.TestCase):
def setUp(self):
self.neighbors = {'c': ['b'], 'b': ['c', 'a'], 'a': ['b']}
self.weights = {'c': [1.0], '... | sjsrey/pysal_core | pysal_core/weights/tests/test_spatial_lag.py | Python | bsd-3-clause | 2,394 |
# ===========================================================================
# eXe
# Copyright 2004-2006, University of Auckland
#
# 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 versio... | kohnle-lernmodule/palama | exe/webui/block.py | Python | gpl-2.0 | 12,877 |
import os
import wx.lib.newevent
import time
import urlparse
import select
import socket
from threading import Thread
from SocketServer import ThreadingMixIn
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
def quote(s):
return s.replace('&', '&').replace('<', '<').replace('>', '>')
def makeXM... | jbernardis/repraptoolbox | src/HTTPServer/__init__.py | Python | gpl-3.0 | 1,891 |
# simulate.py - methods for simulating amplification profiles
#
# v 1.0.8
# rev 2017-07-24 (MS: created)
# Notes:
import numpy as np
import pandas as pd
import scipy.stats
from . import PSDTools
def simulate_logis_profile(start, end, mu, sigma, depth=1):
""" Simulate linear amplification using a logistic distrib... | parklab/PaSDqc | PaSDqc/simulate.py | Python | mit | 4,471 |
#!/usr/bin/python
#coding:utf-8
from hashlib import sha256
import ConfigParser
import os
import hmac
import json
import base64
import requests
import urlparse
import datetime
import json
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
def getConfig():
"""
将通用的一些数据读取放在一个函数里。不再每个函数里去写一遍了。
"""
g... | lichengshuang/createvhost | python/cdn/wangsu/bin/wangsu.py | Python | apache-2.0 | 2,674 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-01-08 15:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('PollyUpload', '0001_initial'),
]
operations = [
migrations.AddField(
... | antring/PollyPy | PollyUpload/migrations/0002_auto_20170108_1547.py | Python | mit | 608 |
import re
from os.path import join
from django.test import override_settings
from unittest.mock import patch
from testil import assert_raises, tempdir
import corehq.blobs as mod
from corehq.util.test_utils import generate_cases
from settingshelper import SharedDriveConfiguration
@generate_cases([
dict(root=None... | dimagi/commcare-hq | corehq/blobs/tests/test_init.py | Python | bsd-3-clause | 1,337 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-15 14:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0014_auto_20170414_0845'),
]
operations = [
migrations.AlterFi... | Gatomlo/shareandplay | catalogue/migrations/0015_auto_20170415_1628.py | Python | gpl-3.0 | 495 |
'''
Setuptools data
'''
from setuptools import setup, find_packages
setup(
name="pyRedditDL",
version='0.1',
packages=find_packages(),
author="Artemiy Solopov",
author_email="art-solopov@yandex.ru",
description="Program for automatic download of Reddit saved links",
license="GNU GPL v3",
... | art-solopov/pyRedditDL | setup.py | Python | gpl-3.0 | 831 |
def extractEugeneWoodbury(item):
"""
Parser for 'Eugene Woodbury'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'WATTT' in item['tags']:
return buildReleaseMessageWithType(item, 'WATTT', vol, chp, frag=fr... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractEugeneWoodbury.py | Python | bsd-3-clause | 355 |
# Copyright 2013 Locaweb.
# 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 appli... | locaweb/simplestack | tests/hypervisors/base_test_case.py | Python | apache-2.0 | 9,892 |
#!/usr/bin/env python
# -*- coding: windows-1251 -*-
# Copyright (C) 2005 Kiseliov Roman
from xlwt import *
wb = Workbook()
ws0 = wb.add_sheet('sheet0')
fnt = Font()
fnt.name = 'Arial'
fnt.colour_index = 4
fnt.bold = True
borders = Borders()
borders.left = 6
borders.right = 6
borders.top = 6
borders.bottom = 6
st... | seksan2538/schedule-generator | xlwt/examples/merged0.py | Python | gpl-3.0 | 517 |
'''
Created by auto_sdk on 2015.04.21
'''
from aliyun.api.base import RestApi
class Rds20120615DescribeDBInstanceClassesRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
def getapiname(self):
return 'rds.aliyuncs.com.DescribeDBInstanceClasses.201... | wanghe4096/website | aliyun/api/rest/Rds20120615DescribeDBInstanceClassesRequest.py | Python | bsd-2-clause | 330 |
__author__ = 'jcaraballo17'
| jcaraballo17/secret-webpage | woodypage/settings/production.py | Python | apache-2.0 | 28 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.