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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# mkinitcpio.py
#
# This file was forked from Cnchi (graphical installer from Antergos)
# Check it at https://github.com/antergos
#
# Copyright 2013 Antergos (http://antergos.com/)
# Copyright 2013 Manjaro (http://manjaro.org)
#
# This program is free software; you ... | manjaro/thus | thus/installation/mkinitcpio.py | Python | gpl-3.0 | 4,193 |
########
# Copyright (c) 2013-2019 Cloudify Platform Ltd. 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 ... | cloudify-cosmo/cloudify-manager | tests/integration_tests/tests/agent_tests/test_list_agents.py | Python | apache-2.0 | 4,392 |
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
import ray
from ray.rllib import _register_all
from ray.tune import Trainable
from ray.tune.ray_trial_executor import RayTrialExecutor
from ray.tune.registry import _global_regi... | atumanov/ray | python/ray/tune/tests/test_ray_trial_executor.py | Python | apache-2.0 | 4,502 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import random
import glob
import os
import sys
import time
import math
import numpy
import pylab
from collections import Counter
from svmutil import *
N_MONTH = 4
N_DAY_PER_MONTH = 31
BASE_MONTH = 4
TYPE_LENGTH = 4
class User(object):
def __init__(sel... | wait4pumpkin/tmall | solution/analysis/times_buy.py | Python | mit | 3,028 |
## begin license ##
#
# "Weightless" is a High Performance Asynchronous Networking Library. See http://weightless.io
#
# Copyright (C) 2012-2013, 2017, 2020-2021 Seecr (Seek You Too B.V.) https://seecr.nl
#
# This file is part of "Weightless"
#
# "Weightless" is free software; you can redistribute it and/or modify
# it... | seecr/weightless-core | test/lib/seecr-test-2.0/seecr/test/io.py | Python | gpl-2.0 | 2,438 |
from .enum import NamedEnum
from ...i18n import translate as t
#### Colors
COLOR_NAMES = [
'Color0',
'Color1',
'Color2',
'Color3',
]
class Color(NamedEnum):
"Represents a Gobstones color."
def enum_type(self):
"Return the name of the enumerated type."
return 'Color'
def ... | arypbatista/gobspy | gobspy/lang/builtins/types/color.py | Python | gpl-3.0 | 811 |
# Copyright 2012 OpenStack 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
#
# Unless required by applicable law or agreed to in... | rajalokan/keystone | keystone/trust/core.py | Python | apache-2.0 | 8,885 |
<<<<<<< HEAD
<<<<<<< HEAD
# Copyright (C) 2001-2007 Python Software Foundation
# Author: Barry Warsaw, Thomas Wouters, Anthony Baxter
# Contact: email-sig@python.org
"""A parser of RFC 2822 and MIME email messages."""
__all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser',
'FeedParser', 'B... | ArcherSys/ArcherSys | Lib/email/parser.py | Python | mit | 15,275 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | jackemoore/cfclient-gps-2-ebx-io | lib/cflib/crazyflie/__init__.py | Python | gpl-2.0 | 15,073 |
#!/usr/bin/python3
import os
import json
import sys
import sklearn
from sklearn import cross_validation, grid_search
from sklearn.metrics import confusion_matrix, classification_report
from sklearn.svm import SVC
from sklearn.externals import joblib
# Code credit to https://code.oursky.com/tensorflow-svm-image-classi... | mwleeds/android-malware-analysis | sklearn_svm.py | Python | gpl-3.0 | 2,430 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | ptemplier/ansible | lib/ansible/modules/network/nxos/nxos_igmp_interface.py | Python | gpl-3.0 | 25,194 |
"""
The base implementation of a backend. This provides some ABC classes.
"""
import collections
import typing
from abc import abstractmethod
from collections import OrderedDict
from urllib.parse import ParseResult, parse_qs
from asyncqlio.meta import AsyncABC
class BaseDialect:
"""
The base class for a SQL ... | SunDwarf/asyncqlio | asyncqlio/backends/base.py | Python | mit | 12,190 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# libavg - Media Playback Engine.
# Copyright (C) 2003-2011 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
# versi... | pararthshah/libavg-vaapi | src/utils/avg_checkpolygonspeed.py | Python | lgpl-2.1 | 5,103 |
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The iosxr_l2_interfaces class
It is in this file where the current configuration (as dict)
is compared to the provided configuration (as dict) and the command set
necess... | kvar/ansible | lib/ansible/module_utils/network/iosxr/config/l2_interfaces/l2_interfaces.py | Python | gpl-3.0 | 12,212 |
class GeneratorAdapter:
def visit_selector_view(self, view):
pass
def visit_selector_object(self, object, property):
pass
def visit_selector_fk_object(self, object, property, fk_properties):
pass
def visit_view(self, view):
pass
def visit_page(self, page):
... | theshammy/GenAn | src/main/common.py | Python | mit | 1,218 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | rabipanda/tensorflow | tensorflow/python/kernel_tests/variables_test.py | Python | apache-2.0 | 26,318 |
#!/usr/bin/env python
# -*- coding=utf-8 -*-
__author__ = 'wangcm' | wchming1987/Tumbler | lib/__init__.py | Python | apache-2.0 | 67 |
from prime import isPrime
listt = []
i = 1
while i <= 100:
if isPrime(i): listt = listt + [i]
i = i + 1
print 'List of primes from 1 to 100 :', listt
| brijeshrakholia/iCode | prime/list.py | Python | apache-2.0 | 155 |
'''
'''
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License");... | SolidWallOfCode/trafficserver | tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py | Python | apache-2.0 | 14,153 |
'''
This library is provided to allow standard python
logging to output log data as JSON formatted strings
ready to be shipped out to logstash.
'''
import logging
import socket
import datetime
import traceback as tb
import json
def _default_json_default(obj):
"""
Coerce everything to strings.
All objects r... | shokunin/python-logstash-formatter | logstash_formatter/__init__.py | Python | mit | 4,960 |
import json, requests, os, sys, util, load_messages, shutil, simulate
# Load the list of groups the user is a member of
print("Loading user group information")
groups = util.get_rest('groups', params={"per_page": 100})
if groups is None:
print("Unable to load user's group information")
sys.exit(1)
sim_ids = m... | Narbulus/GroupmeSimulator | setup.py | Python | mit | 2,067 |
# -*- coding: utf-8 -*-
import os
import datetime
import logging
import requests
import numpy
import cv2
import zbar
from Queue import Queue
from threading import Thread
from PIL import Image
logger = logging.getLogger(__name__)
TEMP_DIR = os.path.join(os.getcwd(), 'temp')
def get_temp_dir():
"""Create TEMP_DIR ... | globophobe/qrcodescanner-base | qrcodescanner.py | Python | mit | 10,808 |
import gensim
from gensim import corpora, models, similarities
import os
import pickle
if (os.path.exists("/afs/ir/users/r/o/rohuns/Documents/deerwester.dict")):
dictionary = corpora.Dictionary.load('/afs/ir/users/r/o/rohuns/Documents/deerwester.dict')
corpus = corpora.MmCorpus('/afs/ir/users/r/o/rohuns/Documents/co... | CareerVillage/MatchyMatchy | matchymatchy/topic_model_quality_stanford.py | Python | mit | 1,710 |
"""
You are given an n x n 2D matrix representing an image.
Rotate the image by 90 degrees (clockwise).
Follow up:
Could you do this in-place?
"""
class Solution(object):
def rotate(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-pla... | fantuanmianshi/Daily | LeetCode/rotate_image.py | Python | mit | 860 |
"""Management command to check and fix known problems."""
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.encoding import smart_str
from modoboa.admin import models
from modoboa.core.models import User
from modoboa.lib.permissions import get_object_owner, grant_a... | modoboa/modoboa | modoboa/admin/management/commands/subcommands/_repair.py | Python | isc | 4,109 |
# luks.py
# Device format classes for anaconda's storage configuration module.
#
# Copyright (C) 2009 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your optio... | icomfort/anaconda | storage/formats/luks.py | Python | gpl-2.0 | 13,213 |
# time O(n^2), space O(1)
def longest_palindrome_1(s):
if len(s) <= 1:
return s
res, start = 1, 0
for i in range(len(s)-1):
cur_len = longest_palindrome_1_helper(s, i, i)
if cur_len > res:
res = cur_len
start = i - cur_len / 2
cur_len = longest_palindr... | starcroce/PyAlgoDataStructure | string/palindrome_substring.py | Python | gpl-2.0 | 2,743 |
#!/usr/bin/python
# coding=utf-8
##########################################################################
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from diamond.collector import Collector
from haproxy import HAProx... | russss/Diamond | src/collectors/haproxy/test/testhaproxy.py | Python | mit | 3,406 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
def execute(filters=None):
if not filters: filters = {}
columns = get_columns()
last... | ShashaQin/erpnext | erpnext/accounts/report/item_wise_sales_register/item_wise_sales_register.py | Python | agpl-3.0 | 4,918 |
from __future__ import print_function
from itertools import product
import numpy as np
try:
from cpartition import filter_to_indices
except ImportError:
def filter_to_indices(filter_value):
return filter_value.nonzero()[0]
try:
from cpartition import group_indices_nd
def partition_nd(column... | LouisePaulDelvaux/Til-Liam | src_liam/partition.py | Python | gpl-3.0 | 5,382 |
# coding: utf-8
"""
likes.py
~~~~~~~~
返回点赞数的API
"""
from . import api
from muxiwebsite.models import Blog
from flask import jsonify
from muxiwebsite import db
@api.route('/blog/<int:id>/likes/')
def blog_id_likes(id):
"""返回特定id博客"""
blog = Blog.query.get_or_404(id)
return jsonify({
... | Muxi-Studio/muxi_site | muxiwebsite/api/likes.py | Python | mit | 658 |
"""
Code for processing datasets using scikit-learn.
"""
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import RidgeC... | evanfeinberg/deep-learning | deepchem/models/standard.py | Python | lgpl-3.0 | 3,449 |
"""
The game_state entities module contains the classes that represent
game entities for suspects, weapons, rooms, hallways, game cards,
and the game board
"""
#constants for suspect names
SUSPECT = 'Suspect'
MUSTARD = 'Colonel Mustard'
SCARLET = 'Miss Scarlet'
PLUM = 'Professor Plum'
GREEN = 'Mr Green'
WHITE = 'Mrs ... | PyBro-JHU/Clue-Less | clueless/model/game_state.py | Python | apache-2.0 | 19,469 |
# -*- 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 'BillStage.stage'
db.delete_column(u'bills_billstage', 'stage')
def backwards(self, o... | adieyal/billtracker | code/billtracker/bills/migrations/0005_auto__del_field_billstage_stage.py | Python | bsd-3-clause | 3,234 |
#
# webgateway/views.py - django application view handling functions
#
# Copyright (c) 2007, 2008, 2009 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle, which states you are
# free to use i... | rleigh-dundee/openmicroscopy | components/tools/OmeroWeb/omeroweb/webgateway/views.py | Python | gpl-2.0 | 64,885 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | QISKit/qiskit-sdk-py | qiskit/circuit/parametertable.py | Python | apache-2.0 | 1,775 |
from jinja2.utils import soft_unicode
from ansible.utils.hashing import md5s, checksum_s
def mac_address(value):
"""
Generate a Mac address from a String (used for kvm mac adress and proxmox).
"""
_md5string = md5s(value)
return ':'.join(["02" , _md5string[0:2], _md5string[2:4], _md5string[4:6], _m... | Silca/silca-mapr-ansible | filter_plugins/mac_address.py | Python | gpl-3.0 | 501 |
#
# Copyright (c) 2009-2016 Tom Keffer <tkeffer@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
"""Statistical accumulators. They accumulate the highs, lows, averages,
etc., of a sequence of records."""
import math
import configobj
import weewx
class OutOfSpan(ValueError):
"""Raised when a... | MLAB-project/weewx | bin/weewx/accum.py | Python | gpl-3.0 | 20,546 |
#!/usr/bin/python
"""
notifier module for feedIO. Used to notify the user of new feed updates and other
events of the application.
"""
__version__ = "0.0.5"
__license__ = """
Copyright (C) 2011 Sri Lanka Institute of Information Technology.
feedIO is free software: you can redistribute it and/or modify
... | seejay/feedIO | feedio/notifier.py | Python | gpl-3.0 | 2,280 |
# -*- encoding: utf-8 -*-
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.views.generic import (
CreateView,
DeleteView,
DetailView,
ListView,
UpdateView,
... | pkimber/old-contact-migrated-to-gitlab | contact/views.py | Python | apache-2.0 | 1,998 |
'''
This step creates topics from extracted terms, counting occurrences
and basic statistics.
==============================================================================
IN
==============================================================================
::
Paper = {
raw_text
flag_term_extraction... | insight-unlp/domainmodeller | domainmodeller/steps/TopicCreationStep.py | Python | agpl-3.0 | 8,690 |
# encoding: utf8
# cli.py
import click
import logging
from miptclass import models
from miptclass.miner import mine_reference_groups
@click.group()
def main():
logging.basicConfig(
format='%(asctime)s : %(levelname)s : %(message)s',
level=logging.INFO)
@main.command(help='Run webser... | daskol/mipt-classifier | miptclass/cli.py | Python | mit | 464 |
from __future__ import absolute_import
import re
from functools import partial
from six import text_type
from typing import Any, Callable
from django.http import HttpRequest, HttpResponse
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success
from zerver.models import Client, Use... | vikas-parashar/zulip | zerver/views/webhooks/github_webhook.py | Python | apache-2.0 | 13,089 |
#!/usr/bin/env python
import rospy
import tf
from geometry_msgs.msg import PoseStamped
from flexbe_core import EventState, Logger
'''
Created on 09/02/2015
@author: Achim Stein
'''
class GetTFTransformState(EventState):
'''
Retrieves the transformation between two frames
># frames string[] frames[0] = targ... | team-vigir/vigir_behaviors | vigir_flexbe_states/src/vigir_flexbe_states/get_tf_transform_state.py | Python | bsd-3-clause | 2,015 |
t=input()
for i in range(t):
w,b=map(int,raw_input().split())
if b%2==0:
print '0.000000'
else:
print '1.000000' | ProgDan/maratona | SPOJ/IITKWPCN.py | Python | gpl-3.0 | 140 |
# completion.py - completion management of cmdline.
#
# Copyright (C) 2010-2011 anmitsu <anmitsu.s@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; either version 2 of the License, o... | anmitsu/pyful | pyful/completion/__init__.py | Python | gpl-2.0 | 13,243 |
"""
Localization
"""
import logging
import os
import time
from bmconfigparser import BMConfigParser
logger = logging.getLogger('default')
DEFAULT_ENCODING = 'ISO8859-1'
DEFAULT_LANGUAGE = 'en_US'
DEFAULT_TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
encoding = DEFAULT_ENCODING
language = DEFAULT_LANGUAGE
windowsLanguageMap =... | PeterSurda/PyBitmessage | src/l10n.py | Python | mit | 4,456 |
import logging
from tavrida import config
from tavrida import discovery
from tavrida import dispatcher
from tavrida import server
from tavrida import service
logging.basicConfig(level=logging.INFO)
@dispatcher.rpc_service("test_hello")
class HelloController(service.ServiceController):
@dispatcher.rpc_method(se... | sbunatyan/tavrida | examples/2_friends/hello_server.py | Python | apache-2.0 | 2,966 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hicks_glossary', '0003_auto_20151012_2224'),
]
operations = [
migrations.AlterField(
model_name='definition',
... | sgarrad/hicks | hicks/hicks_glossary/migrations/0004_auto_20151012_2231.py | Python | gpl-3.0 | 432 |
#encoding: utf-8
from flask import Flask
from flask_babel import Babel
from flask_login import LoginManager
from flask_restful import Api
from app import db
app = Flask(__name__, template_folder='app/view')
app.config.from_object('config')
if 'JINJA_ENV' in app.config:
app.jinja_env.trim_blocks = app.config['JIN... | OyatProject/oyat | server.py | Python | agpl-3.0 | 1,074 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_job_executions_operations.py | Python | mit | 41,324 |
from tensorflow.python.ops import rnn_cell_impl
from tensorflow.python.ops import init_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import variable_scope as vs
from tensorflow.python.framework.ops impor... | m-colombo/Tensorflow-EchoStateNetwork | esn_cell.py | Python | mit | 4,723 |
#!/usr/bin/env python
""" Quick run Estuary model """
import matplotlib.pyplot as plt
from app.estuary import EstuaryModel, basic_tidal_flow, quick_plot
model = EstuaryModel(1e9, 35., 20., 231.2,
#tide_func=basic_tidal_flow,
)
result = model.run_model()
# Convert index from ... | darothen/blb_estuary | quick.py | Python | mit | 408 |
# shipHybridDamageBonusCF
#
# Used by:
# Ship: Raptor
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Small Hybrid Turret"),
"damageMultiplier", ship.getModifiedItemAttr("shipBonusCF"), skill="Caldari Frigate")
| bsmr-eve/Pyfa | eos/effects/shiphybriddamagebonuscf.py | Python | gpl-3.0 | 319 |
# This file is part of OMG-tools.
#
# OMG-tools -- Optimal Motion Generation-tools
# Copyright (C) 2016 Ruben Van Parys & Tim Mercy, KU Leuven.
# All rights reserved.
#
# OMG-tools 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... | meco-group/omg-tools | examples/rendezvous_holonomic_export.py | Python | lgpl-3.0 | 3,412 |
import numpy as np
import theano
import theano.tensor as T
class CostFunc:
"""
General cost function base class.
Y: result from forward network.
tY: the given true result.
"""
@staticmethod
def cost(Y, tY):
raise Exception("Cost function base class.")
class TwoStageCost(CostFunc)... | aissehust/sesame-paste-noodle | mlbase/cost.py | Python | bsd-3-clause | 2,257 |
# Patchwork - automated patch tracking system
# Copyright (C) 2016 Linaro Corporation
#
# SPDX-License-Identifier: GPL-2.0-or-later
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.views import APIView
class IndexView(APIView):
def get(self, request, *a... | stephenfin/patchwork | patchwork/api/index.py | Python | gpl-2.0 | 942 |
#!/usr/bin/env python
## \file parse_config.py
# \brief Builds a worksheet of all SU2.cpp options
# \author A. Aranake, F. Palacios
# \version 6.1.0 "Falcon"
#
# The current SU2 release has been coordinated by the
# SU2 International Developers Society <www.su2devsociety.org>
# with selected contributions from the... | drewkett/SU2 | SU2_PY/parse_config.py | Python | lgpl-2.1 | 9,482 |
def twoMoviesForTime(flight_length, movie_lengths):
lengthsMap = {}
for movie in movie_lengths:
left = flight_length - movie
if left in lengthsMap:
return True
if movie in lengthsMap:
lengthsMap[movie] += 1
else:
lengthsMap[movie] = 1
r... | katchengli/tech-interview-prep | interview_cake/ic14.py | Python | apache-2.0 | 571 |
'''
Created on 28 jul 2013
@author: monk
'''
import pygame
import pygame.camera
from pygame.locals import *
pygame.init()
pygame.camera.init()
cams=pygame.camera.list_cameras()
cam = pygame.camera.Camera(cams[0])
cam.start()
image = cam.get_image()
pygame.image.save(image,"filename.jpg") | hanabishi/pythoncam | testcode/camtest.py | Python | mit | 293 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2014 Jim Zhan <jim.zhan@me.com>
#
# 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
... | jimzhan/tornext | tornext/sharding.py | Python | apache-2.0 | 3,329 |
from django.conf.urls import patterns, include, url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.conf import settings
import socketio.sdjango
from fabric_bolt.core import views
socketio.sdjango.autodiscover()
admin.autodiscover()
urlpatterns = patterns(
'',
(... | viable-hartman/DashboardDirector | fabric_bolt/core/urls.py | Python | mit | 1,456 |
from datetime import datetime, timedelta as td
from string import swapcase
from cachecow.decorators import cached_function
from django.conf import settings
from django.db.models.signals import post_save
from django.shortcuts import get_object_or_404, Http404
from django.utils.translation import ugettext, ugettext_lazy... | drawquest/drawquest-web | website/drawquest/models.py | Python | bsd-3-clause | 12,929 |
# Created by GeoScan Ltd. (http://geoscan.aero)
#
# This is python script for Metashape Pro. Scripts repository: https://github.com/agisoft-llc/metashape-scripts
import Metashape as ps
import math, time
# Checking compatibility
compatible_major_version = "1.5"
found_major_version = ".".join(ps.app.version.split('.')[... | agisoft-llc/photoscan-scripts | src/quick_layout.py | Python | mit | 7,373 |
class LastpassSharedFolder:
def __init__(self, id, name, members=None, teams=None):
self.id = id
self.name = name
self.members = members
self.teams = teams
| Keeper-Security/Commander | keepercommander/importer/lastpass/shared_folder.py | Python | mit | 192 |
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates an .isolate given a list of files.
"""
import argparse
import os
import pprint
import re
import sys
_UNIVERSAL_BLACKLIST... | axinging/chromium-crosswalk | testing/generate_isolate.py | Python | bsd-3-clause | 3,704 |
# Copyright (c) 2016 Gabriel Casarin da Silva, All Rights Reserved.
from comum.simulador import SimuladorAutomatoPilhaEstruturado
class analisador_sintatico(SimuladorAutomatoPilhaEstruturado):
def __init__(self, automato, analisador_lexico, gerador_codigo, log=False):
super(analisador_sintatico, self)._... | GabrielCasarin/Allegri | comum/compilador/analise_sintatica.py | Python | gpl-3.0 | 1,163 |
import sys
import warnings
import os.path
from pkg_resources import resource_filename
from opencanary.honeycred import *
class CanaryService(object):
NAME = 'baseservice'
def __init__(self,config=None, logger=None):
self.config = config
self.logger = logger
self.logtype = None
... | tdr130/opencanary | opencanary/modules/__init__.py | Python | bsd-3-clause | 4,491 |
#!/usr/bin/env python
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of GNUHAWK.
#
# GNUHAWK is free software: you can redistribute it and/or modify is under the
# terms of the GNU General Public License as published by ... | RedhawkSDR/integration-gnuhawk | components/mpsk_snr_est_cc/tests/test_mpsk_snr_est_cc.py | Python | gpl-3.0 | 4,073 |
# -*- coding: utf-8 -*-
#
# This file is part of EventGhost.
# Copyright (C) 2005-2009 Lars-Peter Voss <bitmonster@eventghost.org>
#
# EventGhost 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... | garbear/EventGhost | tools/builder/CreateLibrary.py | Python | gpl-2.0 | 5,757 |
#!/usr/bin/env python
"""Classes and modules for cylindrical BOUT++ Clebsch system"""
from collections import deque
from IPython.display import display
from sympy import symbols, simplify
from sympy import Eq, Derivative, Matrix
from sympy import sqrt
from sympy import Rational as R
from common import cartCoord, car... | CELMA-project/CELMA | derivations/divOfExBOperator/clebschVector.py | Python | lgpl-3.0 | 21,276 |
"""edit_image_area.py - The area of the editing archive window that displays images."""
import os
import gtk
from mcomix import i18n
from mcomix import image_tools
from mcomix import thumbnail_tools
from mcomix import thumbnail_view
from mcomix.preferences import prefs
class _ImageArea(gtk.ScrolledWindow):
"""T... | HoverHell/mcomix-0 | mcomix/edit_image_area.py | Python | gpl-2.0 | 5,790 |
"""Class: Printer."""
import ast
import sys
import astunparse
import typed_ast.ast3
class Printer(astunparse.Printer):
"""Partial rewrite of Printer from astunparse to handle typed_ast.ast3-based trees."""
def __init__(
self, file=sys.stdout, indent=" ", annotate_fields: bool = True,
... | mbdevpl/typed-astunparse | typed_astunparse/printer.py | Python | apache-2.0 | 2,162 |
import urllib2
import re
import datetime
from bs4 import BeautifulSoup
import json
import sys
baseUrl = 'http://www.dotnetrocks.com/'
title = 'dotnetorocks scraper'
usage = 'usage: parser.py command\n\ncommand:\n\t\tdownload-all - downloads all episodes info\n'
def getGuest(title):
phrase = re.search('with\s+(.*)', ... | pawlos/dnr-visualizer | parser.py | Python | mit | 2,125 |
''' Tasks related to our celery functions '''
import time
import random
import datetime
import numpy as np
from io import BytesIO
from celery import Celery, current_task
from celery.result import AsyncResult
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from matplotlib.figure import Figur... | will-jj/strava_flask | tasks.py | Python | bsd-3-clause | 6,262 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import datetime as dt
import mock
import httplib as http
import pytz
from django.utils import timezone
from nose.tools import * # noqa PEP8 asserts
from modularodm import Q
from framework.exceptions import HTTPError
from website.... | mluo613/osf.io | tests/test_registrations/test_views.py | Python | apache-2.0 | 22,433 |
#Author : Yashdeep Hinge
def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
def print_two_again(arg1, arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)
def print_one(arg1):
print "arg1: %r" % arg1
def print_none():
print "I got nothin'."
print_two("Zed","Shaw")
print_two_again("Z... | yashdeeph709/Algorithms | HardPython/functions1.py | Python | apache-2.0 | 366 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_auto_20150216_1953'),
]
operations = [
migrations.AlterField(
model_name='comment',
nam... | codefisher/djangopress | djangopress/blog/migrations/0004_auto_20150426_1817.py | Python | mit | 449 |
#!/usr/bin/python3
'''
Create the .daisy folder and it's contents from a tgz file of
defaults and examples.
'''
'''
Install necessary dependancies.
'''
'''
TODO: move things from setup.sh to here in python
'''
| PumpkinPai/daisy | setup.py | Python | gpl-3.0 | 213 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'wallpaper.ui'
#
# Created by: PyQt5 UI code generator 5.4.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjec... | gimu/hitagi-reader | hitagilib/ui/wallpaper.py | Python | mit | 2,887 |
import unittest
class Empty(Exception):
pass
class LinkedStack:
class _Node:
__slots__ = '_element', '_next'
def __init__(self, element, next):
self._element = element
self._next = next
def __init__(self):
# Use of a header sentinel
self._header =... | jward6/academics-python | datastructures/LinkedStack.py | Python | mit | 1,659 |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
operations = [
migrations.CreateModel(
name='College',
fields=[... | tjcsl/ion | intranet/apps/seniors/migrations/0001_initial.py | Python | gpl-2.0 | 11,095 |
from ..broker import Broker
class ConfigTemplateBroker(Broker):
controller = "config_templates"
def index(self, **kwargs):
"""Lists the available config templates. Any of the inputs listed may be be used to narrow the list; other inputs will be ignored. Of the various ways to query lists, using this ... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v2_4_0/config_template_broker.py | Python | apache-2.0 | 62,461 |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1I6300E... | kubevirt/client-python | kubevirt/models/v1_i6300_esb_watchdog.py | Python | apache-2.0 | 3,157 |
baz = [1, 2]
a = (
el # comment
if el >= 0
else -el
for el in baz
)
foo = bar(*a) | asedunov/intellij-community | python/testData/refactoring/introduceVariable/generatorExpressionWithCommentNotInlined.after.py | Python | apache-2.0 | 98 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('dialogs', '0005_auto_20140908_0354'),
]
operations = [
migrations.AlterField(
m... | null-none/OpenGain | default_set/dialogs/migrations/0006_auto_20140909_1131.py | Python | gpl-2.0 | 508 |
from .MidiOutFile import MidiOutFile
from .MidiInFile import MidiInFile
"""
This is an example of the smallest possible type 0 midi file, where
all the midi events are in the same track.
"""
class Transposer(MidiOutFile):
"Transposes all notes by 1 octave"
def _transp(self, ch, note):
if c... | JonathanRaiman/Dali | data/score_informed_transcription/midi/example_transpose_octave.py | Python | mit | 1,038 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
from... | baroquebobcat/pants | src/python/pants/backend/jvm/subsystems/jvm_platform.py | Python | apache-2.0 | 10,154 |
from resources.lib.nfl2018 import NFL2018
class Team(NFL2018):
short = "cardinals"
hostname = "www.azcardinals.com"
def __init__(self, parameters):
self.parameters = parameters
NFL2018.__init__(self)
| Tenzer/plugin.video.nfl-teams | resources/lib/teams/cardinals.py | Python | mit | 231 |
"""
The :mod:`sklearn.compose._column_transformer` module implements utilities
to work with heterogeneous data and to apply different transformers to
different columns.
"""
# Author: Andreas Mueller
# Joris Van den Bossche
# License: BSD
from itertools import chain
import numpy as np
from scipy import sparse
f... | lesteve/scikit-learn | sklearn/compose/_column_transformer.py | Python | bsd-3-clause | 33,146 |
#!/usr/bin/env python
# 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/.
import re
from distutils.version import Version
class FirefoxVersion(Version):
"""Version nu... | Tayamarn/socorro | e2e-tests/pages/version.py | Python | mpl-2.0 | 3,825 |
def extractYanyantlsWordpressCom(item):
'''
Parser for 'yanyantls.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('the star light shines when he came', 'the star light shines... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractYanyantlsWordpressCom.py | Python | bsd-3-clause | 801 |
from django.db import reset_queries, close_old_connections
from spinach import signals
from .apps import spin
@signals.job_started.connect_via(spin.namespace)
def job_started(*args, job=None, **kwargs):
reset_queries()
close_old_connections()
@signals.job_finished.connect_via(spin.namespace)
def job_finis... | NicolasLM/spinach | spinach/contrib/spinachd/signals.py | Python | bsd-2-clause | 380 |
"""Word Madness URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | degustaf/IC_002 | WordMadness/urls.py | Python | gpl-2.0 | 937 |
#!/usr/bin/python2
#!/software/pub/python-2.3.3/bin/python
"""
MetPX Copyright (C) 2004-2006 Environment Canada
MetPX comes with ABSOLUTELY NO WARRANTY; For details type see the file
named COPYING in the root of the source directory tree.
"""
##########################################################################... | khosrow/metpx | columbo/lib/cs/pxCircuitsTab.py | Python | gpl-2.0 | 4,697 |
# -*- encoding: utf-8 -*-
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 Tiny SPRL (http://tiny.be). All Rights Reserved
#
# This module,
# Copyright (C) 2015 Jordi Llinares López - bigandopen@bigandopen.com
#
# This program is free software: you can redistribute it and/or modify
# ... | jordillinares/addons | footer_discount/__init__.py | Python | agpl-3.0 | 929 |
import logging, time, uuid, requests, base64
from pysnap import Snapchat
from pysnap.utils import make_request_token, timestamp
from snap import Snap
from constants import DEFAULT_TIMEOUT, STATIC_TOKEN, BASE_URL
FORMAT = '[%(asctime)-15s] %(message)s'
logging.basicConfig(format=FORMAT)
logger = logging.getLogger()
log... | Dshinkorenko/SN | snapchat_bots/bot.py | Python | mit | 6,980 |
import ConfigParser
class Options(ConfigParser.SafeConfigParser):
def __init__(self, config_file, env):
"""
:param config_file:
:param env:
"""
ConfigParser.SafeConfigParser.__init__(self)
self.readfp(open(config_file))
self.env = env
| davestarling/cb_fts_slackbot | lib/options.py | Python | mit | 300 |
"""
=====================================================================
Formalign.eu format and display multiple sequence alignments
Copyright (C) 2016 Stefan Dieterle
e-mail: golgoths@yahoo.fr
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License a... | globz-eu/django_base | functional_tests/__init__.py | Python | gpl-3.0 | 915 |
import json
import re
from behave import given, when, then
from behave import use_step_matcher
use_step_matcher("re")
# implicitly used
import sure # noqa
# We use this instead of validator from json_schema_generator
# because its error reports are far better
from jsonschema import validate
from _lazy_request import... | sunForest/AviPost | e2e/features/steps/crud.py | Python | apache-2.0 | 2,306 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.