code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
import logging
import sys
def prepareLogging(loggingLevel):
logger = logging.getLogger()
logger.setLevel(loggingLevel)
formatStr = \
'%(asctime)s [%(levelname)-8s] %(filename)s:%(lineno)s %(message)s'
formater = logging.Formatter(formatStr, '%H:%M:%S')
handler = logging.StreamHandler(sys... | alexises/python-cah | pythonCah/log.py | Python | lgpl-3.0 | 431 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-09 18:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('empregado', '0007_auto_20170208_2116'),
]
operations = [
migrations.AlterFi... | eliseuegewarth/sibaho | empregado/migrations/0008_auto_20170209_1606.py | Python | lgpl-3.0 | 616 |
# Copyright 2015 Canonical Ltd.
# Licensed under the AGPLv3, see LICENCE file for details.
from __future__ import unicode_literals
import copy
import itertools
import models
import utils
class ChangeSet(object):
"""Hold the state for parser handlers.
Also expose methods to send and receive changes (usuall... | marcoceppi/juju-bundlelib | jujubundlelib/changeset.py | Python | lgpl-3.0 | 9,892 |
# -*- coding: utf-8 -*-
# Scrapy settings for motoscrape project
#
# For simplicity, this file contains only settings considered important or
# commonly used. You can find more settings consulting the documentation:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
# http://scrapy.readthedocs.org/en/lat... | sairon/motoscrape | motoscrape/settings.py | Python | unlicense | 3,018 |
import numpy as np
from sklearn.linear_model import ElasticNet
from ..base import BaseModel, use_sklearn
from ..utils import arghandler
# Suppress an annoying error from scikit-learn
import warnings
warnings.filterwarnings(action="ignore", module="scipy",
message="^internal gelsd")
@use_sklea... | harmslab/epistasis | epistasis/models/linear/elastic_net.py | Python | unlicense | 3,836 |
#-----------------------------------------------------
#
# Find the next prime number as the user keeps asking
#
#-----------------------------------------------------
import sys
#------------------------
# is the number a prime?
#------------------------
def is_prime( num ):
for i in range( 2, num ):
if num % i ==... | rdegraw/numbers-py | prime_requests.py | Python | unlicense | 748 |
from pymongo import MongoClient
import dateutil
import dateutil.parser
import datetime
import slack
import slack.chat
slack.api_token = 'SLACK_KEY'
c1 = MongoClient("SOURCE_MONGO_URL")
d1 = c1.mj_tweets
l1 = d1.mj_sample
c2 = MongoClient("DESTINATION_MONGO_URL")
d2 = c2.mj_sample
l2 = d2.mj_sample
start_time = ... | adam704a/useful-scripts | move_tweets.py | Python | unlicense | 853 |
assignments = []
rows = 'ABCDEFGHI'
cols = '123456789'
def assign_value(values, box, value):
"""
Please use this function to update your values dictionary!
Assigns a value to a given box. If it updates the board record it.
"""
# Don't waste memory appending actions that don't actually change any v... | edno/udacity-sandbox | ud889/AIND_Sudoku/solution.py | Python | unlicense | 6,141 |
#!/usr/bin/env python
import os
import shutil
import logging
from unicode_helper import p
__all__ = ["Renamer"]
def log():
"""Returns the logger for current file
"""
return logging.getLogger(__name__)
def same_partition(f1, f2):
"""Returns True if both files or directories are on the same partit... | lahwaacz/tvnamer | tvnamer/renamer.py | Python | unlicense | 4,157 |
# Room-Monster linker
import csv
import os
import sys
import fileinput
csv_file = str(sys.argv[1])
rooms_folder = str(sys.argv[2])
with open(csv_file, 'r') as f:
reader = csv.reader(f)
# Iteration of each row in csv
line_num = 0
for row in reader:
# Ignores header
if line_num != 0... | dynelight/kaos-scripts | build_script_templates/monster_room_linker/monsters_room.py | Python | unlicense | 846 |
'''
Created on Dec 10, 2012
@author: Stephen O'Hara
Utility functions for interacting with certain types
of data files.
'''
import os
import numpy as np
import svo_util
from StringIO import StringIO
import tokenize
find = np.nonzero #this is the matlab command
which = np.nonzero #this is the R command
def smart_spl... | svohara/svo_util | src/svo_util/data_io.py | Python | unlicense | 12,678 |
import smbus
import time
LCD_ADDR = 0x2a
def StringToBytes(val):
retVal = []
for c in val:
retVal.append(ord(c))
return retVal
def SayHello():
try:
bus = smbus.SMBus(1)
messageInBytes = StringToBytes("Isto e uma mensagem maior")
bus.write_i2c_block_... | Hannimal/raspicar | I2C/pyI2CProto.py | Python | unlicense | 500 |
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that r... | viljoviitanen/plugin.minimal.example | addon.py | Python | unlicense | 1,556 |
# Copyright (c) 2008, Guilherme Polo
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and ... | kubow/HAC | Multimedia/Database/TkTableWrapper.py | Python | unlicense | 25,265 |
import urllib2
param_operation = "cover"
param_value = "150x200" # New WIDTHxHEIGHT in pixels.
image_url = "http://images.rethumb.com/image_coimbra_600x300.jpg"
image_filename = "resized-image.jpg"
response = urllib2.urlopen("http://api.rethumb.com/v1/{0}/{1}/{2}".format(param_operation, param_value, image_url))
fh ... | rethumb/rethumb-examples | examples-cover/example-python2.py | Python | unlicense | 384 |
import logging
import logging.config
import os.path
from datetime import date
from datetime import datetime
DEFAULT_LOGGING_CONFIG = {
'level': logging.INFO,
'disable_existing_loggers': False,
}
def json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinst... | tomislacker/python-mke-trash-pickup | mkerefuse/util.py | Python | unlicense | 3,401 |
# -*- coding: utf-8 -*-
import anydbm
import random
arquivo = anydbm.open('dados' , 'c')
arquivo['P1N1'] = 'Longbottom era o sobrenome de quem, nas séries de livros de Harry Potter?'
arquivo['P1C1'] = 'Neville'
arquivo['P1R2'] = 'Hermione'
arquivo['P1R3'] = 'Snape'
arquivo['P1R4'] = 'Dumbledore'
arquivo['P2N1'] = 'Qu... | fllamber/show_do_milhao | Show_do_milhao/Teste.perguntas.py | Python | unlicense | 5,657 |
"""
# PROBLEM 31
In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many different ways can £2 be made using a... | zejacobi/ProjectEuler | Solutions/0031.py | Python | unlicense | 2,719 |
# Django settings for pingpong project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', ... | carschar/socketio-demo | simple/pingping_proj/settings.py | Python | unlicense | 5,136 |
"""Used a sub-module by test.
Illustrates setting breakpoints in non-main modules.
"""
def add(x, y):
return x + y
| guildai/guild | examples/debugging/submod.py | Python | apache-2.0 | 121 |
__source__ = 'https://leetcode.com/problems/validate-stack-sequences/'
# Time: O(N)
# Space: O(N)
#
# Description: Leetcode # 946. Validate Stack Sequences
#
# Given two sequences pushed and popped with distinct values,
# return true if and only if this could have been the result of a sequence of push and pop operatio... | JulyKikuAkita/PythonPrac | cs15211/ValidateStackSequences.py | Python | apache-2.0 | 2,782 |
# -*- coding: utf-8 -*-
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
# Fill in username
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear... | Droriel/python_training | fixture/session.py | Python | apache-2.0 | 1,567 |
import sys
import math
import time
class PreProcessing():
def __init__(self, data_file):
self.data_file = data_file
def preprocess():
print "function preprocess"
start = time.time()
data = open( data_file, 'r' )
data_dic = {}
user_profile_dic = {}
item_p... | weaponsjtu/RecommederSystem | data_processing.py | Python | apache-2.0 | 1,854 |
# 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 agreed to in writing... | google-research/federated | compressed_communication/aggregators/stdev_weights.py | Python | apache-2.0 | 3,289 |
import unittest
import mock
from mopidy_alarmclock import Extension
class ExtensionTest(unittest.TestCase):
def test_get_default_config(self):
ext = Extension()
config = ext.get_default_config()
self.assertIn('[alarmclock]', config)
self.assertIn('enabled = true', config)
... | DavisNT/mopidy-alarmclock | tests/test_extension.py | Python | apache-2.0 | 1,459 |
#!/usr/bin/env python
from selenium import webdriver
from lxml.cssselect import CSSSelector
import selenium.webdriver.support.ui as ui
import MySQLdb
import time
class MyDatabase:
host = ''
user = ''
password = ''
db = ''
def __init__(self):
self.connection = MySQLdb.connect(self.host, self.user, self.passwo... | pablocastelo/tripadvisor_scraping | get_hotel_reviews.py | Python | apache-2.0 | 10,086 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | sachinpro/sachinpro.github.io | tensorflow/python/framework/docs.py | Python | apache-2.0 | 21,127 |
# Copyright 2014-2017 by Akira Yoshiyama <akirayoshiyama@gmail.com>.
# 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/LICE... | yosshy/osclient2 | osclient2/exception.py | Python | apache-2.0 | 770 |
# -*- coding: utf-8 -*-
import webapp2
import os
import random
import copy
import datetime
from google.appengine.ext import db
from twitter.twitter_helper import TwitterHelper
import sentence
import word
class TweetHandler(webapp2.RequestHandler):
def get(self):
# 文章を取得する
s ... | thinkAmi/9784798123028_GAE | chap8/tweet_handler.py | Python | apache-2.0 | 3,592 |
#!/usr/bin/env python
# Copyright 2014-2020 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/grad/uhf.py | Python | apache-2.0 | 4,855 |
# Copyright (c) 2014 Rackspace Hosting
# 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 req... | kiall/designate-py3 | designate/objects/recordset.py | Python | apache-2.0 | 8,399 |
import pytest
from awsshell.fuzzy import fuzzy_search
@pytest.mark.parametrize("search,corpus,expected", [
('foo', ['foobar', 'foobaz'], ['foobar', 'foobaz']),
('f', ['foo', 'foobar', 'bar'], ['foo', 'foobar']),
('fbb', ['foo-bar-baz', 'fo-ba-baz', 'bar'], ['foo-bar-baz', 'fo-ba-baz']),
('fff', ['fi-f... | awslabs/aws-shell | tests/unit/test_fuzzy.py | Python | apache-2.0 | 629 |
"""
:codeauthor: Jayesh Kariya <jayeshk@saltstack.com>
"""
import sys
import pytest
import salt.modules.djangomod as djangomod
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.mock import MagicMock, patch
from tests.support.unit import TestCase
class DjangomodTestCase(TestCase, LoaderMod... | saltstack/salt | tests/unit/modules/test_djangomod.py | Python | apache-2.0 | 8,081 |
import json
import requests
api = 'http://localhost:8000'
headers = {'Content-Type': 'application/vnd.api+json', 'Accept': 'application/vnd.api+json'}
def post(path, payload={}) :
r = requests.post(api+path, data=json.dumps(payload), headers=headers)
if (r.text):
print json.dumps(json.loads(r.text), i... | daishichao/coral | examples/httpMethods.py | Python | apache-2.0 | 963 |
#!/usr/bin/env python
import sys
import gzip
import paddle.v2 as paddle
### Parameters
word_vector_dim = 620
latent_chain_dim = 1000
beam_size = 5
max_length = 50
def seq2seq_net(source_dict_dim, target_dict_dim, generating=False):
'''
Define the network structure of NMT, including encoder and decoder.
... | zhaopu7/models | nmt_without_attention/nmt_without_attention.py | Python | apache-2.0 | 8,713 |
#!/usr/bin/env python3
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | GoogleCloudPlatform/training-data-analyst | quests/data-science-on-gcp-edition1_tf2/04_streaming/simulate/df02.py | Python | apache-2.0 | 1,395 |
# -*- 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 'Dog.abandoned'
db.add_column(u'dogs_dog', 'abandoned',
self.gf('django... | brenolf/myfriend | dogs/migrations/0017_auto__add_field_dog_abandoned__chg_field_dog_gender__chg_field_dog_bre.py | Python | apache-2.0 | 14,562 |
# -*- 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... | googleads/google-ads-python | google/ads/googleads/v9/services/services/conversion_adjustment_upload_service/client.py | Python | apache-2.0 | 20,499 |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | Paebbels/pyAttribute | doc/conf.py | Python | apache-2.0 | 5,614 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Audio Commons Service adaptor guidelines documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 8 13:46:45 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuratio... | AudioCommons/ac-mediator | docs/conf.py | Python | apache-2.0 | 11,164 |
import logging
import random
import bson
import modularodm.exceptions
from django.contrib.contenttypes.fields import (GenericForeignKey,
GenericRelation)
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import MultipleObjectsReturned... | aaxelb/osf.io | osf/models/base.py | Python | apache-2.0 | 12,197 |
import base64
import io
import os
import os.path
import json
import shlex
import sys
import tarfile
import tempfile
import warnings
from distutils.version import StrictVersion
from datetime import datetime
from fnmatch import fnmatch
import requests
import six
from .. import constants
from .. import errors
from .. im... | bfirsh/docker-py | docker/utils/utils.py | Python | apache-2.0 | 39,231 |
#
# Copyright (C) 2008 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 by applicable la... | abstrakraft/repo | subcmds/forall.py | Python | apache-2.0 | 7,450 |
# 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... | mistercrunch/panoramix | superset/db_engine_specs/trino.py | Python | apache-2.0 | 6,834 |
# -*- coding: utf-8 -*-
#
# 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
#... | owlabs/incubator-airflow | airflow/contrib/operators/gcp_natural_language_operator.py | Python | apache-2.0 | 10,313 |
# 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, software
# distributed under the L... | pypa/twine | tests/test_main.py | Python | apache-2.0 | 2,736 |
#!/usr/bin/python
## CABS_Server.py
# This is the webserver that is at the center of the CABS system.
# It is asynchronous, and as such the callbacks and function flow can be a bit confusing
# The basic idea is that the HandleAgentFactory and HandleClienFactory make new HandleAgents and Handle Clients
# There is one p... | jordan9001/CABS | Source/Broker/CABS_server.py | Python | apache-2.0 | 32,754 |
# Copyright 2014 Plexxi, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | ekcs/congress | congress/dse/dataobj.py | Python | apache-2.0 | 3,470 |
# -*- coding: utf-8 -*-
import hashlib
import random
import requests
from flask import current_app
class Vcode(object):
@staticmethod
def random_verification_code():
return ''.join(random.choice('0123456789') for i in range(6))
@staticmethod
def generate_vcode_sign(data):
SMS_SECRET... | moxuanchen/BMS | core/utils/vcode.py | Python | apache-2.0 | 1,445 |
from distutils.core import setup
setup(name='synapseSeq', version='0.1adev', author='Kristen Dang',
author_email='kristen.dang@sagebase.org',
packages=['synapseseq',],
scripts=['scripts/add_eval.py', 'scripts/eval_align_star.py', 'scripts/eval_browserCoverageTrack.py', 'scripts/eval_fusion_qsub.py', ... | Sage-Bionetworks/synapse-seq | setup.py | Python | apache-2.0 | 771 |
#!/usr/bin/env python2.5
#
# Copyright 2011 the Melange 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 applic... | SRabbelier/Melange | app/soc/modules/gsoc/views/helper/request_data.py | Python | apache-2.0 | 14,575 |
from model.contact import Contact
from model.group import Group
from fixture.orm import ORMFixture
import random
def test_del_contact_from_group(app):
orm = ORMFixture(host="127.0.0.1", name="addressbook", user="root", password="")
# check for existing any group
if len(orm.get_group_list()) == 0:
a... | Lana-Pa/Python-training | test/test_delete_contact_from_group.py | Python | apache-2.0 | 1,311 |
# Copyright 2014 Huawei Technologies Co. 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 applicable law or agreed to ... | kidchang/compassv2-api | compass/db/config_validation/default_validator.py | Python | apache-2.0 | 5,205 |
#!/usrbin/python
#encoding:utf-8
'''
Author: wangxu
Email: wangxu@oneniceapp.com
任务更新
'''
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import logging
import tornado.web
import json
import os
import time
CURRENTPATH = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(CURRENTPATH, '... | cocofree/azkaban_assistant | schedule/webapp/handler/job_update.py | Python | apache-2.0 | 2,583 |
# Copyright 2015 Cloudbase Solutions Srl
# 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 r... | adelina-t/compute-hyperv | hyperv/tests/unit/test_eventhandler.py | Python | apache-2.0 | 7,212 |
#!/usr/bin/env python
import os
import setuptools
def _clean_line(line):
line = line.strip()
line = line.split("#")[0]
line = line.strip()
return line
def read_requires(base):
path = os.path.join('tools', base)
requires = []
if not os.path.isfile(path):
return requires
with ... | JohnGarbutt/taskflow-1 | setup.py | Python | apache-2.0 | 1,467 |
"""The Garages Amsterdam integration."""
from datetime import timedelta
import logging
import async_timeout
import garages_amsterdam
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.update_coor... | jawilson/home-assistant | homeassistant/components/garages_amsterdam/__init__.py | Python | apache-2.0 | 1,819 |
# This is an automatically generated file.
# DO NOT EDIT or your changes may be overwritten
import base64
from typing import List
from xdrlib import Packer, Unpacker
from ..type_checked import type_checked
from .ledger_header_history_entry import LedgerHeaderHistoryEntry
from .scp_history_entry import SCPHistoryEntry
... | StellarCN/py-stellar-base | stellar_sdk/xdr/ledger_close_meta_v0.py | Python | apache-2.0 | 5,160 |
# -*- coding: utf-8 -*-
'''
Starting or restarting of services and daemons.
===============================================
Services are defined as system daemons typically started with system init or
rc scripts, services can be defined as running or dead.
.. code-block:: yaml
httpd:
service:
- run... | victorywang80/Maintenance | saltstack/src/salt/states/service.py | Python | apache-2.0 | 14,706 |
# Copyright (c) 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/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | openstack/zaqar | zaqar/storage/sqlalchemy/tables.py | Python | apache-2.0 | 2,182 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 NaviNet Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | NaviNet/ImageFeeder | imagefeeder/imagefeeder.py | Python | apache-2.0 | 19,421 |
# Copyright (c) 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | olivierlemasle/murano | murano/tests/unit/dsl/test_statics.py | Python | apache-2.0 | 4,079 |
import matplotlib.pyplot as plt
import math
import peak_algorithm as pa
z_data = []
x_data = []
y_data = []
with open('a_z.txt') as file:
for line in file:
line = line.strip()
z_data.append(float(line))
with open('a_x.txt') as file:
for line in file:
line = line.strip()
x_data.append(float(line))
with open(... | JohannesV/Fall_Prevention_2013 | Data and scripts/plot_acc_vector.py | Python | apache-2.0 | 1,112 |
import sys
import os
from . import io
from . import root_paths
from abc import *
def ninja_esc_path(path):
return path.replace('$','$$').replace(' ','$ ').replace(':', '$:')
def xlat_path(project, path):
"""Translate common prefix to variable reference."""
if path.startswith(project.projectDir):
... | fifoforlifo/pynja | packages/pynja/build.py | Python | apache-2.0 | 15,654 |
# Copyright 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 requ... | Vaidyanath/tempest | tempest/api/volume/test_volumes_extend.py | Python | apache-2.0 | 1,453 |
from django import forms
from django.contrib import admin
from api.models import Customer, Ticket, Note, ActionItem, Token
class CustomerAdmin(admin.ModelAdmin):
list_display = ("id", "full_name", "phone")
class Meta:
model = Customer
class TicketAdmin(admin.ModelAdmin):
list_display = ("id", "cu... | bob1b/yj | yj/admin.py | Python | apache-2.0 | 1,165 |
# coding: utf-8
#
# Copyright 2015 Palantir Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | palantir/typedjsonrpc | tests/test_server.py | Python | apache-2.0 | 10,750 |
#!/usr/bin/env python
'''
Project: Geothon (https://github.com/MBoustani/Geothon)
File: Vector/zonal_statistics.py
Description: This code calculates statistics of GeoTIFF with polygon Shapefile
Author: Maziyar Boustani (github.com/MBoustani)
'''
import numpy as np
try:
import ogr
except Im... | MBoustani/Geothon | Spatial Analyst Tools/zonal_statistics.py | Python | apache-2.0 | 2,677 |
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.utils.encoding import force_str
from rest_framework import exceptions
from rest_framework.metadata import SimpleMetadata
from rest_framework.request import clone_request
from peering_manager.api import ContentTypeField
cl... | respawner/peering-manager | peering_manager/api/metadata.py | Python | apache-2.0 | 2,404 |
# -*- 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-dialogflow-cx | samples/generated_samples/dialogflow_v3beta1_generated_sessions_detect_intent_async.py | Python | apache-2.0 | 1,676 |
# -*- 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/pulse/pulse_lib/__init__.py | Python | apache-2.0 | 570 |
"""
Any vector field U can be decomposed into a divergence free term
Ud and the gradient of a scalar, phi:
U = Ud + phi
This program recovers a divergemce-free filed on a 2-d grid.
Marina von Steinkirch, based on M. Zingale's codes, spring 2013
"""
from part_a import doPartA
from part_b i... | bt3gl/Numerical-Methods-for-Physics | homework5_elliptic_PDES/main.py | Python | apache-2.0 | 2,009 |
from ..utils import ApiUtil
from ..utils.ApiUtil import Url
class BlueprintHistories:
def __init__(self, code, auth_token, blueprint_id):
self.code = code
self.auth_token = auth_token
self.blueprint_id = blueprint_id
url = Url.blueprintHistoriesList(self.blueprint_id, Url.url)
... | cloudconductor/cloud_conductor_gui | gui_app/api_models/blueprint_histories.py | Python | apache-2.0 | 762 |
# ------------------------------------------------------------------------------
#
# ------------------------------------------------------------------------------
from nose.tools import with_setup
import subprocess
import requests
import os
from .. import util
import time
import json
# -------------------------------... | Verizon/hlx | tests/blackbox/examples/bb_test_basic.py | Python | apache-2.0 | 1,993 |
import logging
import urllib
import json
from edge.writer.proxywriter import ProxyWriter
class Writer(ProxyWriter):
def __init__(self, configFilePath):
super(Writer, self).__init__(configFilePath)
def _generateUrl(self, requestHandler):
url = self._configuration.get('solr', 'url')
par... | dataplumber/edge | src/main/python/plugins/slcp/indicator/Writer.py | Python | apache-2.0 | 2,746 |
# Copyright 2012-2013 Ravello Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | ravello/testmill | lib/testmill/command_run.py | Python | apache-2.0 | 4,718 |
#!/usr/bin/env python
# Copyright 2015, Institute for Systems Biology.
# 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 app... | isb-cgc/ISB-CGC-data-proc | tcga_etl_pipeline/maf/part1/extract2.py | Python | apache-2.0 | 3,767 |
# Copyright 2015 ARM Limited
#
# 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 writin... | jimboatarm/workload-automation | wlauto/workloads/applaunch/__init__.py | Python | apache-2.0 | 7,678 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | psycholab/examples/prisoners_dilemma.py | Python | apache-2.0 | 3,208 |
# Copyright (C) 2009, Radoslav Kirov
#
# Lightout game, by Radoslav Kirov
import pyjd # this is dummy in pyjs.
from pyjamas.ui.FlowPanel import FlowPanel
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.SimplePanel import SimplePanel
from pyjamas.ui.Button import Button
from pyjamas.ui.CheckBox import CheckB... | jaredly/pyjamas | examples/lightout/lightout.py | Python | apache-2.0 | 2,675 |
import re
import SourceModel.SM_CaseStmt
import SourceModel.SM_Class
import SourceModel.SM_Constants as SMCONSTS
import SourceModel.SM_Define
import SourceModel.SM_Define
import SourceModel.SM_Element
import SourceModel.SM_Exec
import SourceModel.SM_FileResource
import SourceModel.SM_IfStmt
import SourceModel.SM_Inclu... | tushartushar/Puppeteer | SourceModel/SM_File.py | Python | apache-2.0 | 17,577 |
#import the required libraries
import pandas as pd
import numpy as np
import os
print(os.getcwd())
df = pd.read_csv("train.csv")
#read the data into a DataFrame
#update the categorial values of Sex into binary values
df.loc[df['Sex'] == 'female','Sex'] = 0
df.loc[df['Sex'] == 'male','Sex'] = 1
df.Embarked.fillna(0)
... | vbsteja/code | Python/Data Science/titanic kaggle/predict_survival.py | Python | apache-2.0 | 1,018 |
from typing import List, Union
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from datahub.metadata.com.linkedin.pegasus2avro.mxe import MetadataChangeEvent
from datahub_provider.hooks.datahub import (
DatahubGenericHook,
DatahubKafkaHook,
DatahubRestHook,
)
... | linkedin/WhereHows | metadata-ingestion/src/datahub_provider/operators/datahub.py | Python | apache-2.0 | 1,848 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
from userena.models import UserenaBaseProfile
from caching.base import CachingManager, CachingMixin
from apps.utils.db import retrieve_i... | dvalcarce/filmyou-web | src/apps/films/models.py | Python | apache-2.0 | 9,791 |
#!/usr/bin/env python
# coding: utf-8
import sys
import time
from twisted.internet import defer, reactor
from twisted.python import log
import txmongo
def getConnection():
print "getting connection..."
return txmongo.MongoConnectionPool()
def getDatabase(conn, dbName):
print "getting database..."
... | claytondaley/mongo-async-python-driver | examples/deferreds/insert.py | Python | apache-2.0 | 1,602 |
# 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
# d... | mrunge/openstack_horizon | openstack_horizon/dashboards/admin/aggregates/forms.py | Python | apache-2.0 | 2,793 |
# Copyright 2014-2017 Spectra Logic Corporation. 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. A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" ... | SpectraLogic/ds3_python3_sdk | samples/getService.py | Python | apache-2.0 | 784 |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tensorflow/fairness-indicators | tensorboard_plugin/tensorboard_plugin_fairness_indicators/version.py | Python | apache-2.0 | 721 |
# Copyright (c) 2010-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 agree... | redbo/swift | swift/common/constraints.py | Python | apache-2.0 | 15,176 |
# !/usr/bin/python2.7 -tt
import sys
def Cat(filename):
| slswee/google_python_exercise | basic/helloworld.py | Python | apache-2.0 | 60 |
__all__ = (
'Net',
)
import builtins
import collections
import itertools
from .errors import InternalError, NodeError
from .marking import Marking
from .net_element import NamedNetElement
from .node import Node
from .place import Place
from .transition import Transition
class Net(NamedNetElement):
__dict_f... | simone-campagna/petra | petra/net.py | Python | apache-2.0 | 7,080 |
# Copyright 2020 The TensorFlow Probability 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 applicable law o... | tensorflow/probability | tensorflow_probability/python/distributions/beta_quotient_test.py | Python | apache-2.0 | 8,738 |
# system configuration generated and used by the sysconfig module
build_time_vars = {'ABIFLAGS': 'm',
'AC_APPLE_UNIVERSAL_BUILD': 0,
'AIX_GENUINE_CPLUSPLUS': 0,
'AR': 'x86_64-linux-gnu-gcc-ar',
'ARFLAGS': 'rc',
'ASDLGEN': 'python3.5 ../Parser/asdl_c.py',
'ASDLGEN_FILES': '../Parser/asdl.py ../Parser/asdl_c.py',
... | arju88nair/projectCulminate | venv/lib/python3.5/plat-x86_64-linux-gnu/_sysconfigdata_m.py | Python | apache-2.0 | 21,469 |
# -*- 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-securitycenter | samples/generated_samples/securitycenter_v1_generated_security_center_get_iam_policy_sync.py | Python | apache-2.0 | 1,489 |
speed = [0.1, 17.5, 40, 48, 52, 69, 88]
lifespan = [2, 8, 70, 1.5, 25, 12, 28]
index = ['snail', 'pig', 'elephant',
'rabbit', 'giraffe', 'coyote', 'horse']
df = pd.DataFrame({'speed': speed,
'lifespan': lifespan}, index=index)
ax = df.plot.bar(rot=0)
| datapythonista/datapythonista.github.io | docs/new-pandas-doc/generated/pandas-DataFrame-plot-bar-2.py | Python | apache-2.0 | 279 |
"""Custom submission times for Backup
Revision ID: 7e1d5c529924
Revises: 6ce2cf5c4534
Create Date: 2016-10-25 20:31:14.423524
"""
# revision identifiers, used by Alembic.
revision = '7e1d5c529924'
down_revision = '6ce2cf5c4534'
from alembic import op
import sqlalchemy as sa
import server
from sqlalchemy.dialects im... | Cal-CS-61A-Staff/ok | migrations/versions/7e1d5c529924_custom_submission_times_for_backup.py | Python | apache-2.0 | 1,201 |
# -*- coding: utf-8 -*-
from model.group import Group
import pytest
def test_add_group(app, db, json_groups):
group = json_groups
with pytest.allure.step('Take existing group list from db'):
old_groups = db.get_group_list()
with pytest.allure.step('Create new group %s' %group):
app.group.cr... | 0verchenko/Addressbook | test/test_add_group.py | Python | apache-2.0 | 638 |
# Copyright 2018 The Cirq Developers
#
# 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 ... | quantumlib/Cirq | cirq-core/cirq/protocols/inverse_protocol_test.py | Python | apache-2.0 | 2,069 |
#!/usr/bin/env python
# encoding: utf-8
"""
Copyright 2014 CryptoIM Development Team
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
... | oskopek/CryptoIM | tests/unit/common.py | Python | apache-2.0 | 1,286 |
"""
This file unregisters the admin class for each model specified in
ALPHAFILTER_ADMIN_FIELDS and replaces it with a new admin class that
subclasses both the original admin and one with an alphabet_filter attribute
"""
from django.db.models import get_model
from django.contrib import admin
from django.conf import s... | affan2/django-alphabetfilter | alphafilter/admin.py | Python | apache-2.0 | 788 |