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 |
|---|---|---|---|---|---|
#changes I would make for next time if we were to access the API like this:
#1. mysql.connector, installed from the mysql site, is picky about which version of python you have.
# I would likely use a different driver, such as MySQLdb
#2. Handling pagination: The api's github events are paginated. The following co... | Hackers-To-Engineers/ghdata-sprint1team-2 | views.py | Python | mit | 7,571 |
bg_image_modes = ('stretch', 'tile', 'center', 'right', 'left')
transitions_jquery_ui = (
'blind', 'bounce', 'clip', 'drop', 'explode', 'fade', 'fold',
'highlight', 'puff', 'pulsate', 'scale', 'shake', 'size', 'slide'
)
transitions_animatecss = (
'bounceIn',
'bounceInDown',
'bounceInLeft',
'bo... | alandmoore/pystump | includes/lookups.py | Python | gpl-3.0 | 856 |
import asyncio
def create_remote_signal_actor(ray):
# TODO(barakmich): num_cpus=0
@ray.remote
class SignalActor:
def __init__(self):
self.ready_event = asyncio.Event()
def send(self, clear=False):
self.ready_event.set()
if clear:
self.re... | pcmoritz/ray-1 | python/ray/tests/client_test_utils.py | Python | apache-2.0 | 485 |
import json
import random
import pytest
from ruamel.yaml import YAML
from great_expectations.core.batch import Batch, BatchRequest
from great_expectations.core.batch_spec import SqlAlchemyDatasourceBatchSpec
from great_expectations.data_context.util import instantiate_class_from_config
from great_expectations.datasou... | great-expectations/great_expectations | tests/datasource/data_connector/test_sql_data_connector.py | Python | apache-2.0 | 44,985 |
a: int
b
c = 'no annotation'
x: int = 10
y: str = 'annotation'
z: tuple = (1, 2, 3)
confirm_subscr = {}
confirm_subscr['test'] = 'works'
| zrax/pycdc | tests/input/variable_annotations.py | Python | gpl-3.0 | 137 |
import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas._libs.tslibs.period import IncompatibleFrequency
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import (
PeriodArray,
period_array,
)
@pytest.mark.parametrize(
"data, freq, expected",
[
... | rs2/pandas | pandas/tests/arrays/period/test_constructors.py | Python | bsd-3-clause | 3,116 |
import numpy as np
import pytest
import pandas as pd
from pandas import Index, PeriodIndex, date_range, period_range
import pandas.core.indexes.period as period
import pandas.util.testing as tm
def _permute(obj):
return obj.take(np.random.permutation(len(obj)))
class TestPeriodIndex(object):
def test_join... | harisbal/pandas | pandas/tests/indexes/period/test_setops.py | Python | bsd-3-clause | 10,619 |
r"""
Parso is a Python parser that supports error recovery and round-trip parsing
for different Python versions (in multiple Python versions). Parso is also able
to list multiple syntax errors in your python file.
Parso has been battle-tested by jedi_. It was pulled out of jedi to be useful
for other projects as well.... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/parso/__init__.py | Python | mit | 1,607 |
# -*- 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):
# Adding field 'Article.active'
db.add_column('feedback_article', 'active',
self.gf('d... | ngageoint/geoevents | geoevents/feedback/migrations/0004_auto__add_field_article_active.py | Python | mit | 7,466 |
from Components.config import ConfigSubsection, config
from Tools.LoadPixmap import LoadPixmap
config.plugins = ConfigSubsection()
class PluginDescriptor:
"""An object to describe a plugin."""
# where to list the plugin. Note that there are different call arguments,
# so you might not be able to combine them.
... | kingvuplus/ee | lib/python/Plugins/Plugin.py | Python | gpl-2.0 | 3,227 |
"""
A driver for Icotera CPE
"""
import re
from Exscript.protocols.drivers import Driver
class IcoteraDriver(Driver):
def __init__(self):
"""
Constructor of the IcoteraDriver.
"""
Driver.__init__(self, 'icotera')
self.user_re = [re.compile(r'user ?name: ?$', re.I)]
... | maximumG/exscript | Exscript/protocols/drivers/icotera.py | Python | mit | 612 |
import logging
import warnings
import astropy
import numpy as np
import pytest
from astropy.utils.introspection import minversion
from numpy.testing import assert_allclose
from ginga import AstroImage
from ginga.util import wcsmod
# TODO: Add a test for native GWCS object.
_logger = logging.getLogger("TestWCS")
_wc... | naojsoft/ginga | ginga/tests/test_wcs.py | Python | bsd-3-clause | 15,731 |
# Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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 v... | dsweet04/rekall | rekall-core/rekall/plugins/darwin/networking.py | Python | gpl-2.0 | 13,974 |
""" Astropy coordinate class for the Magellanic Stream coordinate system """
from astropy.coordinates.matrix_utilities import (rotation_matrix,
matrix_product,
matrix_transpose)
from astropy.coordinates.baseframe import... | adrn/gala | gala/coordinates/magellanic_stream.py | Python | mit | 4,229 |
# -*- coding: utf-8 -*-
import numpy as np
from scipy import interpolate
from scipy import signal
from scipy.optimize import curve_fit
from scipy.interpolate import UnivariateSpline
def longcorr(data,temp,wave): # input are a two column matrix of data, temperature in C, wave as the wavelength in cm-1
"""
# L... | charlesll/RamEau | gcvspl/longcorr.py | Python | gpl-2.0 | 2,286 |
"""
Django settings for Git_Issue_Tracker project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DI... | harshitanand/Git-Issue-Tracker | Git_Issue_Tracker/settings.py | Python | mit | 2,238 |
def extractUtenatranslationsWordpressCom(item):
'''
Parser for 'utenatranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'transla... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractUtenatranslationsWordpressCom.py | Python | bsd-3-clause | 574 |
import os.path
from datetime import datetime
import uuid
from fabric.api import env, local, put, cd, run
from fabistrano.helpers import sudo_run
def prepare_for_checkout():
# Set current datetime_sha1 as the name of release
# use first 7 chars of commit hash
# Append user to end of string, for avoiding pe... | zhang-z/fabistrano | fabistrano/deploy_strategies.py | Python | bsd-2-clause | 6,246 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright 2011 Piston Cloud Computing, 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... | cyx1231st/nova | nova/api/openstack/compute/views/servers.py | Python | apache-2.0 | 12,638 |
#
# Copyright 2001 - 2006 Ludek Smid [http://www.ospace.net/]
#
# This file is part of IGE - Outer Space.
#
# IGE - Outer Space 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 t... | mozts2005/OuterSpace | client-pygame/lib/osci/dialog/ProblemsDlg.py | Python | gpl-2.0 | 18,889 |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | alexandrul-ci/robotframework | src/robot/utils/recommendations.py | Python | apache-2.0 | 2,883 |
from __future__ import unicode_literals
from postman.models import Message
def inbox(request):
"""Provide the count of unread messages for an authenticated user."""
if request.user.is_authenticated():
return {'postman_unread_count': Message.objects.inbox_unread_count(request.user)}
else:
... | hzlf/openbroadcast | website/apps/postman/context_processors.py | Python | gpl-3.0 | 330 |
__author__ = 'gavin'
from nltk import word_tokenize
from nltk.stem import PorterStemmer
class Tokenizer(object):
def __init__(self):
self.stemmer = PorterStemmer()
def __call__(self, doc):
return [self.stemmer.stem(token) for token in word_tokenize(doc)] | moonbury/notebooks | github/MasteringMLWithScikit-learn/8365OS_04_Codes/tokenizer.py | Python | gpl-3.0 | 282 |
#!/usr/bin/env python
# Author: Shao Zhang and Phil Saltzman
# Last Updated: 2015-03-13
#
# This tutorial is intended as a initial panda scripting lesson going over
# display initialization, loading models, placing objects, and the scene graph.
#
# Step 3: In this step, we create a function called loadPlanets, which w... | brakhane/panda3d | samples/solar-system/step3_load_model.py | Python | bsd-3-clause | 4,775 |
from __future__ import division
import numpy as np
#TODO: embed for FitHistogramPeaks
def poisson(x, a, b, c, d=0):
'''
Poisson function
a -> height of the curve's peak
b -> position of the center of the peak
c -> standard deviation
d -> offset
'''
from scipy.misc import fac... | radjkarl/imgProcessor | imgProcessor/equations/poisson.py | Python | gpl-3.0 | 454 |
# Copyright 2019 Fortinet, Inc.
#
# 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... | thaim/ansible | test/units/modules/network/fortios/test_fortios_firewall_interface_policy6.py | Python | mit | 16,051 |
#!/usr/bin/env python
"""
Usage: ./scripts/list_docs_report.sh | ./scripts/replace_labels.py --add docs --remove docs_report
"""
import argparse
import json
import sys
import requests
import ansibullbot.constants as C
HEADERS = {'Authorization': 'token %s' % C.DEFAULT_GITHUB_TOKEN}
ISSUE_URL_FMT = 'https://api.gi... | jctanner/ansibullbot | scripts/replace_labels.py | Python | gpl-3.0 | 1,793 |
#!/usr/bin/env python
"""
Unit tests for the main Battleship Algorithms functionality.
"""
import unittest
import tempfile
import logging
from battleship import main
from battleship import settings
class TestMain(unittest.TestCase): # pylint: disable=R0904
"""Unit tests for the main module."""
def test_r... | jacebrowning/battleship | battleship/test/test_main.py | Python | lgpl-3.0 | 1,100 |
# -*- coding: utf-8 -*-
"""
sphinx.domains
~~~~~~~~~~~~~~
Support for domains, which are groupings of description directives
and roles describing e.g. constructs of one programming language.
:copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sphinx/domains/__init__.py | Python | agpl-3.0 | 10,141 |
from django.conf.urls import url
import zerver.views
import zerver.views.streams
import zerver.views.invite
import zerver.views.user_settings
import zerver.views.auth
import zerver.views.tutorial
import zerver.views.report
import zerver.views.upload
import zerver.views.messages
import zerver.views.muting
# Future endp... | vaidap/zulip | zproject/legacy_urls.py | Python | apache-2.0 | 1,681 |
from os.path import join
from pythonforandroid.recipe import CompiledComponentsPythonRecipe
from pythonforandroid.toolchain import current_directory
class Pygame2Recipe(CompiledComponentsPythonRecipe):
version = "2.0.0-dev7"
url = "https://github.com/pygame/pygame/archive/android-2.0.0-dev7.tar.gz"
sit... | Tuxemon/Tuxemon | buildconfig/buildozer/recipes/pygame/__init__.py | Python | gpl-3.0 | 2,408 |
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject
from direct.interval.IntervalGlobal import *
from toontown.effects import DustCloud
def getDustCloudIval(toon):
dustCloud = DustCloud.DustCloud(fBillboard=0)
dustCloud.setBillboardAxis(2.0)
dustCloud.setZ(3)... | Spiderlover/Toontown | toontown/ai/DistributedBlackCatMgr.py | Python | mit | 2,173 |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/proto-task-queue | proto_task_queue/requestor.py | Python | apache-2.0 | 2,897 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import date
from decimal import Decimal, ROUND_DOWN
from django.contrib.sites.models import Site
from django.db import models
from django.db.models import Sum
from django.db.models.signals import post_save
from django.dispatch import receiv... | muhleder/timestrap | core/models.py | Python | bsd-2-clause | 6,476 |
"""
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.
The first integer of each row is greater than the last integer of the previous row.
"""
class Solution:
def searchMatrix(self, matrix:... | 1337/yesterday-i-learned | leetcode/74m.py | Python | gpl-3.0 | 1,381 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
def format_long_string(string, max_length=50):
if len(string) > max_length:
string = string[:max_length - 3]
string += '...'
return string
class AutoVivification(dict):
"""Implementation of perl's autovivification feature. C... | zakandrewking/cobrapy | cobra/util/util.py | Python | lgpl-2.1 | 568 |
from flask import send_from_directory
from flask import Flask,g,flash,render_template,redirect,request,url_for
from flask.templating import render_template_string
from wtforms import FileField, HiddenField
from flask_wtf.form import Form
from issues import app,login_manager,mail
import os
from werkzeug.utils import se... | maconnell/issues | issues/uploads.py | Python | gpl-2.0 | 1,646 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20151215_1537'),
]
operations = [
migrations.AlterField(
model_na... | lhellebr/GreenTea | apps/core/migrations/0004_auto_20160105_1533.py | Python | gpl-2.0 | 1,679 |
# -*- coding: utf-8 -*-
from datetime import datetime
import newrelic.agent
import waffle
from kuma.core.cache import memcache
from ..constants import DOCUMENT_LAST_MODIFIED_CACHE_KEY_TMPL
from ..events import EditDocumentEvent
from ..models import Document, RevisionIP
from ..tasks import send_first_edit_email
def... | surajssd/kuma | kuma/wiki/views/utils.py | Python | mpl-2.0 | 3,100 |
#---------------------------------------------------------------------
#Introdução a Programação dos Computadores - IPC
#Prof. Jucimar Jr.
#Adham Lucas da Silva Oliveira 1715310001
#Erik Atilio Silva Rey 1715310059
#Enrique Leão Barbosa Izel 1715310048
#Ulisses Antonio Antonino da Costa ... | jucimarjr/IPC_2017-1 | lista02/lista02_exercicio01_questao09.py | Python | apache-2.0 | 831 |
import time
from datetime import datetime, timedelta
from vFense.plugins.monit.utils import Monitor, MonitorKey
def _default_from_date():
now = datetime.now()
from_date = now - timedelta(hours=5)
return from_date
def _latest_time():
now = datetime.now()
latest_time = now - timedelta(minute... | dtklein/vFense | tp/src/plugins/monit/api.py | Python | lgpl-3.0 | 4,777 |
#!/usr/bin/env python
#
# is_hostname_safe - determine whether a supplied string is hostname safe.
#
# Copyright (C) 2014 Michael Davies <michael@the-davies.net>
#
# By "hostname safe" we mean the whether the hostname part of a FQDN
# follows the approporiate standards for a hostname. Specifically:
# * http://en.wi... | mrda/junkcode | is_hostname_safe.py | Python | gpl-2.0 | 2,582 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Manojkumar91/odoo_inresto | addons/account/account_move_line.py | Python | agpl-3.0 | 77,779 |
#coding=utf-8
class GeneralSpec:
def __init__(self, args):
self._paymentTerms = int(args['payment_terms'])
self._currency = str(args['currency'])
self._vat = float(args['vat'])
def paymentTerms(self):
return self._paymentTerms
def currency(self):
return self._currency
def vat(self):
return self._vat... | SudoQ/yig | general_spec.py | Python | mit | 857 |
"""Stuff to parse AIFF-C and AIFF files.
Unless explicitly stated otherwise, the description below is true
both for AIFF-C files and AIFF files.
An AIFF-C file has the following structure.
+-----------------+
| FORM |
+-----------------+
| <size> |
+----+------------+
| ... | ktan2020/legacy-automation | win/Lib/aifc.py | Python | mit | 34,203 |
import unittest
import datetime
from datetime import datetime as dt
import logging
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from . import models
from . import slides
from . import utils
from . import videos
from . import exporters
from ... | EuroPython/djep | pyconde/schedule/tests.py | Python | bsd-3-clause | 15,838 |
from . import equipmentslot, baseequipment
class Armor(baseequipment.Equipment):
def __init__(self, name, armor_bonus, equipment_slot=equipmentslot.EquipmentSlot.CHEST):
super().__init__(name, equipment_slot)
self.armor_bonus = armor_bonus
def compute_normal_armor_class(self):
return ... | agingrasc/PathfinderPhorum | phorum/equipment/armor.py | Python | mit | 337 |
## @file
# This file is used to define class objects of INF file [Pcds] section.
# It will consumed by InfParser.
#
# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License... | miguelinux/vbox | src/VBox/Devices/EFI/Firmware/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py | Python | gpl-2.0 | 25,992 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
GridPP and DIRAC: adding CERN@school cluster metadata.
"""
#...for operating system stuff.
import os
#...for parsing the arguments.
import argparse
#...for the logging.
import logging as lg
# Import the JSON library.
import json
# The DIRAC imports.
from DIRAC.... | gridpp/dirac-getting-started | add_cluster_metadata.py | Python | mit | 2,620 |
import boto.iam
import ConfigParser
import sys
import os.path
import argparse
import idsConfig
import idsNotify
list_user=""
parser = argparse.ArgumentParser(description='IAM intrusion detection')
parser.add_argument("-l", "--list-user", action="store", dest="list_user", help="list trusted user file")
args = parser.p... | adimania/AWS-IDS | iam_ids.py | Python | gpl-2.0 | 1,032 |
"""
============
Image Module
============
Routines for images.
"""
import numpy as _np
from astropy.io import fits
from astropy import wcs
from .catalog import (read_bgps, select_bgps_field)
from .paths import all_paths as d
class Dirs(object):
"""
Object to hold directories for interactive editing of pat... | autocorr/besl | besl/image.py | Python | gpl-3.0 | 5,022 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
# @Author: oesteban
# @Date: 2015-10-08 13:07:21
# @Last Modified by: oesteban
# @Last Modified time: 2015-10-08 14:53:20
if __name__ == "__main__":
im... | preprocessed-connectomes-project/quality-assessment-protocol | scripts/qap_report.py | Python | bsd-3-clause | 1,208 |
"""
This module handles accessing, storing, and managing the graph reference.
"""
from __future__ import absolute_import
import hashlib
import json
import os
import re
from pkg_resources import resource_string
import requests
import six
from plotly import files, utils
GRAPH_REFERENCE_PATH = '/v2/plot-schema'
GRAPH... | jeanfeydy/lddmm-ot | LDDMM_Python/lddmm_python/lib/plotly/graph_reference.py | Python | mit | 19,000 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2016 ASMlover. 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... | ASMlover/study | cplusplus/tyr2/test/Build.py | Python | bsd-2-clause | 8,055 |
# -*- coding: utf-8 -*-
'''These are the things used in making and using controllers.
'''
import imp
import os
class Controller(object):
"""Controllers take data from some files, do stuff with it,
and write it to the build directory."""
def __init__(self, site, data, destination, templates="_templates"):... | startling/cytoplasm | cytoplasm/controllers.py | Python | mit | 1,437 |
import os, sqlite3, json, random, markovify, re
from colorama import init, Fore, Style
from aiotg import Bot
bot = Bot(os.environ["API_TOKEN"])
@bot.command('.')
async def msg(chat, match):
m = chat.message
if m['chat']['type'] == 'channel':
return
if chat.message['chat']['type'] in ['group', 'supergroup']:
... | TNTINC/WolfeBot | delet.py | Python | mit | 875 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, sookido
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status'... | sestrella/ansible | lib/ansible/modules/monitoring/zabbix/zabbix_template.py | Python | gpl-3.0 | 28,122 |
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2021 Thomas Krijnen <thomas@aecgeeks.com>
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell 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 Fou... | IfcOpenShell/IfcOpenShell | src/ifcopenshell-python/ifcopenshell/main.py | Python | lgpl-3.0 | 1,031 |
# Copyright (C) 2013 Korei Klein <korei.klein1@gmail.com>
from misc import *
from calculus.enriched import formula, endofunctor, constructors
from calculus.basic import bifunctor as basicBifunctor, endofunctor as basicEndofunctor
UntransportableException = basicBifunctor.UntransportableException
class Bifunctor:
d... | koreiklein/fantasia | calculus/enriched/bifunctor.py | Python | gpl-2.0 | 5,810 |
from django.test import TestCase, Client
from django.core.files import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.contrib.auth.models import User
from .models import Admin
from .models import Professor
from .models import Student
from django.contrib.auth import authenticate
from djan... | chrizandr/ITS_feedback | feedback_portal/main/tests.py | Python | gpl-3.0 | 7,319 |
import hashlib
import urllib
from django.contrib import messages
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.db.models import Q
from django.forms.models import model_... | mPowering/django-orb | orb/profiles/views.py | Python | gpl-3.0 | 13,227 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | traceml/tests/test_events_processing/test_units_processors.py | Python | apache-2.0 | 3,814 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-30 12:42
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('web', '0011_auto_20170130_1241'),
]
operations = [... | leesdolphin/rentme | rentme/web/migrations/0012_auto_20170130_1242.py | Python | agpl-3.0 | 783 |
#!/usr/bin/env python
"""
@package mi.dataset.parser
@file mi-dataset/mi/dataset/parser/ctdmo_ghqr_imodem_telemetered_driver.py
@author Maria Lutz, Mark Worden
@brief Parser for the ctdmo_ghqr_imodem dataset driver
Release notes:
Initial release
"""
__author__ = 'Mark Worden'
__license__ = 'Apache 2.0'
import arra... | danmergens/mi-instrument | mi/dataset/parser/ctdmo_ghqr_imodem.py | Python | bsd-2-clause | 16,927 |
# Copyright (c) 2006 Eric P. Mangold
# See LICENSE for details.
import socket, struct
MAX_KEY_LENGTH = 0xff
MAX_VALUE_LENGTH = 0xffff
ASK = '_ask'
ANSWER = '_answer'
COMMAND = '_command'
ERROR = '_error'
ERROR_CODE = '_error_code'
ERROR_DESCRIPTION = '_error_description'
UNKNOWN_ERROR_CODE = 'UNKNOWN'
UNHANDLED_ERRO... | spikeekips/ampy | ampy/ampy.py | Python | mit | 8,805 |
from django.apps import AppConfig
import rest_registration.checks # noqa
class RestRegistrationConfig(AppConfig):
name = 'rest_registration'
| szopu/django-rest-registration | rest_registration/apps.py | Python | mit | 149 |
PRIORITIES_1 = PRIORITIES_2 = PRIORITIES_3 = PRIORITIES_4 = PRIORITIES_4B \
= PRIORITIES_4C = 'Second Variable File'
| userzimmermann/robotframework-python3 | atest/testdata/variables/resvarfiles/variables_2.py | Python | apache-2.0 | 132 |
# Hidden Markov Model Implementation
import pylab as pyl
import numpy as np
import matplotlib.pyplot as pp
from enthought.mayavi import mlab
import scipy as scp
import scipy.ndimage as ni
import scipy.io
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import rospy
import hrl_lib.mayavi2_util as mu
impor... | tapomayukh/projects_in_python | sandbox_tapo/src/AI/Code for Project-3/HMM Code/hmm_crossvalidation_force_20_states.py | Python | mit | 17,322 |
#!/usr/bin/env python
#coding: utf-8
"""
This module simply sends request to the Digital Ocean API,
and returns their response as a dict.
"""
import requests
API_ENDPOINT = 'https://api.digitalocean.com'
class DoError(RuntimeError):
pass
class DoManager(object):
def __init__(self, client_id, api_key):
... | chuwy/dopy | dopy/manager.py | Python | mit | 9,514 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | Grirrane/odoo | addons/website_quote/controllers/main.py | Python | agpl-3.0 | 9,493 |
#!/usr/bin/env python2
#This script keeps the bot running, restarts it, and writes error logs when it bugs out.
import logging
try:
open('errors.log', 'r').close()
except IOError:
open('errors.log', 'w').close()
logging.basicConfig(level=logging.WARNING, filename='errors.log', filemode = 'a', format='[%(asctime)s] ... | feblehober123/GETWatchBot2 | run.py | Python | gpl-3.0 | 620 |
# ask token from keystone
from keystoneclient.v3 import client
auth_args = {
'auth_url': 'http://192.168.56.102:5000/v3',
'project_name': 'admin',
'user_domain_name': 'default',
'project_domain_name': 'default',
'username': 'admin',
'password': 'jinghui108',
}
def get_token():
keystone =... | DTUbigdata/Thesis_Source_Code | thesis_package/Retrieve_Data/token_authenticate.py | Python | apache-2.0 | 395 |
from lib.analysis.author.edge_list import *
from lib.util.file_util import load_from_disk
def test_generate_edge_list():
author_nodes = './.tmp/integration_test/lib/analysis/author/edge_list/author_nodes.csv'
author_edges = './.tmp/integration_test/lib/analysis/author/edge_list/author_edges.csv'
graph_no... | prasadtalasila/MailingListParser | test/integration_test/lib/analysis/author/test_edge_list.py | Python | gpl-3.0 | 1,122 |
# Copyright 2014 The Oppia 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 applicable ... | himanshu-dixit/oppia | core/controllers/moderator.py | Python | apache-2.0 | 2,847 |
from __future__ import print_function
import json
import os
import sys
def print_file_tree(startpath):
""" Prints a directory and its contents
"""
for root, dirs, files in os.walk(startpath):
# skip hidden dirs
dirs[:] = [d for d in dirs if not d.startswith(".")]
level = root.re... | drivendata/data-science-is-software | src/utils.py | Python | mit | 1,436 |
# -*- test-case-name: txdav -*-
##
# Copyright (c) 2010-2014 Apple 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
#
#... | trevor/calendarserver | txdav/__init__.py | Python | apache-2.0 | 862 |
# Copyright (c) 2013-2016 Christian Geier et al.
#
# 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, ... | dzoep/khal | khal/ui/calendarwidget.py | Python | mit | 22,891 |
from .SingleThreadGenerator import SingleThreadGenerator as SingleThreadProjectionGenerator
from .OpenMPGenerator import OpenMPGenerator as OpenMPProjectionGenerator
from .CUDAGenerator import CUDAGenerator as CUDAProjectionGenerator | vitay/ANNarchy | ANNarchy/generator/Projection/__init__.py | Python | gpl-2.0 | 233 |
import sqlalchemy as sa
from pytest import mark
from sqlalchemy_utils import Country, CountryType, i18n # noqa
from tests import TestCase
@mark.skipif('i18n.babel is None')
class TestCountryType(TestCase):
def create_models(self):
class User(self.Base):
__tablename__ = 'user'
id ... | spoqa/sqlalchemy-utils | tests/types/test_country.py | Python | bsd-3-clause | 936 |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
"""
pythonic RPC implementation using zerorpc.
Server example::
from bliss.comm.rpc import Server
class Car(object):
''... | tiagocoutinho/bliss | bliss/comm/rpc.py | Python | lgpl-3.0 | 10,329 |
# -*- coding: UTF-8 -*-
# thermo.py
# Created by Francesco Porcari on 2010-09-03.
# Copyright (c) 2010 Softwell. All rights reserved.
#
#
import os
from gnr.core.gnrbag import Bag
import random
import time
cli_max = 12
invoice_max = 20
row_max = 100
sleep_time = 0.05
class GnrCustomWebPage(object):
dojo_versio... | poppogbr/genropy | packages/test15/webpages/components/thermo.py | Python | lgpl-2.1 | 6,614 |
# -*- coding: utf-8 -*-
"""
===============================================================================
module __Physics__: Base class for mananging pore-scale Physics properties
===============================================================================
"""
from OpenPNM.Base import logging
from OpenPNM.Networ... | amdouglas/OpenPNM | OpenPNM/Physics/__GenericPhysics__.py | Python | mit | 4,361 |
#encoding:utf-8
import codecs
import numpy as np
def build_topic_index_hasmap(topic_keys_file, has_head = False,index = False):
tk_read = codecs.open(topic_keys_file, 'r', 'utf-8')
line = tk_read.readline()
tk_list = line.strip().split('\t')
t_map = {}
ind = 0
for tk in tk_list:
t_map[tk... | Guhaifudeng/zhihukankan | topic_util.py | Python | apache-2.0 | 419 |
#!/usr/bin/env python3
# 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 "Lic... | apache/bigtop | bigtop-packages/src/charm/spark/layer-spark/tests/02-smoke-test.py | Python | apache-2.0 | 1,686 |
'''
Created by auto_sdk on 2012.10.16
'''
from top.api.base import RestApi
class FenxiaoProductImageUploadRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.image = None
self.pic_path = None
self.position = None
self.product_id = None
... | colaftc/webtool | top/api/rest/FenxiaoProductImageUploadRequest.py | Python | mit | 473 |
#!/usr/bin/python
#
# Copyright 2010 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... | nearlyfreeapps/python-googleadwords | tests/adspygoogle/adwords/adwords_logger_unittest.py | Python | apache-2.0 | 3,059 |
def extractNanoDesuLightNovelTranslations(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
if 'Ore to Kawazu-san no Isekai Hourouki' in item['tags']:
return buildReleaseMessageWithType(item, ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNanoDesuLightNovelTranslations.py | Python | bsd-3-clause | 412 |
#
# Copyright 2013 Red Hat, Inc.
# Copyright(c) FUJITSU Limited 2007.
#
# Cloning a virtual machine module.
#
# 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
... | aurex-linux/virt-manager | virtinst/cloner.py | Python | gpl-2.0 | 21,998 |
"""Class for printing reports on profiled python code."""
# Written by James Roskind
# Based on prior profile module by Sjoerd Mullender...
# which was hacked somewhat by: Guido van Rossum
# Copyright Disney Enterprises, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement
#
# License... | alanjw/GreenOpenERP-Win-X86 | python/Lib/pstats.py | Python | agpl-3.0 | 27,126 |
from django.views.generic import CreateView
from django.core.urlresolvers import reverse_lazy
from django import forms
from django.contrib.auth import forms as auth
from django.utils.translation import ugettext_lazy as _
from .models import User
from project.settings import LANGUAGE_CODE
from bootstrap3_datetime.widg... | Flowneee/django-e-referendum | project/users/views.py | Python | mit | 1,131 |
import io
def main():
list_songName = []
for line in f:
songName = line.split('|')[1]
#neu da co bai hat giong voi ten thi khong them vao nua
if songName not in list_songName:
list_songName.append(songName)
f2.write(u'' + unicode(songName, encoding = 'utf-8') + ... | hoaibang07/Webscrap | karaokeyoutube/tachtenfilekara.py | Python | gpl-2.0 | 688 |
# -*- coding: utf-8 -*-
'''
This file is part of the Python Mapper package, an open source tool
for exploration, analysis and visualization of data.
Copyright 2011–2014 by the authors:
Daniel Müllner, http://danifold.net
Aravindakshan Babu, anounceofpractice@hotmail.com
Python Mapper is distributed under the ... | timothy-mcroy/mapper | tools/shortest_path.py | Python | gpl-2.0 | 6,939 |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
from UM.Math.Vector import Vector
from UM.Math.Float import Float
class Plane:
"""Plane representation using normal and distance."""
def __init__(self, normal = Vector(), distance = 0.0):
super().__ini... | Ultimaker/Uranium | UM/Math/Plane.py | Python | lgpl-3.0 | 975 |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compl... | quattor/aquilon | tests/broker/test_update_machine.py | Python | apache-2.0 | 29,626 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists ... | apache/bloodhound | trac/trac/ticket/admin.py | Python | apache-2.0 | 33,531 |
#!/usr/bin/env python
# Authors:
# Trevor Perrin
# Marcelo Fernandez - bugfix and NPN support
# Martin von Loewis - python 3 port
#
# See the LICENSE file for legal information regarding use of this file.
from __future__ import print_function
import sys
import os
import os.path
import socket
import time
import ... | ioef/tlslite-ng | scripts/tls.py | Python | lgpl-2.1 | 12,217 |
"""Higher-level processing of moves and positions from SGF games."""
from gomill import boards
from gomill import sgf_properties
def get_setup_and_moves(sgf_game, board=None):
"""Return the initial setup and the following moves from an Sgf_game.
Returns a pair (board, plays)
board -- boards.Board
... | inclement/noGo | noGo/ext/gomill/sgf_moves.py | Python | gpl-3.0 | 3,240 |
# coding: utf-8
#
# Copyright 2020 The Oppia 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 requi... | prasanna08/oppia | core/domain/improvements_services_test.py | Python | apache-2.0 | 23,748 |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 22 09:23:19 2014
@author: B Poon (demure)
"""
import numpy as np
from matplotlib import pyplot as plt
#from math import log10
#definitions
first = r"C:\pyf\ast\iso100Mfixed.txt"
second = r"C:\pyf\ast\iso1G.txt"
third = r"C:\pyf\ast\iso10G.txt"
def iso_theo(filepath, col... | brupoon/nextTwilight | iso_theoretical.py | Python | mit | 1,193 |
#! /usr/bin/env python
# encoding: UTF-8
# Thomas Nagy 2008-2010 (ita)
"""
Doxygen support
Variables passed to bld():
* doxyfile -- the Doxyfile to use
* install_path -- where to install the documentation
* pars -- dictionary overriding doxygen configuration settings
When using this tool, the wscript will look like... | XNerv/Mermaid | tools/my/modules/waftools/doxygen.py | Python | gpl-3.0 | 8,580 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.