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 |
|---|---|---|---|---|---|
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import datetime
import itertools
import os
import subprocess
im... | hipnusleo/laserjet | resource/pypi/cryptography-1.7.1/tests/hazmat/backends/test_openssl.py | Python | apache-2.0 | 28,781 |
# coding: utf-8
import os
DEBUG = os.environ.get('LEANCLOUD_APP_ENV') != 'production'
ROOT_URLCONF = 'urls'
#SECRET_KEY = 'replace-this-with-your-secret-key'
SECRET_KEY = 'i7htv7k^=hxl-8uho4pf$)uurkcc3wfxs((cg6+l#k57vgl4zl'
ALLOWED_HOSTS = ['*']
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTe... | xingzhe25/testLeanCloud | settings.py | Python | mit | 510 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtSql import *
import meshandler
from dbpool import *
class QueryRunner(QThread):
def __init__(self, query, parent=None):
super(QueryRunner, self).__init__(parent)
self.query =... | sshmakov/conopy | examples/habr2/executor.py | Python | mit | 5,935 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from collections import defaultdict
import csv
from os.path import dirname, join
import re
from mapit.models import Area, Geometry, NameType, Type
from django.contrib.gis.geos import GEOSGeometry
from django.core.management import BaseC... | mysociety/pombola | pombola/nigeria/management/commands/nigeria_fix_senatorial_districts.py | Python | agpl-3.0 | 8,748 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
from datetime import datetime
import pytest... | claudep/pootle | tests/core/utils/timezone.py | Python | gpl-3.0 | 4,817 |
import pysal.core.FileIO as FileIO
errmsg = ''
try:
try:
from geomet import wkb
except ImportError:
from shapely import wkb
except ImportError:
wkb = None
errmsg += ('No WKB parser found. Please install one of the following packages '
'to enable this functionality: [geomet, ... | pastephens/pysal | pysal/core/IOHandlers/db.py | Python | bsd-3-clause | 2,520 |
"""Tests for group tasks."""
# pylint: disable=invalid-name
from model_mommy import mommy
from django.utils.timezone import now
from django.test import TestCase
from django.conf import settings
from mock import patch
from open_connect.accounts.models import User, Invite
from open_connect.groups import tasks
from open_... | lpatmo/actionify_the_news | open_connect/groups/tests/test_tasks.py | Python | mit | 18,184 |
# -*- coding: utf-8 -*-
from __future__ import division
import numpy as np
from .earth import grav
from .constants import db2Pascal
from ..utilities import match_args_return
from .density_enthalpy_48 import rho_alpha_beta
__all__ = ['IPV_vs_fNsquared_ratio',
'Nsquared',
'Turner_Rsubrho']
def... | rabernat/python-gsw | gsw/gibbs/water_column_48.py | Python | mit | 11,229 |
"""
Save media files.
"""
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os
import tarfile
from django.core.management.base import CommandError
from django.core.files.storage import get_storage_class
from ._base import BaseDbBackupCommand, make_opti... | ZuluPro/django-dbbackup | dbbackup/management/commands/mediabackup.py | Python | bsd-3-clause | 4,039 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2020_08_01/operations/_network_interface_load_balancers_operations.py | Python | mit | 5,808 |
#!/usr/bin/python
from urllib import urlopen
from numpy import *
import string
import time
LONG=200
TIMEVALUE=6.0
URL="http://hq.sinajs.cn/list=AG1512"
def standRegres(xArr,yArr):
xMat = mat(xArr); yMat = mat(yArr).T
xTx = xMat.T*xMat
if linalg.det(xTx) == 0.0:
print "This matrix is singular, can... | liyatanggithub/futures | python/main.py | Python | gpl-2.0 | 1,092 |
#
# Copyright (c) 2013 Preet Kukreti
#
# Excerpt of code taken at
# http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python
import os
import sys
import stat
import tempfile
def is_case_sensitive_filesystem():
tmphandle, tmppath = tempfile.mkstemp()
is_insensitive = os.path.exists(tmppat... | quarkslab/irma | common/src/plugins/which.py | Python | apache-2.0 | 3,241 |
from idlelib.WidgetRedirector import WidgetRedirector
from idlelib.Delegator import Delegator
class Percolator:
def __init__(self, text):
# XXX would be nice to inherit from Delegator
self.text = text
self.redir = WidgetRedirector(text)
self.top = self.bottom = Delegator(text)
... | gusai-francelabs/datafari | windows/python/Lib/idlelib/Percolator.py | Python | apache-2.0 | 3,222 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-05-08 21:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization', '0003_auto_20151116_2024'),
]
operations = [
migrations.AddField(
model_name='organizati... | MuckRock/muckrock | muckrock/organization/migrations/0004_organization_private.py | Python | agpl-3.0 | 424 |
# ==================================================================================================
#
# Copyright (c) 2016, Chen Kian Wee (chenkianwee@gmail.com)
#
# This file is part of py4design
#
# py4design is free software: you can redistribute it and/or modify
# it under the terms of the GNU General ... | chenkianwee/pyliburo | py4design/massing2citygml.py | Python | gpl-3.0 | 11,373 |
# Rekall Memory Forensics
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Authors:
# Mike Auty <mike.auty@gmail.com>
# Michael Cohen <scudette@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 Sof... | dsweet04/rekall | rekall-core/rekall/plugins/imagecopy.py | Python | gpl-2.0 | 3,671 |
#!/usr/bin/python
# Nodemon - Tor node monitor
"""
Nodemon - Tor node monitor
"""
import sys
sys.path.append("../")
from TorCtl import *
import socket
import traceback
import re
from TorCtl.TorUtil import control_port, control_host
from TorCtl.TorUtil import *
import sched, time
import thread
class Reason:
def __i... | isislovecruft/torflow | NodeMonitors/nodemon.py | Python | bsd-3-clause | 6,842 |
from __future__ import unicode_literals
import re
import unicodedata
from gzip import GzipFile
from io import BytesIO
import warnings
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.encoding import force_text
from django.utils.functional import allow_lazy, SimpleLazyObject
from django.... | andersonresende/django | django/utils/text.py | Python | bsd-3-clause | 15,477 |
import numbers
from typing import Tuple, List, Optional, Sequence, Union
import PIL.Image
import torch
from torchvision.prototype import features
from torchvision.prototype.transforms import InterpolationMode
from torchvision.transforms import functional_tensor as _FT, functional_pil as _FP
from torchvision.transforms... | pytorch/vision | torchvision/prototype/transforms/functional/_geometry.py | Python | bsd-3-clause | 15,001 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... | google-research/language | language/mentionmemory/utils/test_utils.py | Python | apache-2.0 | 4,490 |
""" NOTA BENE: This agent should NOT be run alone. Instead, it serves as a base class for extensions.
The TaskManagerAgentBase is the base class to submit tasks to external systems,
monitor and update the tasks and file status in the transformation DB.
This agent is extended in WorkflowTaskAgent and Reque... | arrabito/DIRAC | TransformationSystem/Agent/TaskManagerAgentBase.py | Python | gpl-3.0 | 31,025 |
"""
Tests to cover nested serializers.
Doesn't cover model serializers.
"""
from __future__ import unicode_literals
from django.test import TestCase
from rest_framework import serializers
class WritableNestedSerializerBasicTests(TestCase):
"""
Tests for deserializing nested entities.
Basic tests that use... | jicksy/oneanddone_test | vendor-local/lib/python/rest_framework/tests/test_serializer_nested.py | Python | mpl-2.0 | 11,243 |
# -*- coding: utf-8 -*-
#
# (c) 2017 Red Hat, Inc.
#
# 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 ... | alxgu/ansible | test/units/module_utils/network/common/test_utils.py | Python | gpl-3.0 | 6,127 |
"""
WSGI config for Biblioteka project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Biblioteka.settings")
from django.... | DamianMusiala/Biblioteka | Biblioteka/wsgi.py | Python | mit | 395 |
# Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from ..azure_common import BaseTest, arm_template
class AksTest(BaseTest):
def setUp(self):
super(AksTest, self).setUp()
def test_aks_schema_validate(self):
with self.sign_out_patch():
p = self.load_pol... | thisisshi/cloud-custodian | tools/c7n_azure/tests_azure/tests_resources/test_aks.py | Python | apache-2.0 | 938 |
#!/usr/bin/env python
#Copyright 2007 Sebastian Hagen
# This file is part of wordnet_tools.
# wordnet_tools 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
# wordnet_tools is distributed in the hope... | NixOS/nixpkgs | pkgs/servers/dict/wordnet_structures.py | Python | mit | 11,710 |
# -*- coding: utf-8 -*-
import os
import logging
logger = logging.getLogger(__name__)
import settings
from google.appengine.ext import ndb
from django.core.validators import URLValidator
validate_url = URLValidator()
from django.core.validators import validate_email
from django.core.validators import validate_ipv46_a... | detroitartmap/shorty | properties.py | Python | mit | 1,055 |
import socket
import unittest
import snakey
class TestTheSnake(unittest.TestCase):
def test_it_should_be_possible_to_connect_to_server(self):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
with snakey.run():
sock.connect(('127.0.0.1', 42000))
if __name__ == "__main__":
... | waynew/snake-in-the-middle | tests.py | Python | mit | 339 |
#!/usr/bin/python
###########################################################################
# mongodb_log.py - Python based ROS to MongoDB logger (multi-process)
#
# Created: Sun Dec 05 19:45:51 2010
# Copyright 2010-2012 Tim Niemueller [www.niemueller.de]
# 2010-2011 Carnegie Mellon University
# ... | Jailander/mongodb_store | mongodb_log/scripts/mongodb_log.py | Python | bsd-3-clause | 23,434 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: inertial.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
... | ryanlelek/SMORESGaitRecorder | proto/inertial_pb2.py | Python | gpl-3.0 | 4,116 |
"""
Luigi tasks for extracting course enrollment statistics from tracking log files.
"""
import luigi
import luigi.s3
import datetime
from edx.analytics.tasks.util.overwrite import OverwriteOutputMixin
from edx.analytics.tasks.mapreduce import MapReduceJobTask, MapReduceJobTaskMixin
from edx.analytics.tasks.pathutil i... | rue89-tech/edx-analytics-pipeline | edx/analytics/tasks/course_enroll.py | Python | agpl-3.0 | 12,707 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License... | sparkslabs/kamaelia_ | Sketches/RJL/Packages/Kamaelia/Community/RJL/Kamaelia/Util/ChunkNamer.py | Python | apache-2.0 | 3,315 |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, antecedents, out_attributes, user_options, num_cores,
outfile):
import os
import subprocess
from genomicode import config
... | jefftc/changlab | Betsy/Betsy/modules/download_tcga_agilent.py | Python | mit | 1,787 |
# -*- 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 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... | quattor/aquilon | lib/aquilon/worker/commands/unbind_client_cluster.py | Python | apache-2.0 | 1,222 |
def calculate_check_digit(code):
odd_pos = code[0]+code[2]+code[4]+code[6]+code[8]+code[10]
even_pos = int(code[1])+int(code[3])+int(code[5])+int(code[7])+int(code[9])
multiply_odd_by_three = int(odd_pos)*3
add_even = multiply_odd_by_three + even_pos
modulo_ten = add_even % 10
return 10 - modu... | martrik/HPCodeWarsSamples | 2014 Gabriel/prob_02.py | Python | mit | 564 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LI... | twistedogic/packstack | tests/installer/test_sequences.py | Python | apache-2.0 | 3,246 |
from __future__ import absolute_import
from .base import * # NOQA
from .handler import * # NOQA
from .manager import * # NOQA
default_manager = FeatureManager()
default_manager.add('auth:register')
default_manager.add('organizations:create')
default_manager.add('organizations:sso', OrganizationFeature)
default_ma... | felixbuenemann/sentry | src/sentry/features/__init__.py | Python | bsd-3-clause | 587 |
# -*- 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... | inspyration/odoo | addons/crm/report/crm_phonecall_report.py | Python | agpl-3.0 | 3,856 |
# flake8: noqa
from .exceptions import KubernetesException
from .kubectl import KubeCtl
from .objects import Deployment, KubeObject, Pod
from .utils import render_definition
| 4Catalyzer/pykubectl | pykubectl/__init__.py | Python | mit | 175 |
"""
Tests for Advent of Code
"""
import collections
import pytest
from . import (day1, day2, day3, day4, day5, day6, day7, day8, day9, day10,
day11, day12, day13, day14, day15, day17, day18, day19, day20,
day21, day23, day24)
def test_day_1():
version = day1.find_santas_floor_v3
... | Hwesta/advent-of-code | aoc2015/test_advent_of_code.py | Python | mit | 10,106 |
#!/usr/bin/env python
# Imports
import unittest
import os.path
import sys
import subprocess
###############################################################################
path_to_script = os.path.join(os.path.dirname(os.path.realpath(__file__)),'..','bin','enrichm')
path_to_data = os.path.join(os.path.dirname(os.pat... | geronimp/enrichM | test/test_enrichm.py | Python | gpl-3.0 | 722 |
# Copyright (c) 2012 OpenStack Foundation.
# 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... | suneeth51/neutron | neutron/tests/unit/api/v2/test_base.py | Python | apache-2.0 | 65,003 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Library for gateway tests
Copyright 2009 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import os
import omero
from omero.rtypes import rstring
from omero.gateway.scripts import dbhelpers
dbhelpers.... | jballanc/openmicroscopy | components/tools/OmeroPy/src/omero/gateway/scripts/testdb_create.py | Python | gpl-2.0 | 9,456 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2017 CERN.
#
# INSPIRE 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 ... | inspirehep/inspire-next | tests/unit/workflows/test_workflows_tasks_submission.py | Python | gpl-3.0 | 33,395 |
from django.urls import reverse
from django.utils import timezone
from django.db.models import OuterRef, Subquery, Q, Count, IntegerField
from django.conf import settings
from django.utils.text import slugify
from rest_framework import generics
from rest_framework import serializers, viewsets
from rest_framework impor... | p2pu/learning-circles | studygroups/views/drf.py | Python | mit | 7,526 |
#coding:utf8
"""
测试threading.Event
"""
import threading
import time
class TestThread(threading.Thread):
def __init__(self, name, event):
super(TestThread, self).__init__()
self.name = name
self.event = event
def run(self):
"""run:运行并等待事件通知"""
print 'Thread: ', ... | unlessbamboo/grocery-shop | language/python/src/threading/eventTest.py | Python | gpl-3.0 | 917 |
#! /usr/bin/python
# prepare environment
import sys, psycopg2, datetime
# import visualizer
import plotly.plotly as py
from plotly.graph_objs import *
py.sign_in("plotlyuser", "plotlypass")
### demo 1: just plot something
print 'demo 1, started at %s' % str(datetime.datetime.now())
cur = None
try:
con = psycopg... | awinkgit/datavis | plotly/graph_plotly.py | Python | gpl-2.0 | 3,020 |
ALPHABET = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q',
'R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7',
'8','9']
MORSE = ['.-','-...','-.-.','-..','.','..-.','--.','....','..','.---','-.-',
'.-..','--','-.','---','.--.','--.-','.-.','...','... | JuBzzz/dailyprogrammer-challenges | easy/challenge #7/morse_translator.py | Python | mit | 1,683 |
# -*- coding: utf-8 -*-
import re
import mock
import pytest
import six
from pyquery import PyQuery as pq
from six.moves.urllib_parse import parse_qs, urlparse
from olympia import amo
from olympia.addons.models import Addon
from olympia.addons.tests.test_views import TestPersonas
from olympia.amo.tests import TestCas... | aviarypl/mozilla-l10n-addons-server | src/olympia/users/tests/test_helpers.py | Python | bsd-3-clause | 5,267 |
from __future__ import absolute_import
import os
from django.db import connections
from django.test import TestCase
from django.contrib.gis.gdal import Driver
from django.contrib.gis.geometry.test_data import TEST_DATA
from django.contrib.gis.utils.ogrinspect import ogrinspect
from .models import AllOGRFields
clas... | thiriel/maps | venv/lib/python2.7/site-packages/django/contrib/gis/tests/inspectapp/tests.py | Python | bsd-3-clause | 4,848 |
"""
A palindromic number reads the same both ways. The largest palindrome made
from the product of two 2-digit numbers is 9009 = 91 x 99.
Find the largest palindrome made from the product of two 3-digit numbers.
"""
def sol_4():
"""
Find the largest palindrome made from the product of two 3-digit numbers.
... | abhyasi/euler_py | euler/sol_4.py | Python | gpl-2.0 | 1,288 |
import _plotly_utils.basevalidators
class ReversescaleValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(
self, plotly_name="reversescale", parent_name="scattercarpet.marker", **kwargs
):
super(ReversescaleValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scattercarpet/marker/_reversescale.py | Python | mit | 485 |
#!/usr/bin/env python
import sys
str = sys.stdin.read().decode('utf-8')
characters = set(str)
for c in characters:
print c.encode('utf-8')
# EOF #
| Lily-Ayta/aosc-os-abbs | extra-games/pingus/autobuild/overrides/usr/share/pingus/images/fonts/buildset.py | Python | gpl-2.0 | 155 |
# -*- coding: utf-8 -*-
"""The RPC client and server interface."""
import abc
class RPCClient(object):
"""Class that defines the RPC client interface."""
@abc.abstractmethod
def CallFunction(self):
"""Calls the function via RPC."""
@abc.abstractmethod
def Close(self):
"""Closes the RPC communicat... | ostree/plaso | plaso/multi_processing/rpc.py | Python | apache-2.0 | 1,391 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2019, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Container
########################
The :class:`~exa.core.container.Container` class is the primary object for
data processing, analysis, and visualization. In brief, containers a... | tjduigna/exa | exa/core/container.py | Python | apache-2.0 | 24,987 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_session_entity_types_list_session_entity_types_async.py | Python | apache-2.0 | 1,616 |
import asyncio
import json
from chat import User
class SlackUser(User):
def __init__(self, chatService, chatServer, user):
super(SlackUser, self).__init__(chatService, chatServer)
self.user = user
# IUser
# Identity
@property
def id(self): return self.user.id
@property
def globalId(self): return "Sl... | squahtx/hal9000 | chat/slack/slackuser.py | Python | mit | 696 |
import codecs
import os
import re
import setuptools
def read_version():
regexp = re.compile(r"^__version__\W*=\W*'([\d.]+)'")
init_py = os.path.join(os.path.dirname(__file__), 'callme', '__init__.py')
with open(init_py) as fp:
for line in fp:
match = regexp.match(line)
if ... | smurfix/callme | setup.py | Python | bsd-3-clause | 1,627 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
"""Task 02"""
def prepare_email(appointments):
"""Working on this email
Args:
appointments: A list of two-item tuples with the client's name
and their appointment time as members
Returns:
Return your new list.
"""
email = []
... | cjfernanders1986/is210-week-06-synthesizing | task_02.py | Python | mpl-2.0 | 506 |
# Copyright (C) 2020 Christopher Gearhart
# chris@bblanimation.com
# http://bblanimation.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 3 of the License, or
# (at your opt... | feureau/Small-Scripts | Blender/Blender config/2.91/scripts/addons/bricker_v2-2-1/operators/export_ldraw.py | Python | gpl-3.0 | 12,497 |
#!/usr/bin/env python
# coding:utf-8
"""
Collects data about any visible disks
"""
from classes import Drive
import sys
import subprocess
import ctypes
if sys.platform in ('Windows', 'win32', 'cygwin', 'nt'):
import win32api
__author__ = "Jesse David Dinneen"
__copyright__ = "Copyright 2015, JDD"
__license__ = "... | jddinneen/cardinal | src/disklook.py | Python | gpl-3.0 | 5,552 |
from django.utils.module_loading import import_string
class MuncherRunner:
def __init__(self, settings, filters_settings_key):
self.settings = settings
self.filters_settings_key = filters_settings_key
def process(self, *args, **kwargs):
raise NotImplementedError
class ContentMuncher... | crunchmail/munch-core | src/munch/core/mail/utils/munchers.py | Python | agpl-3.0 | 1,010 |
# 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 inspect
impor... | fkorotkov/pants | tests/python/pants_test/java/test_nailgun_io.py | Python | apache-2.0 | 2,526 |
from . import DataProvider, CampaignType
from ..geocode import Geocoder, LocationError
from ...campaign.constants import (LOCATION_POSTAL, LOCATION_ADDRESS, LOCATION_LATLON)
import logging
log = logging.getLogger(__name__)
class EUCampaignType(CampaignType):
pass
class EUCampaignType_Custom(EUCampaignType):
... | 18mr/call-congress | call_server/political_data/countries/eu.py | Python | agpl-3.0 | 1,449 |
'''
Created on 20.12.2010 by Vitaly Volkov
'''
import os
import datetime
from reggata.data.db_schema import Item, DataRef
from reggata.helpers import computeFileHash
class IntegrityFixerFactory(object):
@staticmethod
def createFixer(code, strategy, uow, repo_base_path, items_lock):
if code == Item.E... | vlkv/reggata | reggata/data/integrity_fixer.py | Python | gpl-3.0 | 9,970 |
from selenium import webdriver
from time import sleep
driver = webdriver.Firefox()
driver.get('https://google.com')
driver.set_window_size(800, 600)
sleep(5)
driver.maximize_window()
sleep(5)
driver.minimize_window()
sleep(5)
driver.quit()
| twiindan/selenium_lessons | 04_Selenium/04_browser_interactions/window_actions.py | Python | apache-2.0 | 244 |
"""Tests for the admin additions."""
from django.core.urlresolvers import reverse
import re
from test_registry._compat import mock, MagicMock
import os.path
from bs4 import BeautifulSoup
def test_main_view(admin_client):
"""Test the main admin view.
This test doesn't reach out to external services.
"""... | Tinche/django-bower-cache | test_registry/test_admin.py | Python | mit | 6,489 |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign. # noqa: E501
OpenAPI spec version: v2.1
Contact: devcenter@docusign.com
Generated by: https://github.com/swagger-api/swagger-codegen.gi... | docusign/docusign-python-client | docusign_esign/models/app_store_product.py | Python | mit | 4,127 |
# -------------------------------------------------------------------------------
# Copyright (c) 2012 Vincent Gauthier.
#
# 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,... | ComplexNetTSP/CooperativeNetworking | tests/test_levy_walk.py | Python | mit | 4,582 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-websecurityscanner | tests/unit/gapic/websecurityscanner_v1beta/test_web_security_scanner.py | Python | apache-2.0 | 194,786 |
"""
********************************************************************************
* Name: arcgis_portal.py
* Author: Shawn Crawley
* Created On: March 2, 2021
* License: BSD 2-Clause
********************************************************************************
"""
from social_core.backends.arcgis import ArcGISOAu... | tethysplatform/tethys | tethys_services/backends/arcgis_portal.py | Python | bsd-2-clause | 2,277 |
import unittest2
from lldbsuite.test.decorators import *
from lldbsuite.test.concurrent_base import ConcurrentEventsBase
from lldbsuite.test.lldbtest import TestBase
@skipIfWindows
class ConcurrentSignalDelayWatch(ConcurrentEventsBase):
mydir = ConcurrentEventsBase.compute_mydir(__file__)
@skipIfFreeBSD ... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentSignalDelayWatch.py | Python | bsd-3-clause | 769 |
from pygame import image as pyimage
from pygame import mixer
import traceback
import os
class Loader(object):
"""
Helper class to load stuff.
"""
base_path = "data"
concat_base_path = True
@staticmethod
def load_sound(path):
"""
Load and returns a sound by a given name
... | temdisponivel/temdisponivellib_pygame | temdisponivellib/loader.py | Python | mit | 1,102 |
# coding=utf-8
import os
import tempfile
import unittest2
import time
from cStringIO import StringIO
from psdash.log import Logs, LogReader, LogError, ReverseFileSearcher
class TestLogs(unittest2.TestCase):
NEEDLE = 'foobar\n'
POSITIONS = [10000, 8000, 6000, 4000, 2000, 500]
def setUp(self):
fd, ... | uaomer/psdash | tests/test_log.py | Python | cc0-1.0 | 7,877 |
# -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
#
# 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... | TribeMedia/synapse | synapse/storage/engines/__init__.py | Python | apache-2.0 | 1,215 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Example using semaphores with aiofiles."""
import asyncio
from pathlib import Path
import aiofiles
async def write_to_disk(fname, sema):
"""Async write."""
filepath = Path("files", fname)
async with sema:
async with aiofiles.open(filepath, "w+") ... | kallimachos/cookbook | recipes/semaphore.py | Python | gpl-3.0 | 1,116 |
import os
from .views import blueprint
@blueprint.app_context_processor
def inject_permissions():
show_labsys = not os.environ.get('SHOW_LABSYS') == 'False'
return dict(show_labsys=show_labsys)
| gems-uff/labsys | labsys/main/__init__.py | Python | mit | 206 |
#!/usr/bin/env python
"""
insert.py - Program to :
1. insert to outbox collection,
2. check if main is running? if not run then run
"""
print "Content-Type: text-html"
print
import cgitb
cgitb.enable()
import cgi
import smsweb
import subprocess
import json
from bson import json_util
#form = cgi.FieldStorage()
#rcp... | awangga/smsweb | comments.py | Python | agpl-3.0 | 530 |
#Задача 8. Вариант 23.
#1-50. Доработайте игру "Анаграммы" (см. М.Доусон Программируем на Python. Гл.4) так, чтобы к каждому слову полагалась подсказка. Игрок должен получать право на подсказку в том случае, если у него нет никаких предположений. Разработайте систему начисления очков, по которой бы игроки, отгадавшие с... | Mariaanisimova/pythonintask | INBa/2015/Sarocvashin_M/task_8_23.py | Python | apache-2.0 | 1,816 |
# Copyright (C) 2021 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
from copy import deepcopy
import random
from pkg_resources import... | SoftwareHeritage/swh-web-ui | swh/web/tests/test_templates.py | Python | agpl-3.0 | 2,286 |
from unittest import mock
from concurrent.futures import Future
import json
from urwintranet.ui import views, signals
from urwintranet.executor import Executor
from . import fixtures
# Auth
def login_view(username, password):
login_view = views.auth.LoginView("username", "password")
login_view._username_edit... | jespino/urwintranet | tests/factories.py | Python | apache-2.0 | 5,712 |
# -*- coding: utf-8 -*-
# +---------------------------------------------------------------------------+
# | 01001110 01100101 01110100 01111010 01101111 01100010 |
# | |
# | Netzob : Inferring communication prot... | lootr/netzob | netzob/src/netzob/Common/CommandLine.py | Python | gpl-3.0 | 4,169 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2019-06-19 18:52
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('organization_network', '0138_auto_20190619_2047'),
]
operations = [
migrations.Alte... | Ircam-Web/mezzanine-organization | organization/network/migrations/0139_auto_20190619_2052.py | Python | agpl-3.0 | 2,040 |
# Copyright 2001-2007 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... | MicroTrustRepos/microkernel | src/l4/pkg/python/contrib/Lib/logging/handlers.py | Python | gpl-2.0 | 44,354 |
from django.db import models
import datetime
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question + ' on ' + self.pub_date.__str__()
def was_published_today(self):
return self.... | jtkorb/django-polls | src/polls/models.py | Python | bsd-3-clause | 706 |
import os
import hickle as hkl
import pickle
import common.time as time
def load_hkl_file(filename):
hkl_filename = filename + '.hkl'
if os.path.isfile(hkl_filename):
start = time.get_seconds()
data = hkl.load(hkl_filename)
print 'Loaded %s in %ds' % (hkl_filename, time.get_seconds() - ... | jlnh/SeizurePrediction | common/io.py | Python | mit | 1,218 |
from __future__ import absolute_import, print_function
import cython
from .. import __version__
import re, os, sys, time
from glob import iglob
try:
import gzip
gzip_open = gzip.open
gzip_ext = '.gz'
except ImportError:
gzip_open = open
gzip_ext = ''
import shutil
import subprocess
try:
impo... | c-blake/cython | Cython/Build/Dependencies.py | Python | apache-2.0 | 38,887 |
# rescale certain features in the input file
# invocations: rescale.py --in PATHIN --out PATHOUT
# where
# both paths are to pickled files that contain a pandas DataFrame
import datetime
#import pandas as pd
import cPickle as pickle
import pdb
import sys
import warnings
from Bunch import Bunch
from directory impor... | rlowrance/re-local-linear | rescale.py | Python | mit | 3,130 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
"""Rozwiązanie zadania 103."""
def suffixes(instring):
"""Generuje wszystkie sufiksy z podanego stringa."""
outsufiks = []
for i in range(len(instring)):
outsufiks.append(instring[i:])
return outsufiks
if __name__ == '__main__':
print suffixes("b... | kaczla/PJN | src/2015.10.08/Task103.py | Python | gpl-2.0 | 329 |
"""Support for Nexia / Trane XL Thermostats."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN
from .c... | rohitranjan1991/home-assistant | homeassistant/components/nexia/binary_sensor.py | Python | mit | 2,001 |
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from pages.base import Base
class Navigation(Base):
def __init__(self, logger, directory, base_url=r'http://localhost/',
driver=None, dri... | kurtw/cfgov-refresh | _tests/browser_testing/features/pages/navigation.py | Python | cc0-1.0 | 876 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it ... | obsoleter/suds | tests/axis2.py | Python | lgpl-3.0 | 5,042 |
# -*- coding: utf-8 -*-
"""
Human Resource Management
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
s3db.hrm_vars()
# =============================================================================
def ... | anurag-ks/eden | controllers/hrm.py | Python | mit | 25,048 |
# Copyright (c) 2015 Red Hat, 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 require... | paninetworks/neutron | neutron/tests/functional/scheduler/test_dhcp_agent_scheduler.py | Python | apache-2.0 | 17,358 |
#!/usr/bin/env vpython
# Copyright 2017 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.
import json
import os
import shutil
import tempfile
import unittest
import mock
import common_merge_script_tests
THIS_DIR = os.path... | nwjs/chromium.src | testing/merge_scripts/standard_isolated_script_merge_test.py | Python | bsd-3-clause | 4,942 |
#!/usr/bin/env python
# Copyright 2015 The Android Open Source Project
#
# 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... | lag-linaro/anbox | scripts/gen-emugl-entries.py | Python | gpl-3.0 | 17,603 |
"""
Functions for extracting data from MapCO2 'Iridium format' files
"""
import os
from datetime import datetime
import math
"""
Write the CSV header to a file
"""
def write_header(out_file):
# Measurement Type
out_file.write('Timestamp,State,')
# System Info
out_file.write('Zero Coefficient,Span Coefficient... | BjerknesClimateDataCentre/QuinCe | DataPreparation/ASVCO2/asvco2.py | Python | gpl-3.0 | 7,865 |
import torch
from torch.autograd import Variable
import utils
import dataset
from PIL import Image
import models.crnn as crnn
model_path = '/home/ahmed/crnn/data/crnn.pth'
img_path = '/home/ahmed/crnn/data/demo.png'
alphabet = '0123456789abcdefghijklmnopqrstuvwxyz'
model = crnn.CRNN(32, 1, 37, 256, 1).cuda()
print(... | ahmedmazariML/Re-Implementation-of-Convolutional-Recurrent-Neural-Network-for-Sequence-Text-Recognition | demo.py | Python | mit | 1,025 |
#!/usr/bin/env python
"""Test condition that verifies SIP channels
Copyright (C) 2013, Digium, Inc.
Nitesh Bansal <nitesh.bansal@gmail.com>
Matt Jordan <mjordan@digium.com>
This program is free software, distributed under the terms of
the GNU General Public License Version 2.
"""
from twisted.internet import defer
f... | coreyfarrell/testsuite | lib/python/asterisk/sip_channel_test_condition.py | Python | gpl-2.0 | 2,469 |
"""SCons.Tool.RCS.py
Tool-specific initialization for RCS.
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, 2009, 2010 The SCons Foundation
#
... | qewerty/moto.old | tools/scons/engine/SCons/Tool/RCS.py | Python | gpl-2.0 | 2,195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.