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 |
|---|---|---|---|---|---|
import json
import boto3
import time
from datetime import datetime, timedelta, timezone
def get_region_billing(region_name='cn-northwest-1'):
client = boto3.client('cloudwatch',region_name=region_name) # 创建cloudwatch,可以指定region_name
endTime = datetime.utcnow().replace(tzinfo=timezone.utc) # ... | iceflow/aws-demo | lambda/get_billing/get_aws_china_billing.py | Python | gpl-3.0 | 3,472 |
import urllib
import urllib2
import json
import difflib
import pylast
class iTunesAlbumArt(object):
def __init__(self):
self.base_url = 'https://itunes.apple.com/search'
self.limit = 50
def _form_url(self, artist):
args_dict = {'limit': self.limit,
'term': artist}... | arfar/art-py | apis.py | Python | gpl-2.0 | 2,779 |
# Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
# Use of this file is governed by the BSD 3-clause license that
# can be found in the LICENSE.txt file in the project root.
#/
from enum import IntEnum
# Represents the type of recognizer an ATN applies to.
class ATNType(IntEnum):
LEXER = 0
P... | damorim/compilers-cin | antigo/ap3/antlr4-python3-runtime-4.7.2/src/antlr4/atn/ATNType.py | Python | mit | 422 |
# Mapping from Mixamo skeleton to SmartBody skeleton
# Before loading character, run this;
# seq mixamo-map.seq
# then map any existing skeletons:
# skeletonmap <skeleton> mixamo
# also map any motions to mixamo:
# motionmap <motion> mixamo
jointMapManager = scene.getJointMapManager()
sinbadMap = jointM... | gsi-upm/SmartSim | smartbody/data/scripts/ogre-sinbad-map.py | Python | apache-2.0 | 3,142 |
import os
import subprocess
import json
from tempfile import mkstemp
class PDFParserError(Exception):
pass
class InvalidOptionError(Exception):
pass
class PDFParser:
def __init__(self, tmp_path=None, clean_up=True):
self.TEMP_FOLDER_PATH = tmp_path
self._tmp_files = []
self.cl... | codeforamerica/typeseam | typeseam/form_filler/pdfparser.py | Python | bsd-3-clause | 5,502 |
"""
These settings will always be overriding for all test runs.
"""
import tempfile
EMAIL_FROM_ADDRESS = 'doesnt@matter.com'
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.MD5PasswordHasher',
)
MOZILLIANS_API_APPNAME = 'something'
MOZILLIANS_API_BASE = 'https://shouldneveractuallybeused.net'
MOZILLIANS_API_K... | blossomica/airmozilla | airmozilla/settings/test.py | Python | bsd-3-clause | 3,601 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
from setuptools import setup, find_packages
from pip.req import parse_requirements
import pip
install_reqs = reqs = [str(ir.req) for ir in parse_requirements('requirements.txt',
session=pip.download.PipSession())]
dev_reqs = [str(ir.req) ... | HEP-DL/proton_decay_study | setup.py | Python | mit | 1,937 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-15 19:52
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('administrador', '0002_auto_20160615_0157'),
]
operatio... | isfon/DjangoSales | DjangoSales/apps/administrador/migrations/0003_auto_20160615_1452.py | Python | mit | 521 |
import pytest
from tests.plugins.upload_to_s3 import upload_file_to_s3_by_job_id
pytest_plugins = (
"tests.examples.examples_report_plugin",
"tests.integration.integration_tests_plugin",
"tests.plugins.bokeh_server",
"tests.plugins.jupyter_notebook",
"tests.plugins.phantomjs_screenshot",
"test... | percyfal/bokeh | tests/conftest.py | Python | bsd-3-clause | 1,354 |
import re
import unittest
from scrapy.http import HtmlResponse
from scrapy.link import Link
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor, BaseSgmlLinkExtractor
from scrapy.tests import get_testdata
class LinkExtractorTestCase(unittest.TestCase):
def test_basic(self):
html = """<html><h... | pablohoffman/scrapy | scrapy/tests/test_contrib_linkextractors.py | Python | bsd-3-clause | 14,608 |
#!/usr/bin/python
"""
Skeleton code for k-means clustering mini-project.
"""
import pickle
import numpy
import matplotlib.pyplot as plt
import sys
sys.path.append("../tools/")
from feature_format import featureFormat, targetFeatureSplit
def Draw(pred, features, poi, mark_poi=False, name="image.png", f1_n... | yavuzovski/playground | machine learning/Udacity/ud120-projects/k_means/k_means_cluster.py | Python | gpl-3.0 | 3,234 |
import PythonQt
from PythonQt import QtCore, QtGui, QtUiTools
from director import lcmUtils
from director import applogic as app
from director.utime import getUtime
from director.timercallback import TimerCallback
import numpy as np
import math
from time import time
from copy import deepcopy
def addWidgetsToDict(widg... | patmarion/director | src/python/director/multisensepanel.py | Python | bsd-3-clause | 6,645 |
__author__ = 'Girish'
import re
import json
from textwrap import wrap
try:
import urllib2 as request
from urllib import quote
except:
from urllib import request
from urllib.parse import quote
class Translator:
def __init__(self, to_lang, from_lang='auto'):
self.from_lang = from_lang
... | JainamJhaveri/collegeProjects | googleTranslate/Translator.py | Python | mit | 1,366 |
"""KNX core module
This implements some core KNX classes and methods.
"""
import re
from knxip.helper import tohex
E_NO_ERROR = 0x00
E_HOST_PROTOCOL_TYPE = 0x01
E_VERSION_NOT_SUPPORTED = 0x02
E_SEQUENCE_NUMBER = 0x04
E_CONNECTION_ID = 0x21
E_CONNECTION_TYPE = 0x22
E_CONNECTION_OPTION = 0x23
E_NO_MORE_CONNECTIONS = 0x... | usul27/pknx | knxip/core.py | Python | mit | 5,873 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 10 15:50:50 2015
simple portfolio from cash flow
@author: xuyu
"""
import datetime
import os
from collections import defaultdict
from security import Security
from parse_flow import FlowRecord
from tdx_parser.parse_tdx_day import get_dayline
from dzh_parser import parse_d... | sein-tao/StockAnalysis | PF_simple.py | Python | gpl-2.0 | 3,113 |
from pyCodeLib import *
import warnings
import glob
import re
import argparse
import sys
warnings.filterwarnings('ignore')
parser = argparse.ArgumentParser(
description="compute phi for protein list")
parser.add_argument("proteins", help="The name of the protein list")
parser.add_argument("-m", "--mode", type=int... | luwei0917/awsemmd_script | compute_phis.py | Python | mit | 4,935 |
from .lib import TestBase
class TestTutorial(TestBase):
def test_example(self):
# Memory Managers
##################
import smmap
# This instance should be globally available in your application
# It is configured to be well suitable for 32-bit or 64 bit applications.
... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/smmap/test/test_tutorial.py | Python | gpl-3.0 | 3,512 |
from collections import defaultdict
class Solution(object):
def minWindow(self, S, T):
"""
:type S: str
:type T: str
:rtype: str
"""
pre = defaultdict(list)
for i, c in enumerate(T, -1):
pre[c].append(i)
for val in pre.values():
... | wufangjie/leetcode | 727. Minimum Window Subsequence.py | Python | gpl-3.0 | 1,035 |
#!/usr/bin/env python
# Copyright (c) 2009, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A test script which attempts to detect memory leaks by calling C
functions many times and compare process memory usage before an... | Q-Leap-Networks/psutil | test/test_memory_leaks.py | Python | bsd-3-clause | 13,362 |
# -*- coding: utf-8 -*-
from sqlalchemy import Column, Integer, UnicodeText, Unicode, \
ForeignKey, SmallInteger, Float, Boolean
from sqlalchemy.orm import relationship
from aston.resources import cache
from aston.database import Base, JSONDict
from aston.database.File import Run
from aston.data... | molliewebb/aston | aston/database/Palette.py | Python | gpl-3.0 | 8,785 |
# -*- coding:gbk
import pickle
import os
import json
class Student(object):
def __init__(self,name,age,score):
self.name = name
self.age = age
self.score = score
def student2dict(std):
return {
'name':std.name,
'age':std.age,
'score':std.score
}
d = dict(... | xiaxia47/Python-learning | picking.py | Python | gpl-3.0 | 799 |
from utilities import load_data,cross_validate
from utilities import DataClean
import os
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.metrics import accuracy_score
from sklearn.naive_bayes import BernoulliNB
from sklearn.ensemble import RandomForestClassifier
from glove import Corpus,Glove
cla... | saatvikshah1994/SmartMM | Sentiment Analysis/supervised/gloveavgvec.py | Python | mit | 3,924 |
from itertools import chain
from time import time, sleep
from random import random, gauss, shuffle
PORT=2
import rtmidi as rt
def gen_all_off(now):
return ((now, tuple(chain(*((0x90, n, 0) for n in range(127))))),)
def next(prev):
prev += gauss(0,3)
return max(0,min(prev,127))
value = [[random() * 127 for n ... | joefutrelle/pyaglomidi | brownian_controllers.py | Python | mit | 1,073 |
import requests # not needed really
class Dep:
def this(self):
return 'this'
def that(self):
return 'that'
| mamachanko/camp | example/dep/dep.py | Python | gpl-3.0 | 140 |
import os
import sys
import traceback
import StringIO
import warnings
import re
warnings.simplefilter("error")
from support import get_data_files
from support import TestData, convert, convertExpected, treeTypes
import html5lib
from html5lib import html5parser, treebuilders, constants
#Run the parse error checks
che... | kordless/wisdom | lib/html5lib/tests/test_parser.py | Python | mit | 3,443 |
#############################################################################
##
## Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
## Contact: http://www.qt-project.org/legal
##
## This file is part of Qt Creator.
##
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this f... | farseerri/git_code | tests/system/suite_qtquick/tst_qtquick_creation3/test.py | Python | lgpl-2.1 | 3,565 |
#############################################################################
# Copyright (c) 2018 Eli Polonsky. 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... | iliapolo/fileconfig | dictfile/tests/api/test_repository.py | Python | apache-2.0 | 5,977 |
# -*- coding: UTF-8 -*-
# Copyright 2020 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
import datetime
from django.conf import settings
from lino.api import dd, rt, _
from lino_xl.lib.ledger.choicelists import DC, CommonAccounts
from lino.utils import Cycler
REQUEST =... | lino-framework/xl | lino_xl/lib/sheets/fixtures/demo_bookings.py | Python | bsd-2-clause | 1,469 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Matt Jeffery <matt@clan.se>
# 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
# version 2.1 of the License, or ... | mattjeffery/semetric-python | semetric/apiclient/entity/chart.py | Python | lgpl-2.1 | 3,737 |
from django.apps import AppConfig
class ScrapperConfig(AppConfig):
name = 'scrapper'
| shashank-sharma/mythical-learning | scrapper/apps.py | Python | mit | 91 |
import aplpy
import matplotlib.pyplot as plt
import pyfits
import numpy
import pyregion
import astropy
from astropy.io import fits
from astropy import wcs
from astropy import coordinates
import matplotlib.patheffects as Patheffects
from astropy import units as u
import good_cores_getsources
def cross_match_CSAR(getso... | jakeown/HGBS_pipeline | CSAR_core_cross_match.py | Python | mit | 4,603 |
for cislo in range(5):
vysledek = cislo**2
print(cislo, 'na druhou je', vysledek)
| Ajuska/pyladies | 04/nadruhou.py | Python | mit | 90 |
from django.db import models
from categories.models import CategoryBase, STORAGE
from django.utils.encoding import force_text
from django.urls import reverse
class Category(CategoryBase):
thumbnail = models.FileField(
upload_to='uploads/categories/thumbnails',
null=True, blank=True,
storag... | alien3211/lom-web | posts/categoryModels.py | Python | mit | 2,551 |
# -*- coding: utf-8 -*-
'''
change log:
对应含有图片的微博
=============OLD=============
备份微博内容(仅文字部分)
Created on 2017/08/10
@author: yuyang
'''
import urllib2
import re
from docx import Document
import TencentUtil
class TencentWeibo:
'''
Tencent weibo object.
'''
def __init__(self, id):
... | coolcooldool/tencent-weibo-exporter | version4/TencentWeibo2.py | Python | apache-2.0 | 4,495 |
from numba import unittest_support as unittest
import numpy as np
from numba import cuda, types
import struct
def float_to_int(x):
return np.int32(x)
def int_to_float(x):
return np.float64(x) / 2
def float_to_unsigned(x):
return types.uint32(x)
def float_to_complex(x):
return np.complex128(x)
... | stefanseefeld/numba | numba/cuda/tests/cudapy/test_casting.py | Python | bsd-2-clause | 2,045 |
# -*- coding: UTF-8 -*-
from __future__ import with_statement
from gnr.core import gnrdate
import datetime
def test_relativeDay():
workdate = datetime.date(2008, 4, 25)
res = gnrdate.decodeDatePeriod("today", workdate=workdate)
assert res == '2008-04-25'
res = gnrdate.decodeDatePeriod("yesterday", wor... | poppogbr/genropy | gnrpy/tests/core/gnrdate_test.py | Python | lgpl-2.1 | 16,226 |
#Should handle most of the default functions that will come back throughout
def lowerit(i): #Makes the input lowercase for if blocks
return i.lower()
def stringit(i): #Makes the input strings for whatever reason
return str(i)
def left_is_right(i): #Function for making the "Left" direction correct
stringi... | QMasterMoo/Turtle-Text-Adventure | basicfunc.py | Python | gpl-2.0 | 3,369 |
# -*- 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 'Attribute.description'
db.add_column(u'layers_attribute', 'description',
... | sopac/pacgeo | geonode/layers/migrations/0009_auto__add_field_attribute_description.py | Python | gpl-3.0 | 21,076 |
import requests
from bs4 import BeautifulSoup
from becquerel_django.ratatouille.webparser import ingredients_parser as parse
url = "www.marmiton.org/recettes/recette_galette-des-rois_10832.aspx"
r = requests.get("http://" +url)
data = r.text
soup = BeautifulSoup(data, 'html.parser')
# print(soup.prettify())
recip... | BecquerelRecipe/Trunk | scraper.py | Python | apache-2.0 | 635 |
__author__ = 'Ilya Chernyakov'
__alias__ = 'eliuha'
# Shalom everybody !
def validate_israeli_id_number(iID):
iID = str(iID)
if len(iID) == 8:
iID = '0' + str(iID)
if len(iID) != 9:
return False
num_12_arr = [1, 2, 1, 2, 1, 2, 1, 2, 1]
dig = list(int(d) for d in str(iID))
su... | eliuha/pyIsraeliId | pyIsraeliId/checker.py | Python | apache-2.0 | 605 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
try:
from distutils.core import setup
except ImportError:
sys.stderr.write("""\
.------------------------------------------------------------------------.
| It seems that the package Distutils is not available for this Python. |
| You might fetch and ... | carlhu/emacs_terminal | pinard-Pymacs-016b0bc/setup.py | Python | gpl-3.0 | 832 |
import json
import re
from yawp.parser import YAWiktionaryParser
LANG_NAME = 'Serbo-Croatian'
PARTS_OF_SPEECH = ['Verb', 'Noun', 'Adjective', 'Adverb', 'Preposition', 'Interjection', 'Pronoun', 'Conjunction', 'Letter', 'Particle', 'Proper Noun']
INFLECTIONS = ['Conjugation', 'Declension']
NOUN_CASES = ['Nominat... | peterjcarroll/yawp | yawp/dict/serbocroatian.py | Python | mit | 31,534 |
from datetime import datetime
import json
def read_json(filename):
# catapp.logger.debug("Reading '{}'".format(filename))
try:
with open(filename) as fh:
data = json.loads(fh.read())
except Exception as e:
# catapp.logger.error("Reading '{}' {}".format(filename, e))
data... | rollandf/codeandtalk.com | cat/tools.py | Python | apache-2.0 | 765 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | fingeronthebutton/RIDE | src/robotide/lib/robot/running/timeouts/__init__.py | Python | apache-2.0 | 4,107 |
from django.conf.urls import patterns, url
from django.views.generic import RedirectView
from django.conf import settings
from . import views
products = r'/products/(?P<product>\w+)'
versions = r'/versions/(?P<versions>[;\w\.()]+)'
version = r'/versions/(?P<version>[;\w\.()]+)'
perm_legacy_redirect = settings.PERMA... | AdrianGaudebert/socorro | webapp-django/crashstats/crashstats/urls.py | Python | mpl-2.0 | 3,962 |
from django.apps import AppConfig
class TestimonialsConfig(AppConfig):
name = 'testimonials'
| slavpetroff/sweetshop | backend/django/apps/testimonials/apps.py | Python | mit | 99 |
from ..ndtypes import (make_slice_type, make_array_type, ptr_type,
ArrayT, TupleT, ScalarT, Type, PtrT, Int64, IntT, Float64)
from ..syntax import (Alloc, AllocArray, ArrayView, Const, Index, Slice, Struct, Var, Select, Expr)
from ..syntax.helpers import (const, zero_i64, wrap_if_constant, slic... | pombredanne/parakeet | parakeet/builder/array_builder.py | Python | bsd-3-clause | 9,545 |
# 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, software
# distributed under t... | briancurtin/python-openstacksdk | openstack/tests/unit/message/v2/test_subscription.py | Python | apache-2.0 | 7,255 |
# -*- coding: utf-8 -*-
# Copyright Martin Manns
# Distributed under the terms of the GNU General Public License
# --------------------------------------------------------------------
# pyspread is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | manns/pyspread | pyspread/test/test_cli.py | Python | gpl-3.0 | 2,217 |
'''
Low-level programming constructs for key-value stores
Originally developed as part of Zephyr
https://zephyr.space/
'''
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import super
from future import s... | bsmithyman/galoshes | galoshes/meta.py | Python | mit | 7,934 |
"""
========
numpydoc
========
Sphinx extension that handles docstrings in the Numpy standard format. [1]
It will:
- Convert Parameters etc. sections to field lists.
- Convert See Also section to a See also entry.
- Renumber references.
- Extract the signature from the docstring, if it can't be determined otherwise.... | selimnairb/2014-02-25-swctest | lessons/thw-documentation/sphinxext/numpydoc.py | Python | bsd-2-clause | 5,688 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: throttlerdata.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as ... | danielmt/vshard | vendor/github.com/youtube/vitess/py/vtproto/throttlerdata_pb2.py | Python | mit | 7,327 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
# Copyright (C) 2005-2009 Skomoroh
#
# This program is free software... | jimsize/PySolFC | pysollib/games/ultra/dashavatara.py | Python | gpl-3.0 | 43,519 |
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404, render
from easy_avatar.forms import UploadFileForm
from django.views.decorators.csrf import requires_csrf_token
from django.template import RequestContext
from django.conf import settings
from easy_av... | chawk/django-easy-avatar | easy_avatar/views.py | Python | mit | 2,874 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Lora Receive File
# Generated: Thu Mar 30 15:01:18 2017
##################################################
if __name__ == '__main__':
import ctypes
import sys
if sys.plat... | Wosser1sProductions/gr-lora | apps/lora_receive_file.py | Python | gpl-3.0 | 6,108 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/jupyterhub-gcp-proxies-authenticator | gcpproxiesauthenticator/__init__.py | Python | apache-2.0 | 574 |
def task():
pass
| pybursa/homeworks | aa_example/hw1/test.py | Python | gpl-2.0 | 21 |
#!/bin/env python
import logging
from optparse import OptionParser
import json
import subprocess
import urllib,urllib2
import os
from os import path, access, R_OK
import getpass
import re
import random
import string
import time
import sys
sys.path.insert(0, sys.path[0])
from config import *
from funcs import *
from os... | nephantes/dolphin-tools | src/runWorkflow.py | Python | mit | 7,698 |
class Solution:
def translateNum(self, num: int) -> int:
if num < 10:
return 1
table = {}
for i in range(26):
table[str(i)] = chr(ord('a') + i)
num_str = str(num)
arr = []
def solve(eated, s, last):
if not s:
arr.... | fy0/my-leetcode | 990.Satisfiability Of Equality Equations/main.py | Python | apache-2.0 | 674 |
"""
The MIT License (MIT)
Copyright (c) [2015-2018] [Andrew Annex]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modif... | drbitboy/SpiceyPy | spiceypy/__init__.py | Python | mit | 1,313 |
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | himanshu-dixit/oppia | core/domain/visualization_registry_test.py | Python | apache-2.0 | 1,717 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/py-coverage/package.py | Python | lgpl-2.1 | 1,639 |
#! /usr/bin/env python
# in this file, the input frame is in rgb format
import Queue
import StringIO
import base64
import json
import logging
import multiprocessing
import sys
import os
import threading
import time
from operator import itemgetter
import cv2
import dlib
import numpy as np
from PIL import Image
import t... | Jamesjue/FaceSwap-server | server/face_swap.py | Python | apache-2.0 | 28,570 |
# Copyright (C) 2001,2002 Python Software Foundation
# csv package unit tests
import copy
import sys
import unittest
from io import StringIO
from tempfile import TemporaryFile
import csv
import gc
import pickle
from test import support
from itertools import permutations
from textwrap import dedent
from collections imp... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/test/test_csv.py | Python | gpl-2.0 | 48,189 |
# Copyright 2016 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... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/tensorflow/python/debug/lib/session_debug_testlib.py | Python | mit | 40,584 |
'''
patent,Cit_Date,Cit_Name,Cit_Kind,Cit_Country,Citation,Category,CitSeq
06009555,1980-03-01,FAY,"",,04192017,,
06009555,1985-10-01,"BROWN ET AL.","",,04547903,,
'''
import csv
import re
with open("patent.csv","rb") as source:
rdr= csv.reader(source)
with open("patent-processed.csv","wb") as result:
... | mbartoli/patentprocessing | ETL/preprocess-patent.py | Python | mit | 452 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import csv
import logging
from datetime import datetime
from tempfile import NamedTemporaryFile
from mock import patch
from udata.models import Dataset, PeriodicTask
from udata.tests import TestCase, DBTestMixin
from udata.core.organization.factories ... | jphnoel/udata | udata/harvest/tests/test_actions.py | Python | agpl-3.0 | 19,718 |
import json
import contextlib
import requests
from . import exceptions
RECEIPT_PRODUCTION_VALIDATION_URL = "https://buy.itunes.apple.com/verifyReceipt"
RECEIPT_SANDBOX_VALIDATION_URL = "https://sandbox.itunes.apple.com/verifyReceipt"
class Request(object):
"""Validation request with raw receipt. Receipt must ... | Eksmo/itunes-iap | itunesiap/core.py | Python | bsd-2-clause | 3,513 |
""" This is a module to interface to libewf.
This needs to be tested with the windows port.
"""
from ctypes import *
import ctypes.util
possible_names = ['libewf-1', 'ewf',]
for name in possible_names:
resolved = ctypes.util.find_library(name)
if resolved:
break
try:
if resolved == None:
... | naototty/pyflag | src/plugins_old/aff4/ewf.py | Python | gpl-2.0 | 2,856 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import optparse
import os
import pexpect
import shutil
import signal
import subprocess
import tempfile
import time
import xmlrpclib
from contextlib import contextmanager
from glob import glob
from ... | kosgroup/odoo | setup/package.py | Python | gpl-3.0 | 21,097 |
import datetime
from robocompdsl.templates.common.templatedict import TemplateDict
from robocompdsl.templates.templateCPP.plugins.base.functions import function_utils as utils
INTERFACE_METHOD_STR = """
${ret} ${interface_name}I::${method_name}(${input_params})
{
${to_return}worker->${interface_name}_${method_name}... | robocomp/robocomp | tools/cli/robocompdsl/robocompdsl/templates/templateCPP/plugins/base/functions/SERVANT_H.py | Python | gpl-3.0 | 1,893 |
# -*- coding: utf-8 -*-
import gevent.pool
import gevent.queue
from gevent import monkey
monkey.patch_all()
class asynchronizer():
def __init__(self, workers):
# workers define how many concurrent functions should be run
self.workers = workers
self.pool = gevent.pool.Pool(self.workers)
... | Arsh23/asynchronizer | asynchronizer/__init__.py | Python | mit | 2,045 |
# 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"); you may not u... | iagcl/data_pipeline | tests/processor/data_logminer_rejected_alters.py | Python | apache-2.0 | 1,201 |
from flask import Flask
from flask import jsonify
from flask_jwt_extended import create_access_token
from flask_jwt_extended import jwt_required
from flask_jwt_extended import JWTManager
from flask_jwt_extended import set_access_cookies
from flask_jwt_extended import unset_jwt_cookies
app = Flask(__name__)
# Here yo... | vimalloc/flask-jwt-extended | examples/jwt_locations.py | Python | mit | 1,740 |
from __future__ import absolute_import, unicode_literals
from tests.mpd import protocol
class AuthenticationActiveTest(protocol.BaseTestCase):
def get_config(self):
config = super(AuthenticationActiveTest, self).get_config()
config['mpd']['password'] = 'topsecret'
return config
def t... | priestd09/mopidy | tests/mpd/protocol/test_authentication.py | Python | apache-2.0 | 2,557 |
# Copyright (C) 2015 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 option) any later version.
# This program is distributed in the hope that it will be u... | dmach/dnf | doc/examples/install_plugin.py | Python | gpl-2.0 | 3,836 |
#!/usr/bin/env python
import pantilthat
import time
import sys
import math
import servo_ranges
def tick():
time.sleep(0.010)
class Shelf(object):
def __init__(self, num, start, end, tilt):
self.count = num; # num of records
self.pan_start = start; # degress +
self.pan_end = end; # degrees -
self.tilt_pos =... | valentingalea/vinyl-shelf-finder | pantilthat/finder.py | Python | mit | 2,511 |
from __future__ import absolute_import, unicode_literals
import pickle
import sys
from collections import defaultdict
from kombu import Connection, Consumer, Producer, Exchange, Queue
from kombu.exceptions import MessageStateError
from kombu.utils import ChannelPromise
from kombu.utils import json
from .case import... | Elastica/kombu | kombu/tests/test_messaging.py | Python | bsd-3-clause | 24,631 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-present Taiga Agile LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later ver... | taigaio/taiga-back | taiga/projects/wiki/api.py | Python | agpl-3.0 | 5,324 |
from systemdlogger.log import log
from systemdlogger.journal import JournalExporter
from systemdlogger.cloudwatch import CloudwatchLogger
from systemdlogger.elasticsearch import ElasticsearchLogger
import json
import os
from string import Template
class Runner:
LOGGERS = {
'cloudwatch': CloudwatchLogger,... | techjacker/systemdlogger | systemdlogger/runner.py | Python | mit | 1,781 |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
import logging
import signal
import time
import sys
from traitlets.config import catch_config_error
from traitlets import (
Instance, Dict, Unicode, Bool, List, CUnicode, An... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/jupyter_client/runapp.py | Python | bsd-2-clause | 4,322 |
import os, datetime, json
from LogController import LogController
from django.http import HttpResponse
from ..models import Asset,Tag, TagMetadata, Language
from django.shortcuts import render,redirect
from django.http import JsonResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
class... | emilianobilli/backend | dam/cawas/Controller/TagController.py | Python | gpl-3.0 | 6,601 |
"""
Enhanced subprocess.Popen subclass, supporting:
* .communicate() with timeout
* kill/terminate/send_signal (like in Py 2.6) for Py 2.4 / 2.5
Sample usage:
out, err = Popen(...).communicate(input, timeout=300)
"""
import os
import subprocess
import threading
import signal
if subprocess.m... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/util/SubProcess.py | Python | mit | 9,069 |
# -*- coding: utf-8 -*-
import click
from ..models import Post
@click.command()
@click.option('--title', default=None, help='Title of the Post')
def cli(title):
"Prints a list of posts"
posts = Post.objects
if title:
posts = posts(title=title)
for post in posts:
click.echo(post)
| seraphln/wheel | wheel/modules/posts/commands/listposts.py | Python | gpl-3.0 | 316 |
"""Support for Apple HomeKit."""
import asyncio
import ipaddress
import logging
import os
from aiohttp import web
from pyhap.const import CATEGORY_CAMERA, CATEGORY_TELEVISION, STANDALONE_AID
import voluptuous as vol
from homeassistant.components import zeroconf
from homeassistant.components.binary_sensor import (
... | turbokongen/home-assistant | homeassistant/components/homekit/__init__.py | Python | apache-2.0 | 27,666 |
""" demonstrating some great Python features via unit tests """
from functools import partial
import operator
import os
import tempfile
import unittest
class testRandomFeatures(unittest.TestCase):
""" testing random language features """
def testMultipleAssignent(self):
""" tests the shorthand syntax ... | WhatIsHeDoing/DidYouKnow | python/main.py | Python | mit | 12,214 |
#!/usr/bin/env python
# This file is Copyright David Francos Cuartero, licensed under the GPL2 license.
from distutils.core import setup
setup(name='airdrop-ng',
version='1.1',
description='Rule based Deauth Tool',
author='TheX1le',
console = [{"script": "airdrop-ng" }],
url='https://air... | creaktive/aircrack-ng | scripts/airdrop-ng/setup.py | Python | gpl-2.0 | 479 |
import numpy as np
import warnings
SCALARTYPES = (complex, float, int, np.number)
def is_scalar(f):
"""Determine if the input argument is a scalar.
The function **is_scalar** returns *True* if the input is an integer,
float or complex number. The function returns *False* otherwise.
Parameters
-... | simpeg/discretize | discretize/utils/code_utils.py | Python | mit | 7,861 |
from datetime import datetime
from asynctest import patch
import bot # noqa: F401
from .base_cache_store import TestCacheStore
from lib.cache import CacheStore
from lib.api.twitch import TwitchCommunity
class TestCacheTwitchApiCreatedDate(TestCacheStore):
async def setUp(self):
await super().setUp()
... | MeGotsThis/BotGotsThis | tests/cache/test_twitch_api.py | Python | gpl-3.0 | 18,708 |
# -*- 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):
# Changing field 'Payment.fee'
db.alter_column('core_payment', 'fee', self.gf('django.db.models.fields.Deci... | stonestone/stonefreedomsponsors | djangoproject/core/migrations/0025_auto__chg_field_payment_fee.py | Python | agpl-3.0 | 16,141 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
if os.environ.get('DJANGO_SETTINGS_MODULE') is None:
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.base'
# When using an on-disk database for the test suite,
# Django asks us if we want to delete the database.
# We do.... | edx/edx-ora2 | manage.py | Python | agpl-3.0 | 762 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para Repelis - Por Kampanita-2015
# ( con ayuda de neno1978, DrZ3r0, y robalo )
# 4/9/2015
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
# ---------------------------------------... | neno1978/pelisalacarta | python/main-classic/channels/repelis.py | Python | gpl-3.0 | 16,038 |
#!/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... | sivel/ansible-modules-core | network/ios/_ios_template.py | Python | gpl-3.0 | 6,070 |
from readers.dependency_instance import DependencyInstance
class Conll07Reader:
# ## read Conll 2007 data: reusing https://github.com/bplank/myconllutils
### http://ilk.uvt.nl/conll/index.html#dataformat
def __init__(self, filename):
self.filename = filename
self.startReading()
def _... | rug-compling/hmm-reps | readers/conll07_reader.py | Python | mit | 7,024 |
import urllib.parse
from dateutil import parser
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db import transaction
from django.db.models import F, OuterRef, Q, Subquery
from kuma.core.urlresolvers import reverse
from kuma.wiki.models import Document, Revision
clas... | Elchi3/kuma | kuma/wiki/management/commands/correct_current_revision_documents.py | Python | mpl-2.0 | 5,448 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^(?:(?P<location_uid>[a-z\-]+:\d+)/)?$',
views.locations,
name="locations")
)
| dimagi/rapidsms | lib/rapidsms/contrib/locations/urls.py | Python | bsd-3-clause | 246 |
import os
import sys
from collections import Counter, defaultdict, namedtuple
import six
from six import StringIO
from conans import ConanFile, Options
from conans.client.output import ConanOutput
from conans.client.userio import UserIO
from conans.model.env_info import DepsEnvInfo, EnvInfo, EnvValues
from conans.mo... | conan-io/conan-package-tools | cpt/test/utils/mocks.py | Python | mit | 6,729 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Unit tests for the `iris.cube.CubeList` class."""
# Import iris.tests first so that some things can be initialised before
#... | pp-mo/iris | lib/iris/tests/unit/cube/test_CubeList.py | Python | lgpl-3.0 | 20,583 |
# testing configuration
DEBUG = True
TESTING = True
SECRET_KEY = "dummy"
CACHE_NO_NULL_WARNING = True
SQLALCHEMY_DATABASE_URI = "postgres://localhost/seamless_karma_test"
| singingwolfboy/seamless-karma | seamless_karma/config/test_postgres.py | Python | mit | 172 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright 2014 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE 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 th... | geonexus/fiware-cloto | fiware_cloto/cloto/manager/InfoManager.py | Python | apache-2.0 | 5,472 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.