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 |
|---|---|---|---|---|---|
from json import loads, dumps
from oauthlib.common import to_unicode
def weibo_compliance_fix(session):
def _missing_token_type(r):
token = loads(r.text)
token['token_type'] = 'Bearer'
r._content = to_unicode(dumps(token)).encode('UTF-8')
return r
session._client.default_tok... | py-geek/City-Air | venv/lib/python2.7/site-packages/requests_oauthlib/compliance_fixes/weibo.py | Python | mit | 482 |
#!/usr/bin/env python
"""
* ultrasonic.py
* A library for ultrasonic sensor at RP
*
* Copyright (c) 2012 seeed technology inc.
* Website : www.seeed.cc
* Author : seeed fellow
* Create Time:
* Change Log :
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtai... | Seeed-Studio/Grove-RaspberryPi | Grove - Ultrasonic Ranger/ultrasonic.py | Python | mit | 2,644 |
from get_store_data import *
from pprint import pprint
import traceback
# generate_log_file function used as the default logging fucntion for cdp_runner
def generate_log_file(log_name, log_type, log_object, log_directory):
'''Generate a log file after a block or system run.
Arguments:
log_name -- the ac... | CouncilDataProject/transcription_runner | v1.0/cdp_runner.py | Python | gpl-3.0 | 14,332 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
# http://blog.dokenzy.com/archives/986
# https://pythonhosted.org/setuptools/setuptools.html#building-and-distributing-packages-with-setuptools
# http://python-packaging-user-guide.readthedocs.org/en/latest/distributing/#name
# http://stackoverflow.co... | sculove/xing-plus | setup.py | Python | mit | 1,187 |
from horizon import tables
from django.utils.translation import ugettext_lazy as _
from openstack_dashboard.dashboards.admin.datacenter \
import tables as datacenter_tables
from openstack_dashboard.openstack.common.requestapi import RequestApi
from openstack_dashboard.openstack.common.dictutils import DictList... | ChinaMassClouds/copenstack-server | openstack/src/horizon-2014.2/openstack_dashboard/dashboards/admin/datacenter/views.py | Python | gpl-2.0 | 1,339 |
"""
Swiss-specific Form helpers
"""
from __future__ import absolute_import
import re
from django.contrib.localflavor.ch.ch_states import STATE_CHOICES
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.e... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/contrib/localflavor/ch/forms.py | Python | bsd-3-clause | 3,952 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
from pages.base import BasePage
class FirefoxWhatsNewIndiaPage(BasePage):... | ericawright/bedrock | tests/pages/firefox/whatsnew/whatsnew_india.py | Python | mpl-2.0 | 567 |
#!/bin/env python3
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plot
import argparse
def plot_injection(t1, t2, iw, r, c, ir):
l = ir+1
x = np.linspace(-l, l, num=r)
z = np.linspace(-l, l, num=r)
v = np.zeros((x.shape[0], z.shape[0]))
for i in range(v.shape[0]):
... | opcon/plutokore | scripts/plot-jet-injection.py | Python | mit | 2,019 |
"""Test Z-Wave cover devices."""
from homeassistant.components.cover import SUPPORT_CLOSE, SUPPORT_OPEN
from homeassistant.components.zwave import (
CONF_INVERT_OPENCLOSE_BUTTONS,
CONF_INVERT_PERCENT,
const,
cover,
)
from tests.async_mock import MagicMock
from tests.mock.zwave import MockEntityValues, ... | tchellomello/home-assistant | tests/components/zwave/test_cover.py | Python | apache-2.0 | 9,716 |
import datetime
import json
import os
import re
import tempfile
from collections import OrderedDict
from pprint import pformat
from infra_buddy.aws import s3
from infra_buddy.context.artifact_definition import ArtifactDefinition
from infra_buddy.context.monitor_definition import MonitorDefinition
from infra_buddy.cont... | AlienVault-Engineering/infra-buddy | src/main/python/infra_buddy/context/deploy_ctx.py | Python | apache-2.0 | 12,201 |
"""
Enumerations.
"""
from collections.abc import Sequence
from uqbar.enums import IntEnumeration, StrictEnumeration
class AddAction(IntEnumeration):
"""
An enumeration of scsynth node add actions.
"""
### CLASS VARIABLES ###
ADD_TO_HEAD = 0
ADD_TO_TAIL = 1
ADD_BEFORE = 2
ADD_AFTER... | josiah-wolf-oberholtzer/supriya | supriya/enums.py | Python | mit | 12,735 |
"""Utility functions for Certbot plugin tests."""
import argparse
import copy
import contextlib
import os
import re
import shutil
import socket
import tarfile
from acme import jose
from acme import test_util
from certbot import constants
from certbot_compatibility_test import errors
_KEY_BASE = "rsa1024_key.pem"
KE... | brentdax/letsencrypt | certbot-compatibility-test/certbot_compatibility_test/util.py | Python | apache-2.0 | 1,932 |
# Copyright (c) 2016 Hewlett Packard Enterprise Development Company, L.P.
#
# 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
#
# ... | openstack/neutron-lib | neutron_lib/api/definitions/segment.py | Python | apache-2.0 | 4,049 |
from pypom import Region
from selenium.webdriver.common.by import By
from pages.desktop.base import Base
class Home(Base):
"""Addons Home page"""
_extensions_category_locator = (By.CLASS_NAME, 'Home-CuratedCollections')
_featured_extensions_locator = (By.CLASS_NAME, 'Home-FeaturedExtensions')
_featu... | aviarypl/mozilla-l10n-addons-server | tests/ui/pages/desktop/home.py | Python | bsd-3-clause | 4,776 |
# Copyright (C) 2001-2005 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | liyongyue/dnsspider | dns/rdata.py | Python | isc | 14,671 |
#!/usr/bin/env python
import sys
import csv
import json
if len(sys.argv) != 3:
print 'Incorrect number of arguments.'
print 'Usage: csv_to_json.py path_to_csv path_to_json'
exit()
print 'Argument List:', str(sys.argv)
csvFileName = sys.argv[1]
jsonFileName = sys.argv[2]
csvFile = open (csvFileName, 'rU')
myRea... | stacybird/CS510CouchDB | scripts/csv_to_json.py | Python | apache-2.0 | 651 |
"""Reads vehicle status from BMW connected drive portal."""
import logging
from bimmer_connected.state import ChargingState, LockState
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OPENING,
DEVICE_CLASS_PLUG,
DEVICE_CLASS_PROBLEM,
BinarySensorEntity,
)
from homeassistant.const impo... | sander76/home-assistant | homeassistant/components/bmw_connected_drive/binary_sensor.py | Python | apache-2.0 | 6,857 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from wikiciteparser.parser import parse_citation_template
from urllib import urlencode
import mwparserfromhell
import requests
import json
import codecs
import sys
import urllib
from unidecode import unidecode
import re
from datetime import datetime
from... | CristianCantoro/oabot | src/oabot/main.py | Python | mit | 10,570 |
"""Constants for the Kostal Plenticore Solar Inverter integration."""
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_ICON,
ATTR_UNIT_OF_MEASUREMENT,
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
ENERGY_KILO_WATT_HOUR,
PERCENTAGE,
POWER_WATT,
)
DOMAIN = "... | w1ll1am23/home-assistant | homeassistant/components/kostal_plenticore/const.py | Python | apache-2.0 | 14,377 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-24 22:47
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cart', '0003_auto_20160324_... | dmecha/apof | apof/cart/migrations/0004_auto_20160324_2247.py | Python | gpl-3.0 | 793 |
import torch.nn as nn
class VAE(nn.Module):
def __init__(self, input_dims, code_dims):
super(VAE, self).__init__()
self.name = "abstract_VAE"
self.input_dims = input_dims
self.code_dims = code_dims
def encode(self, x):
self.handle_unsupported_op()
return None
... | Jueast/DisentangleVAE | model/abstract_VAE.py | Python | mit | 530 |
# -*- coding: latin-1 -*-
import spotipy_twisted
from spotipy_twisted import util
from twisted.internet import defer
from twisted.trial import unittest
import pprint
import sys
'''
Since these tests require authentication they are maintained
separately from the other tests.
These tests try to be benign ... | jimcortez/spotipy_twisted | tests/authtests.py | Python | mit | 6,738 |
#!/usr/bin/env python
__all__ = ['iqiyi_download']
from ..common import *
from uuid import uuid4
from random import random,randint
import json
from math import floor
from zlib import decompress
import hashlib
'''
Changelog:
-> http://www.iqiyi.com/common/flashplayer/20150710/MainPlayer_5_2_25_c3_3_5_1.swf
-> http:/... | flwh/you-get | src/you_get/extractors/iqiyi.py | Python | mit | 4,916 |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.core.mail import send_mail
from .models import Subscriber
class SubscribeForm(forms.ModelForm):
class Meta:
model = Subscriber
fields = ('email',)
... | zrisher/webapp-public | webapp/apps/register/forms.py | Python | mit | 1,753 |
from __future__ import division
from sympy import (Abs, Catalan, cos, Derivative, E, EulerGamma, exp,
factorial, factorial2, Function, GoldenRatio, I, Integer, Integral,
Interval, Lambda, Limit, Matrix, nan, O, oo, pi, Pow, Rational, Float, Rel,
S, sin, SparseMatrix, sqrt, summation, Sum, Symbol, symbols, ... | wxgeo/geophar | wxgeometrie/sympy/printing/tests/test_str.py | Python | gpl-2.0 | 25,525 |
#!/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... | donspaulding/adspygoogle | adspygoogle/common/AuthToken.py | Python | apache-2.0 | 4,527 |
# -*- 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 'Controller.comment'
db.add_column('rainman_controller', 'comment',
sel... | smurfix/HomEvenT | irrigation/rainman/migrations/0041_auto__add_field_controller_comment.py | Python | gpl-3.0 | 20,952 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from cyrusbus import Bus
class Limiter(object):
def __init__(self, limiter_miss_timeout_ms=None):
self.bus = Bus()
self.limiter_miss_timeout_ms = limiter_miss_timeout_ms
if self.limiter_miss_timeout_ms is None:
self.limiter_miss_ti... | heynemann/octopus | octopus/limiter/__init__.py | Python | mit | 682 |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, unicode_literals
from django.utils.encoding import force_str
from rest_framework import fields, generics, serializers
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.views import APIVie... | andrewsmedina/django-admin2 | djadmin2/apiviews.py | Python | bsd-3-clause | 3,823 |
# combine_all_summaries
# this fuses the summary files from pre23_hathi,
# post22_hathi, and chicago, to create a file
# where there is only one entry for each
# char, auth, date tuple
import csv
from collections import Counter
counts = dict()
columns = ['characters', 'speaking', 'agent', 'mod', 'patient', 'poss', ... | tedunderwood/character | oldcode/combine_hathi_summaries.py | Python | mit | 1,368 |
from corpustools.gui.psgui import *
def test_psgui(qtbot, specified_test_corpus, settings):
dialog = PhonoSearchDialog(None, settings, specified_test_corpus, True)
qtbot.addWidget(dialog)
| PhonologicalCorpusTools/CorpusTools | tests/test_gui_psgui.py | Python | bsd-3-clause | 199 |
# Copyright 2016 Quora, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | manannayak/asynq | asynq/batching.py | Python | apache-2.0 | 8,188 |
# proxy module
from __future__ import absolute_import
from tvtk.pyface.ui.qt4.scene_editor import *
| enthought/etsproxy | enthought/tvtk/pyface/ui/qt4/scene_editor.py | Python | bsd-3-clause | 100 |
import threading
import time as mod_time
import uuid
from redis.exceptions import LockError, LockNotOwnedError
from redis.utils import dummy
class Lock(object):
"""
A shared, distributed Lock. Using Redis for locking allows the Lock
to be shared across processes and/or machines.
It's left to the user... | 5977862/redis-py | redis/lock.py | Python | mit | 11,349 |
#!/usr/bin/python2.6
# MarsRoverPictureCrawler (mrpc):
# A download bot for OPPORTUNITY and SPIRIT Mars Rover Pictures
#
# Copyright (C) 2011 by Maximilian Irro <maximilian.irro@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation ... | mpgirro/MarsRoverPictureCrawler | mrpc.py | Python | mit | 5,158 |
import pytest
from configmanager import Config, Item, RequiredValueMissing
def test_validate_raises_required_value_missing():
config = Config({
'a': Item(required=True),
'b': Item(),
})
with pytest.raises(RequiredValueMissing):
config.validate()
config.a.set('value')
con... | jbasko/configmanager | tests/test_validation.py | Python | mit | 429 |
#!/usr/bin/python
import math
filename = "gvrr.cc"
ss = "\
//\n\
// BAGEL - Brilliantly Advanced General Electronic Structure Library\n\
// Filename: " + filename + "\n\
// Copyright (C) 2012 Toru Shiozaki\n\
//\n\
// Author: Toru Shiozaki <shiozaki@northwestern.edu>\n\
// Maintainer: Shiozaki group\n\
//\n\
// This... | nubakery/bagel | src/integral/rys/vrr_gen/ggen.py | Python | gpl-3.0 | 6,913 |
#
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hello.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "agent.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
... | kinnevo/kic_alone | manage.py | Python | mit | 876 |
import re
line = 'asdf fff; ddd, fffc,baba, zz'
print re.split(r'[;,\s]\s*', line)
arr = [1,2,3,4]
print arr[1::2]
print arr[::1]
print arr[1::]
print arr[::3] # start::step
arr2 = [5,6,7,8,9]
print zip(arr,arr2)
print re.split(r'(;|,|\s)\s*', line)
print re.split(r'(?:;|,|\s)\s*', line)
| wonghoifung/learning-python | r2_1.py | Python | mit | 311 |
# -*- coding: utf-8 -*-
__author__ = """Sean Marlow"""
__email__ = 'sean.marlow@suse.com'
__version__ = '0.1.1'
| smarlowucf/mockboto3 | mockboto3/__init__.py | Python | mit | 113 |
# Copyright 2013-2015 DataStax, 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 writi... | kracekumar/python-driver | tests/integration/standard/test_cluster.py | Python | apache-2.0 | 23,432 |
'''
Check the performance counters from SQL Server
See http://blogs.msdn.com/b/psssql/archive/2013/09/23/interpreting-the-counter-values-from-sys-dm-os-performance-counters.aspx
for information on how to report the metrics available in the sys.dm_os_performance_counters table
'''
# stdlib
import traceback
# 3rd party... | oneandoneis2/dd-agent | checks.d/sqlserver.py | Python | bsd-3-clause | 17,085 |
#-*- coding:utf-8 -*-
class BasicTemplate(object):
def __init__(self):
self._part_files = []
self._part_imports = []
self._part_func = []
def part_files(self, files):
self._part_files.append("data = {}")
for name, data in files.items():
self._part_files.ap... | kAlmAcetA/file2py | file2py/templates.py | Python | mit | 3,156 |
from symbol.builder import FasterRcnn as Detector
from symbol.builder import ResNetV1bFPN as Backbone
from symbol.builder import add_anchor_to_arg
from models.FPN.builder import FPNNeck as Neck
from models.FPN.builder import FPNRpnHead as RpnHead
from models.FPN.builder import FPNRoiAlign as RoiExtractor
from models.FP... | TuSimple/simpledet | config/resnet_v1b/faster_r152v1b_fpn_2x.py | Python | apache-2.0 | 8,677 |
import wx
import logging
import matplotlib.cm
import numpy as np
import properties
p = properties.Properties.getInstance()
slider_width = 30
s_off = slider_width/2
class ColorBarPanel(wx.Panel):
'''
A HORIZONTAL color bar and value axis drawn on a panel.
'''
def __init__(self, parent, map, local_exte... | afraser/CellProfiler-Analyst | cpa/colorbarpanel.py | Python | gpl-2.0 | 12,477 |
import re
import datetime as dt
import pytz
import lxml.html
from billy.scrape.events import EventScraper, Event
from openstates.utils import LXMLMixin
url = "http://assembly.state.ny.us/leg/?sh=hear"
class NYEventScraper(EventScraper, LXMLMixin):
_tz = pytz.timezone('US/Eastern')
jurisdiction = 'ny'
de... | cliftonmcintosh/openstates | openstates/ny/events.py | Python | gpl-3.0 | 6,983 |
import re
import time
from hashlib import sha1
import sickbeard
from sickbeard import logger
from sickbeard.exceptions import ex
from sickbeard.clients import http_error_code
from lib.bencode import bencode, bdecode
from lib import requests
class GenericClient(object):
def __init__(self, name, host=None, use... | schumi2004/NOT_UPDATED_Sick-Beard-Dutch | sickbeard/clients/generic.py | Python | gpl-3.0 | 8,152 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2019 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | mvo5/snapcraft | snapcraft/internal/repo/errors.py | Python | gpl-3.0 | 5,436 |
# -*- coding: utf-8 -*-
import sys
import os
import regex
import codecs
from cleo import Command, InputArgument, InputOption
from src.models.user_model import UserModel
class CreateUserCommand(Command):
name = 'user:add'
description = 'Adds a user to the users table'
arguments = [
{
... | clarinsi/reldi-api | tools/usertools/create_user.py | Python | gpl-3.0 | 2,544 |
# -*- coding: utf-8 -*-
__author__ = 'Robert Ancell <bob27@users.sourceforge.net>'
__license__ = 'GNU General Public License Version 2'
__copyright__ = 'Copyright 2005-2006 Robert Ancell'
class CECPProtocol:
"""CECP protocol en/decoder.
"""
# Data being accumulated to be parsed
__buffer... | guillaumebel/nibbles-clutter | glchess/src/lib/cecp.py | Python | gpl-2.0 | 6,721 |
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
COUNTER = 'c'
TIMING = 'ms'
GAUGE = 'g'
SET = 's'
class StatsD(DatagramProtocol):
def __init__(self, host=None, port=None):
self.host = host
self.port = port
self.usable = False
def startProtoc... | ojab/bnw | bnw/core/statsd.py | Python | bsd-2-clause | 1,024 |
"""SCons.Tool.sunf90
Tool-specific initialization for sunf90, the Sun Studio F90 compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20... | BenLand100/rat-pac | python/SCons/Tool/sunf90.py | Python | bsd-3-clause | 2,172 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (http://tiny.be). All Rights Reserved
#
#
# This program is free software: you can redistribute it and/or modify
# ... | avanzosc/avanzosc6.1 | avanzosc_calendar/wizard/make_hours_to_work.py | Python | agpl-3.0 | 9,776 |
__author__ = 'manbug'
| YangTe1/Forum | utils/__init__.py | Python | gpl-2.0 | 22 |
import pytest
from django.test import override_settings
from django.utils import timezone
from pretix import (
CreateOrderHotelRoom,
CreateOrderInput,
CreateOrderTicket,
CreateOrderTicketAnswer,
InvoiceInformation,
create_hotel_positions,
create_order,
)
from pretix.exceptions import PretixE... | patrick91/pycon | backend/pretix/tests/test_create_order.py | Python | mit | 10,686 |
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2007 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.org/licenses/gpl.html... | walterfan/pims4php | util/fckeditor/fckeditor.py | Python | apache-2.0 | 4,236 |
class IAccount():
def options(self):
pass
def signin(self):
pass
def signup(self):
pass
def logout(self):
pass
| saraivaufc/askMathPlus | askmath/views/authentication/iaccount.py | Python | gpl-2.0 | 162 |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
compat_urllib_parse,
)
class MalemotionIE(InfoExtractor):
_VALID_URL = r'^(?:https?://)?malemotion\.com/video/(.+?)\.(?P<id>.+?)(#|$)'
_TEST = {
'url': 'http://malemotion.com/video/bien-dur.1... | MiLk/youtube-dl | youtube_dl/extractor/malemotion.py | Python | unlicense | 1,665 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.serializers.json
import postgres.fields
import decimal
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migratio... | hotsyk/conferencio | conferencio/users/migrations/0002_auto_20150301_0526.py | Python | bsd-3-clause | 1,162 |
'''
Created on 2013-3-8
@author: corleone
'''
from scrapy.cmdline import execute
from scrapy.settings import CrawlerSettings
if __name__ == '__main__':
file_name = u"permutation3.json"
with open(file_name, 'w') as f:
pass
execute(argv=["scrapy", "crawl", "lottery", "-o%s" % file_name, "-... | 535521469/crawler_sth | scrapy/lottery/permutation3/lecai/start.py | Python | bsd-3-clause | 658 |
#!/usr/bin/env python
from setuptools import setup
setup(name="molmass",
version="2015.01.29",
description="Calculate the molecular mass (average, monoisotopic, and nominal), the elemental composition, and the mass distribution spectrum of a molecule given by its chemical formula, relative element weights, or... | dmccloskey/molmass | setup.py | Python | mit | 1,274 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dingoprojectorg.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| phongvcao/dingoprojectorg | manage.py | Python | gpl-3.0 | 258 |
"""Tests prosegur setup."""
from unittest.mock import MagicMock, patch
from pytest import mark
from homeassistant.components.prosegur import DOMAIN
from tests.common import MockConfigEntry
@mark.parametrize(
"error",
[
ConnectionRefusedError,
ConnectionError,
],
)
async def test_setup_e... | Danielhiversen/home-assistant | tests/components/prosegur/test_init.py | Python | apache-2.0 | 1,781 |
# -*- encoding: utf-8 -*-
"""
Проверка наличия элемента
"""
inventory = ("a",
"b",
"c",
"d")
if "c" in inventory:
print "You will live to fight another day."
| h4/fuit-webdev | examples/lesson2/2.3/1.9.5.py | Python | mit | 227 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Multipass.ui'
#
# Created: Tue Feb 04 23:58:25 2014
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attr... | marclr/passwordGenerator | Multipass.py | Python | mit | 8,642 |
import cPickle, time, uuid, sys, random
import transaction
from ZODB.FileStorage import FileStorage
from ZODB.DB import DB
from BTrees.IOBTree import IOBTree
from BTrees.IIBTree import IIBTree
from BTrees.OOBTree import OOBTree
import testlib
storage = FileStorage('Data.fs')
db = DB(storage)
connection = db.open()
roo... | jhb/zodbtime | testdataoobt.py | Python | gpl-2.0 | 681 |
from .models import User, Role
from app.knowledgebase import Channel
from app.helpers import get_user_by_telegram_id
from app import db
from random import randint
from datetime import datetime, timedelta
from flask.ext.security import login_user, logout_user
class AccountManager(object):
@staticmethod
def get... | yewsiang/botmother | app/accounts/__init__.py | Python | agpl-3.0 | 7,974 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from flask import request, session
from marshmallow_enum import E... | mic4ael/indico | indico/modules/events/papers/controllers/api.py | Python | mit | 7,841 |
#! /usr/bin/python
"""
Query the Home Assistant API for available entities.
Output is printed to stdout.
"""
import sys
import getpass
import argparse
try:
from urllib2 import urlopen
PYTHON = 2
except ImportError:
from urllib.request import urlopen
PYTHON = 3
import json
def main(password, askpass,... | bdfoster/blumate | script/get_entities.py | Python | mit | 3,135 |
import multiprocessing as mp
import numpy as np
import PIL
# represents an environment that runs in a separate process
# it can be controlled via its message queue
class LearnerProcess(mp.Process):
def __init__(self, index, is_ready_barrier, queue, environment, shared_memory):
super(LearnerProcess, self).__init__(... | ferdkuh/rlkart | src/myrl/learner_process.py | Python | gpl-3.0 | 2,344 |
from draw_maze import parse_grid
from moves import move
from moves import LEFT, RIGHT, UP, DOWN
import pytest
LEVEL = """#######
#.....#
#..o..#
#.o*o.#
#..o..#
#.....#
#######"""
@pytest.mark.parametrize('direction, pos, tile', [
(LEFT, (3, 2), '*'),
(LEFT, (3, 1), 'o'),
(RIGHT, (3, 4), '*'),
(RIG... | krother/maze_run | 09_test_data/test_crate.py | Python | mit | 2,136 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Simple IR baselines.
We plan to implement the following variants:
Given an input message, either:
(i) find the most ... | facebookresearch/ParlAI | parlai/agents/ir_baseline/ir_baseline.py | Python | mit | 9,673 |
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test feature controller in scripts."""
__metaclass__ = type
from lp.services.features import (
get_relevant_feature_controller,
install_feature_controller,
)
from ... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/services/scripts/tests/test_feature_controller.py | Python | agpl-3.0 | 2,226 |
#!/usr/bin/python
import os
import optparse
import test_lib
import test_util
import test_state
#import zstackwoodpecker.test_lib as test_lib
#import zstackwoodpecker.test_util as test_util
#import zstackwoodpecker.test_state as test_state
ACTION = 'Robot Action:'
ACTION_RESULT = 'Robot Action Result:'
VM = 'VM'
VOLUM... | SoftwareKing/zstack-woodpecker | zstackwoodpecker/zstackwoodpecker/robot_replay.py | Python | apache-2.0 | 14,001 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from shuup.core.models import (
ProductCrossSell... | suutari/shoop | shuup_tests/xtheme/test_cross_sell_plugin.py | Python | agpl-3.0 | 1,722 |
#
# Astronomy Constants (in cgs)
# @author: Mubdi Rahman
# Last Updated: January 12, 2011
#
# Speed of Light
c = 2.99792458E10
# Planck Constant
h = 6.6260755E-27
# Gravitational Constant
G = 6.67259E-8
# Electron Charge
ec = 4.8032068E-10
# Electron Mass
me = 9.1093897E-28
# Proton Mass
m... | mubdi/MubdiScripts | mubdiscripts/astroconsts.py | Python | bsd-3-clause | 1,142 |
from sympy.core import (S, pi, oo, symbols, Function, Rational, Integer, Tuple,
Derivative, Eq, Ne, Le, Lt, Gt, Ge)
from sympy.integrals import Integral
from sympy.concrete import Sum
from sympy.functions import (exp, sin, cos, fresnelc, fresnels, conjugate, Max,
Min... | kaushik94/sympy | sympy/printing/tests/test_mathematica.py | Python | bsd-3-clause | 10,933 |
#!/usr/bin/env python3
import sys
from osmium.replication import server
if __name__ == '__main__':
if len(sys.argv) != 3:
print("Usage: python check_server_for_updates.py <server url> <sequence id>")
sys.exit(254)
seqid = int(sys.argv[2])
state = server.ReplicationServer(sys.argv[1]).get... | openstreetmap/Nominatim | utils/check_server_for_updates.py | Python | gpl-2.0 | 629 |
# third party
import pyperf
# relative
from .bench_constructor import create_bench_sept_constructor
from .bench_deserialization import create_bench_sept_deserialize
from .bench_serialization import create_bench_sept_serialize
def run_sept_suite(runner: pyperf.Runner, rows, cols, lower_bound, upper_bound):
create... | OpenMined/PySyft | benchmarks/syft_benchmarks/septs/suite.py | Python | apache-2.0 | 548 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2014 Elico Corp (<http://www.elico-corp.com>)
# Alex Duan <alex.duan@elico-corp.com>
#
# This program is free software: you can redistribut... | udayinfy/openerp-7.0 | stock_landed_costs/tests/test_landed_costs.py | Python | agpl-3.0 | 1,946 |
#!/usr/bin/env python
"""Program entry point"""
from __future__ import print_function
import argparse
import sys
import wx
from runescape_price_watch import metadata
from runescape_price_watch.gui import MainFrame
def main(argv):
"""Program entry point.
:param argv: command-line arguments
:type argv: ... | ryanmoyer/runescape-price-watch | runescape_price_watch/main.py | Python | gpl-3.0 | 1,469 |
# Copyright 2016 James Hensman
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | jameshensman/VFF | experiments/simple_regression/figure.py | Python | apache-2.0 | 2,416 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# streamondemand - XBMC Plugin
# XBMC Tools
# http://blog.tvalacarta.info/plugin-xbmc/streamondemand/
# Modificado por super_berny: inclusion de infoLabels
#------------------------------------------------------------
import urllib, ... | dentaku65/plugin.video.sod | platformcode/xbmctools.py | Python | gpl-3.0 | 40,049 |
import config
import twitter
import time
import random
class colors:
HEADER = '\033[95m' if config.print_in_color else ""
OKBLUE = '\033[94m' if config.print_in_color else ""
OKGREEN = '\033[92m' if config.print_in_color else ""
WARNING = '\033[93m' if config.print_in_color else ""
FAIL = '\033[91... | imdiegoestevez/Twitter-Giveaways-Bot | main.py | Python | mit | 8,698 |
# This module is for compatibility only. All functions are defined elsewhere.
__all__ = ['rand', 'tril', 'trapz', 'hanning', 'rot90', 'triu', 'diff', 'angle',
'roots', 'ptp', 'kaiser', 'randn', 'cumprod', 'diag', 'msort',
'LinearAlgebra', 'RandomArray', 'prod', 'std', 'hamming', 'flipud',
... | beiko-lab/gengis | bin/Lib/site-packages/numpy/oldnumeric/mlab.py | Python | gpl-3.0 | 3,566 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yc/code/calibre/calibre/src/calibre/gui2/preferences/look_feel.ui'
#
# Created: Thu Oct 25 16:54:55 2012
# by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui... | yeyanchao/calibre | src/calibre/gui2/preferences/look_feel_ui.py | Python | gpl-3.0 | 19,303 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "varnish.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| haandol/python-varnish-example | manage.py | Python | apache-2.0 | 250 |
from heuristicSearch.planners.island_astar import IslandAstar
from heuristicSearch.envs.island_env import IslandGridEnvironment
from heuristicSearch.envs.occupancy_grid import OccupancyGrid
from heuristicSearch.graph.node import Node
from heuristicSearch.heuristics.island_heuristic import IslandHeuristic
from heuristic... | shivamvats/graphSearch | main_island.py | Python | mit | 2,825 |
from django.contrib import admin
from featureflipper.models import Feature
class FeatureAdmin(admin.ModelAdmin):
list_display = ('name', 'description', 'status')
def enable_features(self, request, queryset):
for feature in queryset:
feature.enable()
feature.save()
sel... | tobych/django-feature-flipper | featureflipper/admin.py | Python | apache-2.0 | 1,161 |
"""
Extension 2 (ext2)
Used in Linux systems
"""
from construct import *
Char = SLInt8
UChar = ULInt8
Short = SLInt16
UShort = ULInt16
Long = SLInt32
ULong = ULInt32
def BlockPointer(name):
return Struct(name,
ULong("block_number"),
OnDemandPointer(lambda ctx: ctx["block_number"]... | larsks/pydonet | lib/pydonet/construct/formats/filesystem/ext2.py | Python | gpl-2.0 | 3,167 |
"""
.. _tut-inverse-methods:
Source localization with MNE/dSPM/sLORETA/eLORETA
=================================================
The aim of this tutorial is to teach you how to compute and apply a linear
minimum-norm inverse method on evoked/raw/epochs data.
"""
import os.path as op
import numpy as np
import matplo... | mne-tools/mne-tools.github.io | 0.23/_downloads/bbc4594eea14cf3d0473ec5148e21b09/30_mne_dspm_loreta.py | Python | bsd-3-clause | 5,669 |
#!/usr/bin/env python
# encoding: utf-8
"""
Author(s): Matthew Loper
See LICENCE.txt for licensing and contact information.
"""
import numpy as np
import unittest
from .ch import Ch
class TestLinalg(unittest.TestCase):
def setUp(self):
np.random.seed(0)
def test_slogdet(self):
from . i... | mattloper/chumpy | chumpy/test_linalg.py | Python | mit | 8,103 |
# coding=utf-8
# 1. generate velocity and force nodes of sphere using MATLAB,
# 2. for each force node, get b, solve surrounding velocity boundary condition (pipe and cover, named boundary velocity) using formula from Liron's paper, save .mat file
# 3. read .mat file, for each boundary velocity, solve associated bounda... | pcmagic/stokes_flow | ecoli_in_pipe/tail_U.py | Python | mit | 9,601 |
#!/usr/bin/python
#
# This utility cover two needs of the admin:
#
# 1) generate authentication URL
# 2) submit PIN to complete registration
import base
import sys
import random
def do_init(initiative_name):
print "Initializing: %s" % initiative_name
# this at least go interactive and return a message/erro... | vecna/mic-CHECK | adminutils.py | Python | cc0-1.0 | 2,975 |
import requests
from at_helper.version import Version
class Modpack:
slug = None
version_data = None
api = 'https://api.atlauncher.com/v1/'
def __init__(self, slug):
"""
Creates a modpack object, using the given slug.
Args:
slug: Slug for the modpack, same as the... | MCProHosting/at-helper | at_helper/modpack.py | Python | mit | 2,463 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | ramondelafuente/ansible | lib/ansible/module_utils/basic.py | Python | gpl-3.0 | 86,695 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... | dliessi/frescobaldi | frescobaldi_app/highlight2html.py | Python | gpl-2.0 | 3,289 |
# -*- coding: utf-8 -*-
import numpy as np
import numpy.ma as ma
import itertools
import scipy.optimize
from pytmatrix.psd import GammaPSD
import csv
import datetime
from netCDF4 import Dataset
from ..DropSizeDistribution import DropSizeDistribution
from ..io import common
import os
def read_arm_jwd_b1(filename):
... | josephhardinee/PyDisdrometer | pydsd/aux_readers/ARM_JWD_Reader.py | Python | lgpl-2.1 | 4,075 |
__all__ = ['DelimitedTextReader', 'DelimitedPointsReaderBase', 'XYZTextReader']
__displayname__ = 'Delimited File I/O'
import sys
import numpy as np
import pandas as pd
from .. import _helpers, interface
from ..base import ReaderBase
if sys.version_info < (3,):
from StringIO import StringIO
else:
from io i... | banesullivan/ParaViewGeophysics | PVGeo/readers/delimited.py | Python | bsd-3-clause | 10,331 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
Created on 2016年10月1日
@author: Jimmy Liu
@group : waditu
@contact: jimmysoa@sina.cn
'''
import json
import time
import six
def nowtime_str():
return time.time() * 1000
def get_jdata(txtdata):
txtdata = txtdata.content
if six.PY3:
txtdata = txtda... | changbindu/rufeng-finance | src/tushare/tushare/trader/utils.py | Python | lgpl-3.0 | 406 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.