commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
664dc5124f4786986b2d9e0c2d146c17d24f4dd2 | data_preparation.py | data_preparation.py | # importing modules/ libraries
import pandas as pd
import numpy as np
orders_prior_df = pd.read_csv('Data/orders_prior_sample.csv')
print('length of orders_prior_df:', len(orders_prior_df))
order_products_prior_df = pd.read_csv('Data/order_products_prior_sample.csv')
print('length of order_products_prior_df:', len(or... | Merge prior product ids with orders ids first pass | feat: Merge prior product ids with orders ids first pass
| Python | mit | rjegankumar/instacart_prediction_model | ---
+++
@@ -0,0 +1,28 @@
+# importing modules/ libraries
+import pandas as pd
+import numpy as np
+
+orders_prior_df = pd.read_csv('Data/orders_prior_sample.csv')
+print('length of orders_prior_df:', len(orders_prior_df))
+
+order_products_prior_df = pd.read_csv('Data/order_products_prior_sample.csv')
+print('length ... | |
8013d91077a1b0a51c0caef0222114f98be91033 | httpobs/tests/unittests/test_preload.py | httpobs/tests/unittests/test_preload.py | from unittest import TestCase
from httpobs.scanner.analyzer.utils import *
class TestPreloadPublicKeyPinning(TestCase):
def test_not_preloaded(self):
result = is_hpkp_preloaded('totallyfakehostname.insertsuperduperfakedomainhere.wtftld')
self.assertFalse(result)
def test_preloaded(self):
... | Add tests for HSTS/HPKP functions | Add tests for HSTS/HPKP functions
| Python | mpl-2.0 | april/http-observatory,mozilla/http-observatory,april/http-observatory,mozilla/http-observatory,april/http-observatory,mozilla/http-observatory | ---
+++
@@ -0,0 +1,45 @@
+from unittest import TestCase
+
+from httpobs.scanner.analyzer.utils import *
+
+
+class TestPreloadPublicKeyPinning(TestCase):
+ def test_not_preloaded(self):
+ result = is_hpkp_preloaded('totallyfakehostname.insertsuperduperfakedomainhere.wtftld')
+
+ self.assertFalse(resu... | |
482a00c0a479a06a0e8d54058bb8ea9a12be0023 | api_examples/export_institution_csv.py | api_examples/export_institution_csv.py | #!/bin/python2.7
# -*- coding: utf-8 -*-
"""
A tool to insert institutions from CSV files.
Requirements:
- requests
- gusregon
- unicodecsv
- jmespath
Example usage:
To run help text use:
$ python insert_institution_csv.py -h
"""
from __future__ import print_function, unicode_literals
import argparse
import sys... | Add examples of API to export institutions | Add examples of API to export institutions
| Python | mit | watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder | ---
+++
@@ -0,0 +1,98 @@
+#!/bin/python2.7
+# -*- coding: utf-8 -*-
+"""
+A tool to insert institutions from CSV files.
+
+Requirements:
+ - requests
+ - gusregon
+ - unicodecsv
+ - jmespath
+
+Example usage:
+
+To run help text use:
+$ python insert_institution_csv.py -h
+"""
+from __future__ import print_function, ... | |
ab9c8fca3b53a9f4a3e9b32aa94a597eed5e1e4b | councilmatic_core/migrations/0049_alter_person_headshot.py | councilmatic_core/migrations/0049_alter_person_headshot.py | # Generated by Django 2.1.9 on 2019-07-17 15:16
import django.core.files.storage
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('councilmatic_core', '0048_post_shape'),
]
operations = [
migrations.AlterField(
model_name='per... | Add missing migration for Person.headshot | Add missing migration for Person.headshot
| Python | mit | datamade/django-councilmatic,datamade/django-councilmatic,datamade/django-councilmatic,datamade/django-councilmatic | ---
+++
@@ -0,0 +1,19 @@
+# Generated by Django 2.1.9 on 2019-07-17 15:16
+
+import django.core.files.storage
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('councilmatic_core', '0048_post_shape'),
+ ]
+
+ operations = [
+ migration... | |
da3b186ccb19d137d9a154470d88ee69eec8ef47 | democracy/management/commands/democracy_remove_dupes.py | democracy/management/commands/democracy_remove_dupes.py | from datetime import timedelta
from optparse import make_option
from django.core.management.base import BaseCommand
from django.db.models import Count
from democracy.models import SectionComment
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
make_option("--yes-i-know-what-im-doing... | Implement management command for removing duplicate comments | Implement management command for removing duplicate comments
| Python | mit | vikoivun/kerrokantasi,stephawe/kerrokantasi,stephawe/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,City-of-Helsinki/kerrokantasi,stephawe/kerrokantasi,vikoivun/kerrokantasi,City-of-Helsinki/kerrokantasi,vikoivun/kerrokantasi | ---
+++
@@ -0,0 +1,41 @@
+from datetime import timedelta
+from optparse import make_option
+
+from django.core.management.base import BaseCommand
+from django.db.models import Count
+
+from democracy.models import SectionComment
+
+
+class Command(BaseCommand):
+ option_list = BaseCommand.option_list + (
+ ... | |
cfcd9d72eba2b2f59586816693a93bdab1f01c70 | src/plan_tool.py | src/plan_tool.py | #!env python
from argparse import ArgumentParser
import json
import database as db
from database.model import Team, RouteDistance
from geotools import openroute_link
from geotools.routing import MapPoint
from webapp.cfg.config import DB_CONNECTION
db.init_session(connection_string=DB_CONNECTION)
def read_legacy_p... | Add a script to process the team plans. | Add a script to process the team plans.
It can read the legacy json format and print the old overview.
It can also convert the legacy format to some more readeable.
| Python | bsd-3-clause | janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system | ---
+++
@@ -0,0 +1,90 @@
+#!env python
+
+from argparse import ArgumentParser
+import json
+
+import database as db
+from database.model import Team, RouteDistance
+from geotools import openroute_link
+from geotools.routing import MapPoint
+from webapp.cfg.config import DB_CONNECTION
+
+
+db.init_session(connection_s... | |
3ce0b4f7888aa01ff88fa94ff21ebd8d1f85da43 | readthedocs/donate/migrations/0009_add-error-to-promos.py | readthedocs/donate/migrations/0009_add-error-to-promos.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-03-24 16:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('donate', '0008_add-programming-language-filter'),
]
operations = [
migratio... | Add migration that catches the donate app up | Add migration that catches the donate app up
| Python | mit | rtfd/readthedocs.org,pombredanne/readthedocs.org,davidfischer/readthedocs.org,pombredanne/readthedocs.org,tddv/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,davidfischer/readthedocs.org,safwanrahman/readthedocs.org,davidfischer/readthedocs.org,rtfd/readthedocs.org,pombredanne/readthedocs.org,safwanrahman/re... | ---
+++
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.12 on 2017-03-24 16:03
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('donate', '0008_add-programming-language-filter'),
+ ... | |
a1e096791c12f35889f70655c8b4164593b6fd60 | membership/migrations/0003_ensure_http_prefix_contact_uris.py | membership/migrations/0003_ensure_http_prefix_contact_uris.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
def ensure_http_prefix_contact(apps, schema_editor):
Contact = apps.get_model("membership", "Contact")
# Contacts with broken homepage field value
... | Fix existing home page URIs with migration | Fix existing home page URIs with migration | Python | mit | annttu/sikteeri,AriMartti/sikteeri,joneskoo/sikteeri,kapsiry/sikteeri,kapsiry/sikteeri,kapsiry/sikteeri,AriMartti/sikteeri,kapsiry/sikteeri,annttu/sikteeri,annttu/sikteeri,AriMartti/sikteeri,joneskoo/sikteeri,joneskoo/sikteeri,annttu/sikteeri,AriMartti/sikteeri,joneskoo/sikteeri | ---
+++
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ def ensure_http_prefix_contact(apps, schema_editor):
+ Contact = apps.get_model("membership", "Contact")
+ # Contacts ... | |
08bd011a4783f2f5b162beedf6decd682168e753 | lava_scheduler_app/migrations/0023_update_aliases.py | lava_scheduler_app/migrations/0023_update_aliases.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-24 13:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lava_scheduler_app', '0022_create_devicetype_alias'),
]
operations = [
migr... | Update aliases migration for review change | Update aliases migration for review change
Change-Id: Ia0dca513f058d60c16fb2c6a41c766c99d0850d4
| Python | agpl-3.0 | Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2016-11-24 13:29
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('lava_scheduler_app', '0022_create_devicetype_alias'),
... | |
ceb33c4cfff7dab2a4e05df0b64bf307ce280a58 | saleor/shipping/migrations/0018_default_zones_countries.py | saleor/shipping/migrations/0018_default_zones_countries.py | # Generated by Django 3.0.6 on 2020-06-05 14:35
from django.db import migrations
from ..utils import get_countries_without_shipping_zone
def assign_countries_in_default_shipping_zone(apps, schema_editor):
ShippingZone = apps.get_model("shipping", "ShippingZone")
qs = ShippingZone.objects.filter(default=True... | Add migration to update existing shipping zones | Add migration to update existing shipping zones
| Python | bsd-3-clause | mociepka/saleor,mociepka/saleor,mociepka/saleor | ---
+++
@@ -0,0 +1,28 @@
+# Generated by Django 3.0.6 on 2020-06-05 14:35
+
+from django.db import migrations
+
+from ..utils import get_countries_without_shipping_zone
+
+
+def assign_countries_in_default_shipping_zone(apps, schema_editor):
+ ShippingZone = apps.get_model("shipping", "ShippingZone")
+ qs = Shi... | |
eea45fcad4dda1656de0848b6128271060874850 | string/kmp.py | string/kmp.py | # -*- coding:utf-8 -*-
def build_next_arr(pattern_s):
ps_len = len(pattern_s)
nxt = [-1] * ps_len
k = -1
for i in range(1, ps_len):
while k != -1 and pattern_s[k + 1] != pattern_s[i]:
k = nxt[k]
if pattern_s[k + 1] == pattern_s[i]:
k += 1
nxt[i] = k
... | Add KMP string search algorithm implmentation | Add KMP string search algorithm implmentation
| Python | apache-2.0 | free-free/algorithm,free-free/algorithm | ---
+++
@@ -0,0 +1,43 @@
+# -*- coding:utf-8 -*-
+
+
+def build_next_arr(pattern_s):
+ ps_len = len(pattern_s)
+ nxt = [-1] * ps_len
+ k = -1
+ for i in range(1, ps_len):
+ while k != -1 and pattern_s[k + 1] != pattern_s[i]:
+ k = nxt[k]
+ if pattern_s[k + 1] == pattern_s[i]:
+ ... | |
18b3de9a03db4550d37dde0bf8be648b549b6530 | scripts/registry-cli.py | scripts/registry-cli.py | #!/usr/bin/env python
"""A command-line client for the Docker registry."""
import argparse
import requests
def list_cmd(args):
"""List images"""
url = args.registry + '/v2/_catalog'
r = requests.get(url)
data = r.json()
for repo in data['repositories']:
print(repo)
def list_tags_cmd(a... | Add a script for doing basic maintenance on a private Docker Registry | Add a script for doing basic maintenance on a private Docker Registry
| Python | apache-2.0 | DistributedSystemsGroup/zoe,DistributedSystemsGroup/zoe,DistributedSystemsGroup/zoe,DistributedSystemsGroup/zoe,DistributedSystemsGroup/zoe | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+
+"""A command-line client for the Docker registry."""
+
+import argparse
+
+import requests
+
+
+def list_cmd(args):
+ """List images"""
+ url = args.registry + '/v2/_catalog'
+ r = requests.get(url)
+ data = r.json()
+ for repo in data['repositories']:... | |
4bb12a983f45c920088087f1edf3e00d9801b4bf | swarm_extraction/extraction.py | swarm_extraction/extraction.py | #
# Copyright (C) 2015 Jonathan Finlay <jfinlay@riseup.net>
#
# 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 la... | Add Campain & tag classes, created assembler package dir | Add Campain & tag classes, created assembler package dir
| Python | agpl-3.0 | jonathanf/swarm | ---
+++
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2015 Jonathan Finlay <jfinlay@riseup.net>
+#
+# 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... | |
b78cdaa7460b6453eef3c3e825ba1f29279cf582 | tests/test_graphs_threshold.py | tests/test_graphs_threshold.py | # -*- coding: utf-8 -*-
import numpy as np
from numpy import testing
# dyfunconn
from dyfunconn.graphs import (threshold_mean_degree,
threshold_mst_mean_degree,
threshold_shortest_paths,
threshold_global_cost_efficiency,
... | Add placeholder unit tests for the thresholding methods. | Add placeholder unit tests for the thresholding methods.
| Python | bsd-3-clause | makism/dyfunconn | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+import numpy as np
+from numpy import testing
+
+# dyfunconn
+from dyfunconn.graphs import (threshold_mean_degree,
+ threshold_mst_mean_degree,
+ threshold_shortest_paths,
+ thre... | |
4d659f566f094a42057023dcc82a3ca8810c5ba6 | tests/micropython/heapalloc.py | tests/micropython/heapalloc.py | # check that we can do certain things without allocating heap memory
import gc
def f(a):
print(a)
def g(a, b=2):
print(a, b)
global_var = 1
def h():
global global_var
global_var = 2 # set an existing global variable
for i in range(2): # for loop
f(i) # function call
... | Add feature test for when heap allocation is disabled. | tests: Add feature test for when heap allocation is disabled.
| Python | mit | toolmacher/micropython,utopiaprince/micropython,alex-robbins/micropython,methoxid/micropystat,adamkh/micropython,TDAbboud/micropython,blmorris/micropython,AriZuu/micropython,paul-xxx/micropython,adafruit/circuitpython,tuc-osg/micropython,rubencabrera/micropython,tuc-osg/micropython,ruffy91/micropython,drrk/micropython,... | ---
+++
@@ -0,0 +1,26 @@
+# check that we can do certain things without allocating heap memory
+
+import gc
+
+def f(a):
+ print(a)
+
+def g(a, b=2):
+ print(a, b)
+
+global_var = 1
+
+def h():
+ global global_var
+ global_var = 2 # set an existing global variable
+ for i in range(2): # for loop
... | |
9b7ca0f242d1c28c9ca53be4be0a83a6d1121ae6 | conference/management/commands/make_speaker_profiles_public.py | conference/management/commands/make_speaker_profiles_public.py | # -*- coding: UTF-8 -*-
from __future__ import print_function
from django.core.management.base import BaseCommand
from assopy import models as amodels
from conference import models as cmodels
def make_speaker_profiles_public_for_conference(conference):
# Get speaker records
speakers = set()
talks = cmode... | Add script to make speaker profiles public. | Add script to make speaker profiles public.
| Python | bsd-2-clause | EuroPython/epcon,EuroPython/epcon,EuroPython/epcon,EuroPython/epcon | ---
+++
@@ -0,0 +1,39 @@
+# -*- coding: UTF-8 -*-
+
+from __future__ import print_function
+from django.core.management.base import BaseCommand
+from assopy import models as amodels
+from conference import models as cmodels
+
+def make_speaker_profiles_public_for_conference(conference):
+
+ # Get speaker records
+... | |
0b3e8506f4b1d63cb54414b9462a85828855b926 | ui/gfx/compositor/PRESUBMIT.py | ui/gfx/compositor/PRESUBMIT.py | # Copyright (c) 2011 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.
"""Chromium presubmit script for src/chrome/browser/externsions.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more de... | Add aura compile testing by default to likely areas (2). | Add aura compile testing by default to likely areas (2).
BUG=chromium:107599
TEST=None
Review URL: http://codereview.chromium.org/8907045
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@114850 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | ltilve/chromium,keishi/chromium,bright-sparks/chromium-spacewalk,hujiajie/pa-chromium,ltilve/chromium,dednal/chromium.src,dushu1203/chromium.src,Just-D/chromium-1,markYoungH/chromium.src,Pluto-tv/chromium-crosswalk,markYoungH/chromium.src,junmin-zhu/chromium-rivertrail,dednal/chromium.src,pozdnyakov/chromium-crosswalk,... | ---
+++
@@ -0,0 +1,12 @@
+# Copyright (c) 2011 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.
+
+"""Chromium presubmit script for src/chrome/browser/externsions.
+
+See http://dev.chromium.org/developers/how-tos/depott... | |
016c3b50ef2fbb8d508a7f5aecd20135ae3c37ee | froide/foirequest/migrations/0017_auto_20180405_1626.py | froide/foirequest/migrations/0017_auto_20180405_1626.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-04-05 14:26
from __future__ import unicode_literals
from django.db import migrations, models
import froide.foirequest.models.attachment
import froide.helper.storage
class Migration(migrations.Migration):
dependencies = [
('foirequest', '0016_f... | Use hashed filename storage in attachment model | Use hashed filename storage in attachment model | Python | mit | fin/froide,stefanw/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,stefanw/froide,stefanw/froide,fin/froide | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.9 on 2018-04-05 14:26
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import froide.foirequest.models.attachment
+import froide.helper.storage
+
+
+class Migration(migrations.Migration):
+
+ dependen... | |
bee38446253b865d7f9ebcc0e507666b6bf7314c | examples/remote_image.py | examples/remote_image.py | import requests
from os import environ
from python_anticaptcha import AnticaptchaClient, ImageToTextTask
api_key = environ['KEY']
URL = 'https://raw.githubusercontent.com/ad-m/python-anticaptcha/master/examples/captcha_ms.jpeg'
EXPECTED_RESULT = '56nn2'
def process(url):
session = requests.Session()
client... | Add example for remote image in ImageToTextTask | Add example for remote image in ImageToTextTask
| Python | mit | ad-m/python-anticaptcha | ---
+++
@@ -0,0 +1,24 @@
+import requests
+from os import environ
+
+from python_anticaptcha import AnticaptchaClient, ImageToTextTask
+
+api_key = environ['KEY']
+
+URL = 'https://raw.githubusercontent.com/ad-m/python-anticaptcha/master/examples/captcha_ms.jpeg'
+EXPECTED_RESULT = '56nn2'
+
+
+def process(url):
+ ... | |
59dbe66c2e69397b98e1df933f4b33d9d4a3fffc | examples/spacy_basics.py | examples/spacy_basics.py | #!/usr/bin/env python
"""Check basic SpaCy functionality."""
# set path to project -> change if needed
project_path = '/Users/EB/Google Drive/Projects/breweries'
# modules
import pickle
import spacy
import os
# change directory and load Beer class
os.chdir(project_path + '/modules/')
from beeradvocate.classes impo... | Check out spaCy basic functionality | Check out spaCy basic functionality
| Python | mit | ebommes/breweries | ---
+++
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+"""Check basic SpaCy functionality."""
+
+# set path to project -> change if needed
+project_path = '/Users/EB/Google Drive/Projects/breweries'
+
+# modules
+import pickle
+import spacy
+import os
+
+# change directory and load Beer class
+os.chdir(project_path + '/m... | |
a97a1a15f80c9a7e33daa34392dc432b77e2461d | src/oscar/apps/catalogue/migrations/0005_auto_20150604_1450.py | src/oscar/apps/catalogue/migrations/0005_auto_20150604_1450.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0004_auto_20150217_1710'),
]
operations = [
migrations.AlterField(
... | Add migration that allows product_class FK to be blank | Add migration that allows product_class FK to be blank
| Python | bsd-3-clause | Jannes123/django-oscar,pdonadeo/django-oscar,itbabu/django-oscar,pasqualguerrero/django-oscar,kapari/django-oscar,anentropic/django-oscar,lijoantony/django-oscar,binarydud/django-oscar,MatthewWilkes/django-oscar,jmt4/django-oscar,WillisXChen/django-oscar,sonofatailor/django-oscar,michaelkuty/django-oscar,michaelkuty/dj... | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('catalogue', '0004_auto_20150217_1710'),
+ ]
+
+ operations = [
+... | |
f05cecd96aacccbdd567807516bcf79d6ab83ed0 | web/ext/mongodb/mongoengine.py | web/ext/mongodb/mongoengine.py | # encoding: utf-8
import re
from mongoengine import connect
from marrow.package.loader import load
from web.core.compat import native, iteritems
log = __import__('logging').getLogger(__name__)
_safe_uri_replace = re.compile(r'(\w+)://(\w+):(?P<password>[^@]+)@')
class MongoEngineExtension:
__slots__ = ('uri', '... | Add MongoEngine to the pile. | Add MongoEngine to the pile.
| Python | mit | marrow/WebCore,marrow/WebCore | ---
+++
@@ -0,0 +1,59 @@
+# encoding: utf-8
+
+import re
+from mongoengine import connect
+
+from marrow.package.loader import load
+from web.core.compat import native, iteritems
+
+
+log = __import__('logging').getLogger(__name__)
+
+_safe_uri_replace = re.compile(r'(\w+)://(\w+):(?P<password>[^@]+)@')
+
+
+class Mo... | |
302dc5cb006dc6a068b5d78428bec5106d614391 | glaciercmd/command_list_known_archives_for_vault.py | glaciercmd/command_list_known_archives_for_vault.py | import boto
import datetime
from boto.dynamodb2.table import Table
from boto.dynamodb2.table import HashKey
from boto.dynamodb2.layer1 import DynamoDBConnection
class CommandListKnownArchivesForVault(object):
def execute(self, args, config):
glacier_connection = boto.connect_glacier(aws_access_key_id=config.ge... | Add list known archives command | Add list known archives command
| Python | mit | carsonmcdonald/glacier-cmd | ---
+++
@@ -0,0 +1,37 @@
+import boto
+import datetime
+
+from boto.dynamodb2.table import Table
+from boto.dynamodb2.table import HashKey
+from boto.dynamodb2.layer1 import DynamoDBConnection
+
+class CommandListKnownArchivesForVault(object):
+
+ def execute(self, args, config):
+ glacier_connection = boto.conne... | |
6c820df40cf410314679c08502ba41a44b489b45 | senlin/tests/tempest/api/api_versions/test_api_version_show.py | senlin/tests/tempest/api/api_versions/test_api_version_show.py | # 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... | Add tempest API test for API version show | Add tempest API test for API version show
This patch add tempest API test for API version show.
Change-Id: I1cf7cba550bb04629acab9899be310fd3b767576
| Python | apache-2.0 | openstack/senlin,openstack/senlin,stackforge/senlin,stackforge/senlin,openstack/senlin | ---
+++
@@ -0,0 +1,31 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writi... | |
dff9dced1bf1bbb684af4ba02febd255352484d5 | official_documents/migrations/0004_auto_20150410_1054.py | official_documents/migrations/0004_auto_20150410_1054.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('official_documents', '0003_add_group'),
]
operations = [
migrations.AlterField(
model_name='officialdocument',
... | Add a migration that Django detects as a change | Add a migration that Django detects as a change
| Python | agpl-3.0 | neavouli/yournextrepresentative,datamade/yournextmp-popit,mysociety/yournextrepresentative,DemocracyClub/yournextrepresentative,neavouli/yournextrepresentative,openstate/yournextrepresentative,mysociety/yournextmp-popit,YoQuieroSaber/yournextrepresentative,openstate/yournextrepresentative,DemocracyClub/yournextrepresen... | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('official_documents', '0003_add_group'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
e60c3e6c89d31d030af963722d44f668781ed461 | 9/e9.py | 9/e9.py | #!/usr/bin/env python -tt -Wall
import itertools
def main():
k = 1000
factors = [4, 25]
ranges = (xrange(f, k/4, f) for f in factors)
multiples = itertools.ifilter(lambda m: not k%(2*m), itertools.chain(*ranges))
raw_pairs = itertools.imap(lambda m: (m, (k/(2*m)) - m), multiples)
pairs = itertools.ifilter(lambd... | Add a script that solves problem 9. | Add a script that solves problem 9.
| Python | mit | cveazey/ProjectEuler,cveazey/ProjectEuler | ---
+++
@@ -0,0 +1,17 @@
+#!/usr/bin/env python -tt -Wall
+
+import itertools
+
+def main():
+ k = 1000
+ factors = [4, 25]
+ ranges = (xrange(f, k/4, f) for f in factors)
+ multiples = itertools.ifilter(lambda m: not k%(2*m), itertools.chain(*ranges))
+ raw_pairs = itertools.imap(lambda m: (m, (k/(2*m)) - m), multip... | |
5b15efa07d9e619ead833d1ef0056a3c2b5df930 | openstack/tests/functional/network/v2/test_quota.py | openstack/tests/functional/network/v2/test_quota.py | # 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... | Add functional test for Network Quota | Add functional test for Network Quota
test:
test_list
Change-Id: Ie484bc8b36da22a2b3894efb35903ae04a78db7b
| Python | apache-2.0 | stackforge/python-openstacksdk,briancurtin/python-openstacksdk,dudymas/python-openstacksdk,stackforge/python-openstacksdk,mtougeron/python-openstacksdk,openstack/python-openstacksdk,dudymas/python-openstacksdk,briancurtin/python-openstacksdk,dtroyer/python-openstacksdk,openstack/python-openstacksdk,mtougeron/python-ope... | ---
+++
@@ -0,0 +1,27 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writi... | |
2edf63fe25ccc1479ececb83eca005a221a67fa1 | candidates/management/commands/candidates_fix_party_ids_in_json.py | candidates/management/commands/candidates_fix_party_ids_in_json.py | from collections import defaultdict
import json
from os.path import join
import re
from django.core.management.base import BaseCommand
from candidates.static_data import data_directory
def get_max_party_id(party_data):
"""Find the highest numeric ID from party IDs of the party:1234 form"""
max_id = -1
fo... | Add a command to fix duplicate 'party:' IDs in the party JSON | Add a command to fix duplicate 'party:' IDs in the party JSON
| Python | agpl-3.0 | datamade/yournextmp-popit,neavouli/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextmp-popit,DemocracyClub/yournextrepresentative,datamade/yournextmp-popit,neavouli/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextmp... | ---
+++
@@ -0,0 +1,63 @@
+from collections import defaultdict
+import json
+from os.path import join
+import re
+
+from django.core.management.base import BaseCommand
+
+from candidates.static_data import data_directory
+
+def get_max_party_id(party_data):
+ """Find the highest numeric ID from party IDs of the par... | |
0253f5a3746fc3d2eebf1bf8cc997023062dd7e5 | SOAPpy/tests/ZeroLengthArray.py | SOAPpy/tests/ZeroLengthArray.py | import sys
sys.path.insert(1, "..")
from SOAPpy import *
one = typedArrayType(data=[1],typed=type(1))
tmp = typedArrayType(data=[], typed=type(1))
print buildSOAP( one )
print buildSOAP( tmp )
| Test handling of zero-length typed lists. Currently fails. | Test handling of zero-length typed lists. Currently fails.
git-svn-id: c4afb4e777bcbfe9afa898413b708b5abcd43877@930 7150bf37-e60d-0410-b93f-83e91ef0e581
| Python | mit | acigna/pywez,acigna/pywez,acigna/pywez | ---
+++
@@ -0,0 +1,8 @@
+import sys
+sys.path.insert(1, "..")
+from SOAPpy import *
+
+one = typedArrayType(data=[1],typed=type(1))
+tmp = typedArrayType(data=[], typed=type(1))
+print buildSOAP( one )
+print buildSOAP( tmp ) | |
f509b56386a9b9d278345c0132757251291a4c51 | contract_sale_generation/tests/test_contract_sale_recurrency.py | contract_sale_generation/tests/test_contract_sale_recurrency.py | # Copyright 2022 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from freezegun.api import freeze_time
from odoo import fields
from odoo.tests import Form
from odoo.tests.common import SavepointCase
from .common import ContractSaleCommon
def to_date(date):
return fields.Date.to_da... | Add tests with another recurrency | [14.0][IMP] contract_sale_generation: Add tests with another recurrency
| Python | agpl-3.0 | OCA/contract,OCA/contract,OCA/contract | ---
+++
@@ -0,0 +1,78 @@
+# Copyright 2022 ACSONE SA/NV
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from freezegun.api import freeze_time
+
+from odoo import fields
+from odoo.tests import Form
+from odoo.tests.common import SavepointCase
+
+from .common import ContractSaleCommon
+
+
+def to_... | |
251d6500e8a5406cfc16c3a8b92a8f9d28d5a308 | firecares/firestation/migrations/0040_auto_20170126_1640.py | firecares/firestation/migrations/0040_auto_20170126_1640.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('firestation', '0039_auto_20170126_0857'),
]
sql = """
CREATE OR REPLACE FUNCTION department_fts_document(integer) RETURNS tsvector ... | Replace FTS functions since the FD table definition has changed. | Replace FTS functions since the FD table definition has changed.
| Python | mit | FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares | ---
+++
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('firestation', '0039_auto_20170126_0857'),
+ ]
+
+ sql = """
+ CREATE OR REPLACE FUNCTION departmen... | |
7d897f8238be590e1359fa2b70eb43bc0fd62a9c | easy_thumbnails/tests/test_management.py | easy_thumbnails/tests/test_management.py | from easy_thumbnails.tests import utils as test
class ThumbnailCleanupTests(test.BaseTest):
def test_can_import(self):
"""
Just a simple test to see if we can actually import the command without
any syntax errors.
"""
from easy_thumbnails.management.commands import thumbna... | Add a simple stupid test to just import the management command | Add a simple stupid test to just import the management command
| Python | bsd-3-clause | SmileyChris/easy-thumbnails,siovene/easy-thumbnails,jaddison/easy-thumbnails,sandow-digital/easy-thumbnails-cropman,sandow-digital/easy-thumbnails-cropman,Mactory/easy-thumbnails | ---
+++
@@ -0,0 +1,11 @@
+from easy_thumbnails.tests import utils as test
+
+
+class ThumbnailCleanupTests(test.BaseTest):
+
+ def test_can_import(self):
+ """
+ Just a simple test to see if we can actually import the command without
+ any syntax errors.
+ """
+ from easy_thumbna... | |
b3daa95278783424705d18d51313180680b053e2 | tests/test_i19screen.py | tests/test_i19screen.py | from __future__ import division, absolute_import
from i19.command_line.screen import i19_screen
def test_i19screen_command_line_help_does_not_crash():
i19_screen().run('')
def test_i19screen(tmpdir):
import os
import libtbx
xia2_regression = libtbx.env.under_build("xia2_regression")
data_dir = os.path.joi... | Add integration test for i19 screen using xia2 regression data | Add integration test for i19 screen using xia2 regression data
| Python | bsd-3-clause | xia2/i19 | ---
+++
@@ -0,0 +1,21 @@
+from __future__ import division, absolute_import
+
+from i19.command_line.screen import i19_screen
+
+def test_i19screen_command_line_help_does_not_crash():
+ i19_screen().run('')
+
+def test_i19screen(tmpdir):
+ import os
+ import libtbx
+ xia2_regression = libtbx.env.under_build("xia2_... | |
776ba9510fa80b68904b03c9a7620751ffdc41ac | contentcuration/contentcuration/tests/test_makemessages.py | contentcuration/contentcuration/tests/test_makemessages.py | import os
import pathlib
import subprocess
from django.conf import settings
from django.test import TestCase
class MakeMessagesCommandRunTestCase(TestCase):
"""
Sanity check to make sure makemessages runs to completion.
"""
def test_command_succeeds_without_postgres(self):
"""
Test t... | Write test to confirm that makemessages works without needing postgres | Write test to confirm that makemessages works without needing postgres
| Python | mit | DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation,DXCanas/content-curation | ---
+++
@@ -0,0 +1,28 @@
+import os
+import pathlib
+import subprocess
+
+from django.conf import settings
+from django.test import TestCase
+
+
+class MakeMessagesCommandRunTestCase(TestCase):
+ """
+ Sanity check to make sure makemessages runs to completion.
+ """
+
+ def test_command_succeeds_without_p... | |
b3c60add1a75975b2e420747b545219ae954b1e2 | sort-readlist.py | sort-readlist.py | #!/usr/bin/python
import logging
import re
import subprocess
import sys
import os
import calibre_config
from calibre.library.database2 import LibraryDatabase2
from calibre.utils.config import prefs
import args
TODO_DIR = os.path.join(os.environ['HOME'], 'Dropbox', 'todo')
ISSUE_PATTERN = re.compile('(\d+) (.*)$')
... | Sort to-read list by publication date | Sort to-read list by publication date
| Python | mit | xchewtoyx/comicmgt,xchewtoyx/comicmgt | ---
+++
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+import logging
+import re
+import subprocess
+import sys
+import os
+
+import calibre_config
+from calibre.library.database2 import LibraryDatabase2
+from calibre.utils.config import prefs
+
+import args
+
+TODO_DIR = os.path.join(os.environ['HOME'], 'Dropbox', 'todo')
+... | |
17f0b440acc0e67067704d93427c3b4ce7ef5d9e | common/lib/xmodule/xmodule/modulestore/mongoengine_fields.py | common/lib/xmodule/xmodule/modulestore/mongoengine_fields.py | """
Custom field types for mongoengine
"""
import mongoengine
from xmodule.modulestore.locations import SlashSeparatedCourseKey, Location
from types import NoneType
from xmodule.modulestore.keys import CourseKey
class CourseKeyField(mongoengine.StringField):
"""
Serializes and deserializes CourseKey's to mong... | Make course ids and usage ids opaque to LMS and Studio [partial commit] | Make course ids and usage ids opaque to LMS and Studio [partial commit]
This commit adds custom mongoengine fields for CourseKeys and UsageKeys.
These keys are now objects with a limited interface, and the particular
internal representation is managed by the data storage layer (the
modulestore).
For the LMS, there s... | Python | agpl-3.0 | analyseuc3m/ANALYSE-v1,LearnEra/LearnEraPlaftform,jazkarta/edx-platform,dsajkl/123,zubair-arbi/edx-platform,cecep-edu/edx-platform,jamiefolsom/edx-platform,peterm-itr/edx-platform,proversity-org/edx-platform,ferabra/edx-platform,ESOedX/edx-platform,tiagochiavericosta/edx-platform,beacloudgenius/edx-platform,chand3040/c... | ---
+++
@@ -0,0 +1,88 @@
+"""
+Custom field types for mongoengine
+"""
+import mongoengine
+from xmodule.modulestore.locations import SlashSeparatedCourseKey, Location
+from types import NoneType
+from xmodule.modulestore.keys import CourseKey
+
+
+class CourseKeyField(mongoengine.StringField):
+ """
+ Serializ... | |
3c07cf2efb8bddedcbba814e97229df99fcd44cf | ditto/twitter/migrations/0055_re_save_tweets_for_new_html.py | ditto/twitter/migrations/0055_re_save_tweets_for_new_html.py | # Generated by Django 2.0.4 on 2018-04-16 11:44
from django.db import migrations
def re_save_tweets(apps, schema_editor):
"""
Re-save all of the Tweets so that the HTML version of their text is updated
using the newer version of Twython.
"""
Tweet = apps.get_model('twitter', 'Tweet')
for twe... | Add migration to re-save all Tweets | Add migration to re-save all Tweets
So that the HTML version of their text uses the newer version of Twython
which fixes some issues with entities in tweets.
| Python | mit | philgyford/django-ditto,philgyford/django-ditto,philgyford/django-ditto | ---
+++
@@ -0,0 +1,25 @@
+# Generated by Django 2.0.4 on 2018-04-16 11:44
+
+from django.db import migrations
+
+
+def re_save_tweets(apps, schema_editor):
+ """
+ Re-save all of the Tweets so that the HTML version of their text is updated
+ using the newer version of Twython.
+ """
+ Tweet = apps.get_... | |
9cb92e07c8e92dfd6be51f924e23d60b0cb24185 | fjord/suggest/providers/trigger/migrations/0002_auto_20150831_0912.py | fjord/suggest/providers/trigger/migrations/0002_auto_20150831_0912.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import fjord.base.models
class Migration(migrations.Migration):
dependencies = [
('trigger', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='triggerr... | Add migration for help text for trigger models | Add migration for help text for trigger models
| Python | bsd-3-clause | Ritsyy/fjord,lgp171188/fjord,lgp171188/fjord,Ritsyy/fjord,lgp171188/fjord,hoosteeno/fjord,Ritsyy/fjord,mozilla/fjord,hoosteeno/fjord,hoosteeno/fjord,mozilla/fjord,mozilla/fjord,mozilla/fjord,lgp171188/fjord,hoosteeno/fjord,Ritsyy/fjord | ---
+++
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import fjord.base.models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('trigger', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.Al... | |
ea62ed3f9c2dd96d22b05abfb22b36b3a141901b | file_manager.py | file_manager.py | # Copyright 2011, The Board of Regents of Leland Stanford, Jr. University
# All rights reserved. See LICENSE.
# Author: Scott Williams <scottw@artesiancode.com>
# Description: A shim over the filesystem so we can avoid clobbering files we
# don't own.
| Add a stub for the file manager | Add a stub for the file manager
| Python | bsd-2-clause | starpow971/Stanford-Humanities-Center-Updater,starpow971/Stanford-Humanities-Center-Updater | ---
+++
@@ -0,0 +1,5 @@
+# Copyright 2011, The Board of Regents of Leland Stanford, Jr. University
+# All rights reserved. See LICENSE.
+# Author: Scott Williams <scottw@artesiancode.com>
+# Description: A shim over the filesystem so we can avoid clobbering files we
+# don't own. | |
996405d96b1dccab95548de32e24e54d0fc06c38 | drain_all_queues.py | drain_all_queues.py | from helpers import client
if __name__ == '__main__':
scrape = client.queue('scrape')
ingest = client.queue('ingest')
complete = client.queue('completed')
were_messages = True
while were_messages:
were_messages = False
for msg in scrape.claim(ttl=60, grace=60):
msg.delet... | Add script to drain all the work/production queues | Add script to drain all the work/production queues
| Python | mit | ryansb/zaqar-webscraper-demo | ---
+++
@@ -0,0 +1,19 @@
+from helpers import client
+
+if __name__ == '__main__':
+ scrape = client.queue('scrape')
+ ingest = client.queue('ingest')
+ complete = client.queue('completed')
+ were_messages = True
+ while were_messages:
+ were_messages = False
+ for msg in scrape.claim(ttl... | |
ca2407c8d2cb0f151b9fda0a15c9d242d3ad6aa8 | arches/app/models/migrations/5616_search_export_history.py | arches/app/models/migrations/5616_search_export_history.py | # Generated by Django 2.2.6 on 2019-12-16 13:40
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('models', '56... | Migrate the db to add search_export_history table | Migrate the db to add search_export_history table
| Python | agpl-3.0 | archesproject/arches,archesproject/arches,archesproject/arches,archesproject/arches | ---
+++
@@ -0,0 +1,31 @@
+# Generated by Django 2.2.6 on 2019-12-16 13:40
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+import uuid
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ migrations.swappable_dependency(settings.A... | |
7adab964e523ec6af96acbea0fa7f30efef78dc8 | examples/tracing/strlen_hist.py | examples/tracing/strlen_hist.py | #!/usr/bin/python
#
# strlen_hist.py Histogram of system-wide strlen return values
#
# A basic example of using uprobes along with a histogram to show
# distributions.
#
# Runs until ctrl-c is pressed.
#
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
#
# Example outp... | Add uprobe strlen histogram example | Add uprobe strlen histogram example
This example traces all calls to libc's strlen(). The program is attached as a
retprobe, therefore giving access to the resulting string length. The value is
kept in a log2 histogram that is printed to console once per second.
Example:
```
$ sudo ./strlen_hist.py
22:12:51
strl... | Python | apache-2.0 | romain-intel/bcc,tuxology/bcc,brendangregg/bcc,mcaleavya/bcc,zaafar/bcc,romain-intel/bcc,tuxology/bcc,shodoco/bcc,shodoco/bcc,iovisor/bcc,iovisor/bcc,mkacik/bcc,mcaleavya/bcc,mkacik/bcc,iovisor/bcc,mcaleavya/bcc,mcaleavya/bcc,mkacik/bcc,mcaleavya/bcc,shodoco/bcc,brendangregg/bcc,brendangregg/bcc,zaafar/bcc,tuxology/bcc... | ---
+++
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+
+#
+# strlen_hist.py Histogram of system-wide strlen return values
+#
+# A basic example of using uprobes along with a histogram to show
+# distributions.
+#
+# Runs until ctrl-c is pressed.
+#
+# Copyright (c) PLUMgrid, Inc.
+# Licensed under the Apache License, Versio... | |
71fa8ba0890fcff363b473d5a79069b69731330e | fcm_django/migrations/0006_auto_20210802_1140.py | fcm_django/migrations/0006_auto_20210802_1140.py | # Generated by Django 3.1.12 on 2021-08-02 11:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fcm_django', '0005_auto_20170808_1145'),
]
operations = [
migrations.AlterField(
model_name='fcmdevice',
name='devi... | Add migration for field length | Add migration for field length
| Python | mit | xtrinch/fcm-django | ---
+++
@@ -0,0 +1,18 @@
+# Generated by Django 3.1.12 on 2021-08-02 11:40
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('fcm_django', '0005_auto_20170808_1145'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model... | |
8cb2ef91756ee8f06fa816d522655c796b7ed9cc | controllers/alert_controller.py | controllers/alert_controller.py | from database_access import guardeddatabase as gdb
from serializers.alert import alert_schema
from settings import DEFAULT_RADIUS
def get_alerts(*args, **kwargs):
latitude = kwargs.get('lat')
longitude = kwargs.get('lon')
alerts = gdb.get_alerts(lat=latitude, lon=longitude, radius=DEFAULT_RADIUS)
re... | Add SQLAlchemy database access with models and serializers | Add SQLAlchemy database access with models and serializers
| Python | apache-2.0 | frodriguezf/flood-alert,frodriguezf/flood-alert,frodriguezf/flood-alert,frodriguezf/flood-alert | ---
+++
@@ -0,0 +1,12 @@
+from database_access import guardeddatabase as gdb
+from serializers.alert import alert_schema
+from settings import DEFAULT_RADIUS
+
+
+def get_alerts(*args, **kwargs):
+ latitude = kwargs.get('lat')
+ longitude = kwargs.get('lon')
+
+ alerts = gdb.get_alerts(lat=latitude, lon=long... | |
33e32b6660596c439db0f9615d83512063ea79a8 | devicehive/connection_handler.py | devicehive/connection_handler.py | from devicehive.handlers.base_handler import BaseHandler
from devicehive.api import Api
class ConnectionHandler(BaseHandler):
"""Connection handler class."""
def __init__(self, transport, handler_class=None, handler_options=None,
refresh_token=None, access_token=None):
assert handler... | Move handler to connection handler | Move handler to connection handler
| Python | apache-2.0 | devicehive/devicehive-python | ---
+++
@@ -0,0 +1,29 @@
+from devicehive.handlers.base_handler import BaseHandler
+from devicehive.api import Api
+
+
+class ConnectionHandler(BaseHandler):
+ """Connection handler class."""
+
+ def __init__(self, transport, handler_class=None, handler_options=None,
+ refresh_token=None, access... | |
7bdc76d31ad8a32b2ff79eff2530ac12c9b7b3bd | indra/sources/eidos/eidos_cli.py | indra/sources/eidos/eidos_cli.py | """
This is a Python based command line interface to Eidos
to complement the Python-Java bridge based interface.
EIDOSPATH (in the INDRA config.ini or as an environmental variable)
needs to be pointing to a fat JAR of the Eidos system.
"""
import os
import glob
import logging
import subprocess
from indra import get_con... | Add a CLI to call Eidos | Add a CLI to call Eidos
| Python | bsd-2-clause | sorgerlab/indra,sorgerlab/belpy,bgyori/indra,pvtodorov/indra,johnbachman/indra,johnbachman/belpy,johnbachman/indra,pvtodorov/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/indra,sorgerlab/belpy,johnbachman/indra,bgyori/indra,johnbachman/belpy,johnbachman/belpy | ---
+++
@@ -0,0 +1,87 @@
+"""
+This is a Python based command line interface to Eidos
+to complement the Python-Java bridge based interface.
+EIDOSPATH (in the INDRA config.ini or as an environmental variable)
+needs to be pointing to a fat JAR of the Eidos system.
+"""
+import os
+import glob
+import logging
+import... | |
ae71d06c07488b8a0e9ba0b479b8b2f29ae08c18 | scripts/stock_price/white_noise.py | scripts/stock_price/white_noise.py | #!/usr/bin/python3
# coding: utf-8
'''
Create a white noise animation like a TV screen
'''
import numpy as np
from PIL import Image
width = 128
height = 96
n_frames = 10
frame_duration = 100
center_value = 64
def create_image():
image = np.zeros(shape=(height, width, 3), dtype=int)
for y i... | Add an animation generator script | Add an animation generator script
| Python | mit | zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend,zettsu-t/cPlusPlusFriend | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+# coding: utf-8
+
+'''
+Create a white noise animation like a TV screen
+'''
+
+import numpy as np
+from PIL import Image
+
+width = 128
+height = 96
+n_frames = 10
+frame_duration = 100
+center_value = 64
+
+def create_image():
+ image = np.zeros(shape=(height, width,... | |
4218d583bce19893c43b602130b75a371a1c699c | scripts/spat_sar_demo.py | scripts/spat_sar_demo.py | import numpy as np
import csv
import sys
import os
from math import exp
import mete
if len(sys.argv) > 1:
S0 = int(sys.argv[1])
N0 = int(sys.argv[2])
if os.path.exists('../demo') is False:
os.mkdir('../demo')
beta = mete.get_beta(S0, N0)
n0 = mete.trunc_logser_rvs(exp(-beta), N0, S0)
n0 = list(n0)
n0 =... | Add script to compute sad and sar for conceptual sar figure | Add script to compute sad and sar for conceptual sar figure
| Python | mit | weecology/mete-spatial,weecology/mete-spatial,weecology/mete-spatial,weecology/mete-spatial | ---
+++
@@ -0,0 +1,66 @@
+import numpy as np
+import csv
+import sys
+import os
+from math import exp
+
+import mete
+
+if len(sys.argv) > 1:
+ S0 = int(sys.argv[1])
+ N0 = int(sys.argv[2])
+
+if os.path.exists('../demo') is False:
+ os.mkdir('../demo')
+
+beta = mete.get_beta(S0, N0)
+
+n0 = mete.trunc_logs... | |
c7a8a3c329f8f1d90af96db7f7af1e36ab9f36e8 | scripts/test-scrobble.py | scripts/test-scrobble.py | #!/usr/bin/env python
##### CONFIG #####
SERVER = "turtle.libre.fm"
USER = "testuser"
PASSWORD = "password"
##################
import gobble, datetime
print "Handshaking..."
gs = gobble.GobbleServer(SERVER, USER, PASSWORD, 'tst')
time = datetime.datetime.now() - datetime.timedelta(days=1) # Yesterday
track = gobb... | Add test script for checking to see if scrobbling works on new installs | Add test script for checking to see if scrobbling works on new installs | Python | agpl-3.0 | foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm,foocorp/gnu-fm | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+##### CONFIG #####
+
+SERVER = "turtle.libre.fm"
+USER = "testuser"
+PASSWORD = "password"
+
+
+##################
+
+import gobble, datetime
+
+print "Handshaking..."
+gs = gobble.GobbleServer(SERVER, USER, PASSWORD, 'tst')
+time = datetime.datetime.now() - datetime... | |
253147a32014e945deda52c252dee2c6e0072264 | test/test_db_hash_handler.py | test/test_db_hash_handler.py | import hashlib
from handler_fixture import StationHandlerTestCase
from groundstation.transfer.request_handlers import handle_listdbhash
from groundstation.transfer.response_handlers import handle_terminate
import groundstation.transfer.response as response
from groundstation.proto.db_hash_pb2 import DBHash
class Tes... | Add tests for db hashing | Add tests for db hashing
| Python | mit | richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation,richo/groundstation | ---
+++
@@ -0,0 +1,57 @@
+import hashlib
+from handler_fixture import StationHandlerTestCase
+
+from groundstation.transfer.request_handlers import handle_listdbhash
+from groundstation.transfer.response_handlers import handle_terminate
+import groundstation.transfer.response as response
+
+from groundstation.proto.d... | |
92164760614821af73c2167fab5555475db5cd9c | examples/AllSolutions.py | examples/AllSolutions.py | from __future__ import division, print_function
from Numberjack import *
# This example demonstrates finding all solutions to a given model.
# solver.startNewSearch() should be called to set up internal data structures in
# the solver first, then call solver.getNextSolution() repeatedly until it
# returns a value oth... | Add example code for finding all solutions. | Add example code for finding all solutions.
| Python | lgpl-2.1 | eomahony/Numberjack,eomahony/Numberjack,eomahony/Numberjack,eomahony/Numberjack,eomahony/Numberjack | ---
+++
@@ -0,0 +1,30 @@
+from __future__ import division, print_function
+from Numberjack import *
+
+
+# This example demonstrates finding all solutions to a given model.
+# solver.startNewSearch() should be called to set up internal data structures in
+# the solver first, then call solver.getNextSolution() repeate... | |
dd63a0d619819aaffc7d6dbc05183530190a169e | src/core/signing.py | src/core/signing.py | import zlib
from django.core.signing import JSONSerializer, Signer, b64_decode, b64_encode
from django.utils.encoding import force_bytes
def fixed_dumps(obj, key=None, salt='core.signing', serializer=JSONSerializer, compress=False):
"""
The code is extracted from django.core.signing.loads
Returns URL-sa... | Add fixed authentication key (with auth number) logic | Add fixed authentication key (with auth number) logic
Based on django.core.signing.{loads,dumps}
| Python | mit | ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai,ccwang002/biocloud-server-kai | ---
+++
@@ -0,0 +1,57 @@
+import zlib
+
+from django.core.signing import JSONSerializer, Signer, b64_decode, b64_encode
+from django.utils.encoding import force_bytes
+
+
+def fixed_dumps(obj, key=None, salt='core.signing', serializer=JSONSerializer, compress=False):
+ """
+ The code is extracted from django.co... | |
ecb3fcfb19085fce2e15afc8d0c7ad4404401083 | simuvex/procedures/stubs/caller.py | simuvex/procedures/stubs/caller.py |
import simuvex
######################################
# Caller
######################################
class Caller(simuvex.SimProcedure):
"""
Caller stub. Creates a Ijk_Call exit to the specified function
"""
def run(self, target_addr=None):
self.call(target_addr, [ ], self.after_call)
... | Add a new SimProcedure stub Caller | Add a new SimProcedure stub Caller
| Python | bsd-2-clause | angr/angr,angr/simuvex,chubbymaggie/simuvex,axt/angr,tyb0807/angr,iamahuman/angr,schieb/angr,chubbymaggie/simuvex,schieb/angr,f-prettyland/angr,chubbymaggie/simuvex,tyb0807/angr,chubbymaggie/angr,angr/angr,axt/angr,iamahuman/angr,chubbymaggie/angr,iamahuman/angr,f-prettyland/angr,angr/angr,schieb/angr,f-prettyland/angr... | ---
+++
@@ -0,0 +1,18 @@
+
+import simuvex
+
+######################################
+# Caller
+######################################
+
+
+class Caller(simuvex.SimProcedure):
+ """
+ Caller stub. Creates a Ijk_Call exit to the specified function
+ """
+
+ def run(self, target_addr=None):
+ self.ca... | |
795423854ee31bbd2c120460ff2f9b537d3d6dd9 | dj_experiment/management/commands/listexperimentsbycatalog.py | dj_experiment/management/commands/listexperimentsbycatalog.py | from dj_experiment.models import Catalog
from django.core.management.base import BaseCommand, CommandError
from humanfriendly.tables import format_smart_table
class Command(BaseCommand):
"""Retrieve the list of experiments from a catalog."""
help = 'Retrieve the list of experiments from a catalog'
def a... | Add command to list experiments | Add command to list experiments
| Python | mit | francbartoli/dj-experiment,francbartoli/dj-experiment | ---
+++
@@ -0,0 +1,42 @@
+from dj_experiment.models import Catalog
+from django.core.management.base import BaseCommand, CommandError
+from humanfriendly.tables import format_smart_table
+
+
+class Command(BaseCommand):
+ """Retrieve the list of experiments from a catalog."""
+
+ help = 'Retrieve the list of ex... | |
fd2bf99bed6bae5d3af20faa8352bd85f8225e93 | st2api/tests/unit/controllers/v1/test_jsexpose_decorator.py | st2api/tests/unit/controllers/v1/test_jsexpose_decorator.py | # Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | Add some end to end tests for jsexpose decorator edge cases. | Add some end to end tests for jsexpose decorator edge cases.
| Python | apache-2.0 | Plexxi/st2,punalpatel/st2,lakshmi-kannan/st2,punalpatel/st2,peak6/st2,peak6/st2,emedvedev/st2,StackStorm/st2,Plexxi/st2,nzlosh/st2,emedvedev/st2,pixelrebel/st2,emedvedev/st2,tonybaloney/st2,lakshmi-kannan/st2,peak6/st2,nzlosh/st2,pixelrebel/st2,nzlosh/st2,punalpatel/st2,StackStorm/st2,tonybaloney/st2,lakshmi-kannan/st2... | ---
+++
@@ -0,0 +1,54 @@
+# Licensed to the StackStorm, Inc ('StackStorm') 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
+# (th... | |
6ef227b61d6455a03b8665f16e0934705ff611f2 | scripts/make_stdlib_list.py | scripts/make_stdlib_list.py | # Generate list of modules in the standard distribution
import sys
import os
if(sys.version_info[0]!=3):
raise ValueError("This script must be run with Python 3")
brython_stdlib_folder = os.path.join(os.path.dirname(os.getcwd()),
'www', 'src')
python_stdlib_folder = os.path.dirname(sys.executable)
print(... | Add script to generate a table of differences between Brython and CPython distributions | Add script to generate a table of differences between Brython and CPython distributions
| Python | bsd-3-clause | Isendir/brython,JohnDenker/brython,molebot/brython,kikocorreoso/brython,Mozhuowen/brython,Mozhuowen/brython,olemis/brython,molebot/brython,Lh4cKg/brython,rubyinhell/brython,Lh4cKg/brython,Hasimir/brython,olemis/brython,kevinmel2000/brython,amrdraz/brython,amrdraz/brython,Lh4cKg/brython,jonathanverner/brython,Isendir/br... | ---
+++
@@ -0,0 +1,50 @@
+# Generate list of modules in the standard distribution
+
+import sys
+import os
+
+if(sys.version_info[0]!=3):
+ raise ValueError("This script must be run with Python 3")
+
+brython_stdlib_folder = os.path.join(os.path.dirname(os.getcwd()),
+ 'www', 'src')
+python_stdlib_folder = ... | |
2c164f6154e565225d593d82579975380bf1ed1f | scripts/klayout/scrotLayout.py | scripts/klayout/scrotLayout.py | import pya
import re
WIDTH = 2048
HEIGHT = 2048
app = pya.Application.instance()
win = app.main_window()
# Load technology file
tech = pya.Technology()
tech.load(tech_file)
layoutOptions = tech.load_layout_options
# Load def file in the main window
cell_view = win.load_layout(input_layout, layoutOptions, 0)
layout_... | Add a klayout script to screenshot layouts | Add a klayout script to screenshot layouts
| Python | apache-2.0 | efabless/openlane,efabless/openlane,efabless/openlane,efabless/openlane | ---
+++
@@ -0,0 +1,21 @@
+import pya
+import re
+
+WIDTH = 2048
+HEIGHT = 2048
+
+app = pya.Application.instance()
+win = app.main_window()
+
+# Load technology file
+tech = pya.Technology()
+tech.load(tech_file)
+layoutOptions = tech.load_layout_options
+
+# Load def file in the main window
+cell_view = win.load_lay... | |
c636b18cf0164c4ffcd522b89d09e82f7da3ccc6 | tests/unit/utils/test_jinja.py | tests/unit/utils/test_jinja.py | # -*- coding: utf-8 -*-
'''
Tests for salt.utils.jinja
'''
# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function
# Import Salt libs
import salt.utils.jinja
from tests.support.unit import TestCase
class JinjaTestCase(TestCase):
def test_tojson(self):
'''
Tes... | Add unit test for tojson filter | Add unit test for tojson filter
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+'''
+Tests for salt.utils.jinja
+'''
+# Import Python libs
+from __future__ import absolute_import, unicode_literals, print_function
+
+# Import Salt libs
+import salt.utils.jinja
+from tests.support.unit import TestCase
+
+
+class JinjaTestCase(TestCase):
+ def t... | |
a24ba36d5341817bc0b95a1dcfc19ecfe8eb77ae | examples/readme3.py | examples/readme3.py | # this is a Python3 version of the code in readme.py
from twisted.internet.task import react
from twisted.internet.defer import inlineCallbacks, ensureDeferred
from twisted.internet.endpoints import UNIXClientEndpoint
import treq
import txtorcon
async def main(reactor):
tor = await txtorcon.connect(
rea... | Add Py3 version of readme code | Add Py3 version of readme code
| Python | mit | meejah/txtorcon,meejah/txtorcon | ---
+++
@@ -0,0 +1,47 @@
+# this is a Python3 version of the code in readme.py
+
+from twisted.internet.task import react
+from twisted.internet.defer import inlineCallbacks, ensureDeferred
+from twisted.internet.endpoints import UNIXClientEndpoint
+
+import treq
+import txtorcon
+
+
+async def main(reactor):
+ to... | |
8f443e922a913c91f21b663065d6bdc7abc73672 | api/migrations/0083_event_english_image.py | api/migrations/0083_event_english_image.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0082_card_round_card_idolized_image'),
]
operations = [
migrations.AddField(
model_name='event',
... | Use EN banners for events when available | Use EN banners for events when available
| Python | apache-2.0 | dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI,rdsathene/SchoolIdolAPI,dburr/SchoolIdolAPI,dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0082_card_round_card_idolized_image'),
+ ]
+
+ operations = [
+ migrations.AddField(... | |
90d02b4bfa2154ba71a8a05b6c2661cf792d062d | lang/py3/avro/tests/test_enum.py | lang/py3/avro/tests/test_enum.py | #!/usr/bin/env python3
# -*- mode: python -*-
# -*- 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. Thete ASF licenses this file
# to y... | Add missing file from AVRO-1673. | Add missing file from AVRO-1673.
git-svn-id: c07a28b12301a3ecdaa1125838bb8d44496e7ec7@1691208 13f79535-47bb-0310-9956-ffa450edef68
| Python | apache-2.0 | djudd/avro,eonezhang/avro,massie/avro,st0nx/avro,ecatmur/avro,eonezhang/avro,dasch/avro,st0nx/avro,massie/avro,Romain-Geissler-1A/avro,restorando/avro,DrAA/avro,relateiq/avro,Romain-Geissler-1A/avro,eonezhang/avro,massie/avro,jmattbeal/avro,relateiq/avro,ecatmur/avro,Romain-Geissler-1A/avro,Yelp/avro,DrAA/avro,wojtkiew... | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+# -*- mode: python -*-
+# -*- 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. ... | |
5deefa9392061c70ed9023fe1cad3f16e22a21a0 | src/Scripts/tail-latency.py | src/Scripts/tail-latency.py | # Note that this is not a valid measurement of tail latency. This uses the execution times we measure because they're convenient, but this does not include queueing time inside BitFunnel nor does it include head-of-line blocking queue waiting time on the queue into BitFunnel.
import csv
filename = "/tmp/QueryPipeline... | Add quick and dirty script to measure tail latency. | Add quick and dirty script to measure tail latency.
| Python | mit | BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel | ---
+++
@@ -0,0 +1,34 @@
+# Note that this is not a valid measurement of tail latency. This uses the execution times we measure because they're convenient, but this does not include queueing time inside BitFunnel nor does it include head-of-line blocking queue waiting time on the queue into BitFunnel.
+
+import csv
+... | |
16dc79b63d6e4b9b29dd238dd57544d13bc4d9b5 | shuup/core/management/commands/shuup_fix_order_status_identifiers.py | shuup/core/management/commands/shuup_fix_order_status_identifiers.py | # This file is part of Shuup.
#
# Copyright (c) 2017, Anders Innovations. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django.core.management.base import BaseCommand
from django.db.transaction import atomic
... | Add script for fixing OrderStatus identifiers | Add script for fixing OrderStatus identifiers
Add a tool to fix the identifiers of the OrderStatus objects, because
the default statuses might have been created with invalid identifiers
before the default status data was fixed in the previous commit.
| Python | agpl-3.0 | shoopio/shoop,shoopio/shoop,shoopio/shoop | ---
+++
@@ -0,0 +1,45 @@
+# This file is part of Shuup.
+#
+# Copyright (c) 2017, Anders Innovations. All rights reserved.
+#
+# This source code is licensed under the OSL-3.0 license found in the
+# LICENSE file in the root directory of this source tree.
+
+from django.core.management.base import BaseCommand
+from d... | |
9f8b0fe642e7900ac1c966ad365a5fe99456d23e | setup.py | setup.py | from distutils.core import setup
from jsonref import __version__
with open("README.rst") as readme:
long_description = readme.read()
classifiers = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Indepen... | from distutils.core import setup
from jsonref import __version__
with open("README.rst") as readme:
long_description = readme.read()
classifiers = [
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Indepen... | Include Python 3.4 and 3.5 | Include Python 3.4 and 3.5 | Python | mit | gazpachoking/jsonref | ---
+++
@@ -20,6 +20,8 @@
"Programming Language :: Python :: 3.1",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
+ "Programming Language :: Python :: 3.4",
+ "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: Implementation :: CPyt... |
d23409e27f70bf6811bd25663accf9524dce1436 | cloudcaster/json2yaml.py | cloudcaster/json2yaml.py | #!/usr/bin/python
import json
import argparse
import yaml
from yaml import Loader, Dumper
from pprint import pprint
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbose", help="verbosity", action="store_true")
parser.add_argument("file", help="cloudcaster JSON file")
args = parser.parse_args()
if ... | Add json to yaml conversion script | Add json to yaml conversion script
| Python | bsd-2-clause | TouqeerHussain/ops,WrathOfChris/ops,WrathOfChris/ops,TouqeerHussain/ops | ---
+++
@@ -0,0 +1,23 @@
+#!/usr/bin/python
+
+import json
+import argparse
+import yaml
+from yaml import Loader, Dumper
+from pprint import pprint
+
+parser = argparse.ArgumentParser()
+parser.add_argument("-v", "--verbose", help="verbosity", action="store_true")
+parser.add_argument("file", help="cloudcaster JSON ... | |
904e53e15902f393af586bfac0276635a68714bd | alembic/versions/40f5c56adfee_add_users_provider_column.py | alembic/versions/40f5c56adfee_add_users_provider_column.py | """added provider column to users table
Revision ID: 40f5c56adfee
Revises: 407f7f23156f
Create Date: 2016-02-02 22:19:49.329707
"""
# revision identifiers, used by Alembic.
revision = '40f5c56adfee'
down_revision = '407f7f23156f'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
... | Add file missing from 948063a | Add file missing from 948063a
| Python | bsd-3-clause | yosinv/anyway,boazin/anyway,OmerSchechter/anyway,omerxx/anyway,hasadna/anyway,hasadna/anyway,omerxx/anyway,hasadna/anyway,omerxx/anyway,boazin/anyway,hasadna/anyway,OmerSchechter/anyway,yosinv/anyway,yosinv/anyway,OmerSchechter/anyway,boazin/anyway | ---
+++
@@ -0,0 +1,24 @@
+"""added provider column to users table
+
+Revision ID: 40f5c56adfee
+Revises: 407f7f23156f
+Create Date: 2016-02-02 22:19:49.329707
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '40f5c56adfee'
+down_revision = '407f7f23156f'
+branch_labels = None
+depends_on = None
+
+from ... | |
f7c02fa02f8b4843e62c18ded7600fb77dc3c002 | sar_util.py | sar_util.py | ###########################################
#
# A basic search and replace on a text file
#
###########################################
import sys
from operator import xor
# add strings to replace here
replace_map = {'#"cwd" : "{TR_TESTSUITE_DIR}",': '"cwd" : "../../thrust/internal/test",'}
# searches an... | Add search and replace python script | Add search and replace python script
[git-p4: depot-paths = "//sw/gpgpu/thrust/": change = 23090677]
| Python | apache-2.0 | thrust/thrust,andrewcorrigan/thrust-multi-permutation-iterator,jaredhoberock/thrust,thrust/thrust,andrewcorrigan/thrust-multi-permutation-iterator,jaredhoberock/thrust,jaredhoberock/thrust,andrewcorrigan/thrust-multi-permutation-iterator,thrust/thrust,jaredhoberock/thrust,jaredhoberock/thrust,thrust/thrust,thrust/thrus... | ---
+++
@@ -0,0 +1,58 @@
+###########################################
+#
+# A basic search and replace on a text file
+#
+###########################################
+
+import sys
+from operator import xor
+
+# add strings to replace here
+replace_map = {'#"cwd" : "{TR_TESTSUITE_DIR}",': '"cwd" : "../../t... | |
e4ca5f66b8f1770fd496e11c2e03053e3e85592e | tests/flask_test.py | tests/flask_test.py | # This file is part of Redmill.
#
# Redmill 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 version.
#
# Redmill is distributed in the ho... | Add base class for Flask tests | Add base class for Flask tests
| Python | agpl-3.0 | lamyj/redmill,lamyj/redmill,lamyj/redmill | ---
+++
@@ -0,0 +1,36 @@
+# This file is part of Redmill.
+#
+# Redmill 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 version.
+#
... | |
e56278f00f38b199cfaba91d5dc904a2be44b944 | fortrantools.py | fortrantools.py | #!/usr/bin/env python
# encoding: utf-8
from __future__ import division, print_function
def str_complex(c, kindstr=''):
"""Converts the complex number `c` to a string in Fortran-format, i.e.
(Re c, Im c). If c is iterable, it returns a string of the form
[(Re c_1, Im c_1), ...].
:c: Number/Iterable ... | Add converter from complex to Fortran-formated string | Add converter from complex to Fortran-formated string
| Python | unlicense | dseuss/pythonlibs | ---
+++
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from __future__ import division, print_function
+
+
+def str_complex(c, kindstr=''):
+ """Converts the complex number `c` to a string in Fortran-format, i.e.
+ (Re c, Im c). If c is iterable, it returns a string of the form
+ [(Re c_1, Im ... | |
772e590605971ee9c165e4ffdfec844edaf017f8 | content/test/gpu/gpu_tests/gpu_rasterization_expectations.py | content/test/gpu/gpu_tests/gpu_rasterization_expectations.py | # Copyright 2015 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.
from gpu_test_expectations import GpuTestExpectations
# See the GpuTestExpectations class for documentation.
class GpuRasterizationExpectations(GpuTestExpe... | # Copyright 2015 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.
from gpu_test_expectations import GpuTestExpectations
# See the GpuTestExpectations class for documentation.
class GpuRasterizationExpectations(GpuTestExpe... | Remove suppression of GpuRasterization.BlueBox on Mac | Remove suppression of GpuRasterization.BlueBox on Mac
The regressing CLs have been reverted.
BUG=466690
Review URL: https://codereview.chromium.org/1014503005
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#320789}
| Python | bsd-3-clause | Just-D/chromium-1,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,fujunwei/chromium-crosswalk,Just-D/chromium-1,chuan9/chromium-crosswalk,ltilve/chromium,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,chuan9/chromium-crosswalk,ltilve/chromium,Just-D/chromium-1,Peter... | ---
+++
@@ -11,7 +11,4 @@
# Sample Usage:
# self.Fail('GpuRasterization.BlueBox',
# ['mac', 'amd', ('nvidia', 0x1234)], bug=123)
-
- # Flaky on Mac Retina tryservers.
- self.Fail('GpuRasterization.BlueBox',
- ['mac', ('nvidia', 0x0fe9)], bug=466690)
+ pass |
e7fb646c5be44762e9f61c2927afbd565e72fc77 | python/one-offs/import-toutv.py | python/one-offs/import-toutv.py | #!/usr/bin/env python
import os
import os.path
import re
import sys
# Ugly hack so we can import pytoutv_plus
lib_path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'video-tools'))
sys.path.append(lib_path)
import pytoutv_plus
def main():
filenames = []
for (dirpath, dirn... | Add script to import already downloaded videos into data file | Add script to import already downloaded videos into data file
| Python | mit | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | ---
+++
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+import os
+import os.path
+import re
+import sys
+
+# Ugly hack so we can import pytoutv_plus
+lib_path = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'video-tools'))
+sys.path.append(lib_path)
+
+import pytoutv_plus
+
+def main():
... | |
22aaeccd973393be33f330a90757396554efc6eb | tasks/cusip/python/cuisp.py | tasks/cusip/python/cuisp.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
def cusip_check(cusip: str) -> bool:
if len(cusip) != 9:
raise ValueError('CUSIP must be 9 characters')
cusip = cusip.upper()
total = 0
for i in range(8):
c = cusip[i]
if c.isdigit():
v = int(c)
eli... | Implement CUSIP task in Python | Implement CUSIP task in Python
| Python | unlicense | mattmahn/rosetta-code,mattmahn/rosetta-code | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import math
+
+def cusip_check(cusip: str) -> bool:
+ if len(cusip) != 9:
+ raise ValueError('CUSIP must be 9 characters')
+
+ cusip = cusip.upper()
+ total = 0
+ for i in range(8):
+ c = cusip[i]
+ if c.isdi... | |
e5310f1147694992d1eb48a037261f805955294c | tests/unit/forms/widget_tests.py | tests/unit/forms/widget_tests.py | import nose
from oscar.forms import widgets
def test_datetime_to_date_format_conversion():
format_testcases = (
('%Y-%m-%d', 'yy-mm-dd'),
('%Y-%m-%d %H:%M', 'yy-mm-dd'),
)
def compare(format, expected):
nose.tools.eq_(
widgets.datetime_format_to_js_date_format(format)... | import nose
from oscar.forms import widgets
def compare_date_format(format, expected):
nose.tools.eq_(
widgets.datetime_format_to_js_date_format(format), expected)
def test_datetime_to_date_format_conversion():
format_testcases = (
('%Y-%m-%d', 'yy-mm-dd'),
('%Y-%m-%d %H:%M', 'yy-mm... | Adjust test generator to make tests pass | Adjust test generator to make tests pass
| Python | bsd-3-clause | amirrpp/django-oscar,Jannes123/django-oscar,jmt4/django-oscar,marcoantoniooliveira/labweb,taedori81/django-oscar,kapt/django-oscar,josesanch/django-oscar,ademuk/django-oscar,pasqualguerrero/django-oscar,dongguangming/django-oscar,amirrpp/django-oscar,pdonadeo/django-oscar,nickpack/django-oscar,bnprk/django-oscar,jlmadu... | ---
+++
@@ -1,6 +1,11 @@
import nose
from oscar.forms import widgets
+
+
+def compare_date_format(format, expected):
+ nose.tools.eq_(
+ widgets.datetime_format_to_js_date_format(format), expected)
def test_datetime_to_date_format_conversion():
@@ -8,13 +13,13 @@
('%Y-%m-%d', 'yy-mm-dd'),
... |
cd230c68f1a6db2b63efa82bc5a723492804c7ed | xorgauth/accounts/migrations/0005_better_user-facing_name.py | xorgauth/accounts/migrations/0005_better_user-facing_name.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-19 20:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0004_add_groupmembership_unique_constraint'),
]
operations = [
... | Add a migration for the recent change in User table | Add a migration for the recent change in User table
Commit 850be15e7636 ("Give a better user-facing name to hrid field")
modified User.hrid name without adding a migration for it.
| Python | agpl-3.0 | Polytechnique-org/xorgauth,Polytechnique-org/xorgauth | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.7 on 2017-11-19 20:04
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('accounts', '0004_add_groupmembership_unique_constraint... | |
9b8f425cdb571dab251c743519a436e23d8ce331 | test-raw.py | test-raw.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Test raw data with MSSImage class.
import sys
from mss import MSSImage
if len(sys.argv) < 4:
print('python {0} data.raw width height'.format(sys.argv[0]))
else:
with open(sys.argv[1], 'rb') as f:
data = f.read()
width = sys.argv[2]
height = sys.argv[3]
try:
... | Add a little file to test raw data (pixels) into MSSImage class | Add a little file to test raw data (pixels) into MSSImage class
| Python | mit | BoboTiG/python-mss | ---
+++
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Test raw data with MSSImage class.
+
+import sys
+from mss import MSSImage
+
+
+if len(sys.argv) < 4:
+ print('python {0} data.raw width height'.format(sys.argv[0]))
+else:
+ with open(sys.argv[1], 'rb') as f:
+ data = f.read()
+ width = ... | |
34b92b40454a08dcf8fcadd2cdaaac11546e1d80 | test/integration/test_9k.py | test/integration/test_9k.py | import tarfile
from . import *
class Test9k(IntegrationTest):
def __init__(self, *args, **kwargs):
IntegrationTest.__init__(
self, os.path.join(examples_dir, '01_executable'), configure=False,
*args, **kwargs
)
def test_build(self):
os.chdir(self.srcdir)
... | Add an integration test for the `9k` shorthand | Add an integration test for the `9k` shorthand
| Python | bsd-3-clause | jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000,jimporter/bfg9000 | ---
+++
@@ -0,0 +1,22 @@
+import tarfile
+
+from . import *
+
+
+class Test9k(IntegrationTest):
+ def __init__(self, *args, **kwargs):
+ IntegrationTest.__init__(
+ self, os.path.join(examples_dir, '01_executable'), configure=False,
+ *args, **kwargs
+ )
+
+ def test_build(se... | |
abcc3376d7b27a4e425ca297025d7556e2fb2339 | djconnectwise/migrations/0028_remove_company_company_alias.py | djconnectwise/migrations/0028_remove_company_company_alias.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djconnectwise', '0027_auto_20170605_1534'),
]
operations = [
migrations.RemoveField(
model_name='company',
... | Add migration for previous commit | Add migration for previous commit
| Python | mit | KerkhoffTechnologies/django-connectwise,KerkhoffTechnologies/django-connectwise,AparatTechnologies/django-connectwise | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('djconnectwise', '0027_auto_20170605_1534'),
+ ]
+
+ operations = [
+ migrations.RemoveField... | |
853e2e5b6c410daadc5cdf15d97bfc86ba77defa | paystackapi/tests/test_charge.py | paystackapi/tests/test_charge.py | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.charge import Charge
class TestCharge(BaseTestCase):
@httpretty.activate
def test_start_charge(self):
"""Method defined to test start charge."""
httpretty.register_uri(
httpretty.POST,
... | Test submit_pin method defined for a charge | Test submit_pin method defined for a charge
| Python | mit | andela-sjames/paystack-python | ---
+++
@@ -0,0 +1,59 @@
+import httpretty
+
+from paystackapi.tests.base_test_case import BaseTestCase
+from paystackapi.charge import Charge
+
+
+class TestCharge(BaseTestCase):
+
+ @httpretty.activate
+ def test_start_charge(self):
+ """Method defined to test start charge."""
+
+ httpretty.regi... | |
236c5af71093549108fa942847820a721da4880a | h2o-docs/src/booklets/v2_2015/source/glm/glm_download_pojo.py | h2o-docs/src/booklets/v2_2015/source/glm/glm_download_pojo.py | import h2o
h2o.init()
path = h2o.system_file("prostate.csv")
h2o_df = h2o.import_file(path)
h2o_df['CAPSULE'] = h2o_df['CAPSULE'].asfactor()
binomial_fit = h2o.glm(y = "CAPSULE", x = ["AGE", "RACE", "PSA", "GLEASON"], training_frame = h2o_df, family = "binomial")
h2o.download_pojo(binomial_fit)
| Add python example for downloading glm pojo. | Add python example for downloading glm pojo.
| Python | apache-2.0 | michalkurka/h2o-3,junwucs/h2o-3,madmax983/h2o-3,bospetersen/h2o-3,bospetersen/h2o-3,brightchen/h2o-3,michalkurka/h2o-3,kyoren/https-github.com-h2oai-h2o-3,madmax983/h2o-3,bospetersen/h2o-3,junwucs/h2o-3,junwucs/h2o-3,spennihana/h2o-3,h2oai/h2o-dev,michalkurka/h2o-3,madmax983/h2o-3,YzPaul3/h2o-3,datachand/h2o-3,pchmieli... | ---
+++
@@ -0,0 +1,7 @@
+import h2o
+h2o.init()
+path = h2o.system_file("prostate.csv")
+h2o_df = h2o.import_file(path)
+h2o_df['CAPSULE'] = h2o_df['CAPSULE'].asfactor()
+binomial_fit = h2o.glm(y = "CAPSULE", x = ["AGE", "RACE", "PSA", "GLEASON"], training_frame = h2o_df, family = "binomial")
+h2o.download_pojo(binom... | |
4255d4ae361623ecbed4685f2f1ee94f090acd36 | test/integration/ggrc/services/test_response_codes.py | test/integration/ggrc/services/test_response_codes.py | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Tests API response codes."""
import json
from mock import patch
from integration.ggrc import services
class TestCollectionPost(services.TestCase):
"""Test response codes for post requests."""
def... | Add tests for http response codes | Add tests for http response codes
| Python | apache-2.0 | josthkko/ggrc-core,j0gurt/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,plamut/ggrc-core,kr41/ggrc-core,j0gurt/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-c... | ---
+++
@@ -0,0 +1,80 @@
+# Copyright (C) 2016 Google Inc.
+# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
+
+"""Tests API response codes."""
+
+import json
+from mock import patch
+
+from integration.ggrc import services
+
+
+class TestCollectionPost(services.TestCase):
+ """Test res... | |
3976ee82ad4cc0fc7bc65080fa49e1cea694022c | osf/migrations/0095_reset_osf_abstractprovider_licenses_acceptable_id_seq.py | osf/migrations/0095_reset_osf_abstractprovider_licenses_acceptable_id_seq.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-04-12 20:31
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0094_update_preprintprovider_group_auth'),
]
operations = [
migrations.RunSQ... | Add migration to reset osf_abstractprovider_id_seq... | Add migration to reset osf_abstractprovider_id_seq...
...and osf_abstractprovider_licenses_acceptable_seq.
These sequences got out of sync in the 0081 migration.
| Python | apache-2.0 | HalcyonChimera/osf.io,Johnetordoff/osf.io,mattclark/osf.io,brianjgeiger/osf.io,felliott/osf.io,sloria/osf.io,HalcyonChimera/osf.io,Johnetordoff/osf.io,sloria/osf.io,aaxelb/osf.io,caseyrollins/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,erinspace/osf.io,adlius/osf.io,caseyrollins/osf.io,brianjgeiger/osf.io,cslzch... | ---
+++
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.9 on 2018-04-12 20:31
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('osf', '0094_update_preprintprovider_group_auth'),
+ ]
+
+ ... | |
8adf445513f7bba361f5ff0d8b7c111ec3caafef | eudat/find/getpidinfo.py | eudat/find/getpidinfo.py | #!/usr/bin/env python
"""
Retrieve pid information accessing the handle resolution system using HTTP
"""
__author__ = 'Roberto Mucci (r.mucci@cineca.it)'
import json
#import urllib
import urllib2
def get_pid_info(pid, handle_url='hdl.handle.net'):
"""
Resolve pid information accessing the handle resolutio... | Resolve PID and get internal information | Resolve PID and get internal information
| Python | apache-2.0 | EUDAT-B2STAGE/EUDAT-Library,EUDAT-B2STAGE/B2STAGE-Library | ---
+++
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+
+"""
+Retrieve pid information accessing the handle resolution system using HTTP
+"""
+
+__author__ = 'Roberto Mucci (r.mucci@cineca.it)'
+
+
+import json
+#import urllib
+import urllib2
+
+
+def get_pid_info(pid, handle_url='hdl.handle.net'):
+ """
+ Resolve pi... | |
dc7366efa0dde1fbf9cb3999d5cf69fe1033f802 | corehq/apps/api/decorators.py | corehq/apps/api/decorators.py | import base64
from corehq.apps.api.models import ApiUser
from django.http import HttpResponse
def api_user_basic_auth(permission, realm=''):
def real_decorator(view):
def wrapper(request, *args, **kwargs):
if 'HTTP_AUTHORIZATION' in request.META:
auth = request.META['HTTP_AUTHO... | Add decorator for basic auth with ApiUsers | Add decorator for basic auth with ApiUsers
| Python | bsd-3-clause | dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | ---
+++
@@ -0,0 +1,21 @@
+import base64
+from corehq.apps.api.models import ApiUser
+from django.http import HttpResponse
+
+
+def api_user_basic_auth(permission, realm=''):
+ def real_decorator(view):
+ def wrapper(request, *args, **kwargs):
+ if 'HTTP_AUTHORIZATION' in request.META:
+ ... | |
2607fddbb063c12aaab0e15fb96fbda2a492f240 | powerline/matchers/vim/plugin/nerdtree.py | powerline/matchers/vim/plugin/nerdtree.py | # vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import re
from powerline.bindings.vim import buffer_name
NERD_TREE_RE = re.compile(b'NERD_TREE_\\d+')
def nerdtree(matcher_info):
name = buffer_name(matcher_info)
return name and NERD_TRE... | # vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import os
import re
from powerline.bindings.vim import buffer_name
NERD_TREE_RE = re.compile(b'NERD_tree_\\d+')
def nerdtree(matcher_info):
name = buffer_name(matcher_info)
return name and NERD_TRE... | Fix case in nerd tree matcher regex | Fix case in nerd tree matcher regex
Fixes #1105
| Python | mit | QuLogic/powerline,bartvm/powerline,prvnkumar/powerline,kenrachynski/powerline,QuLogic/powerline,bezhermoso/powerline,russellb/powerline,prvnkumar/powerline,areteix/powerline,dragon788/powerline,dragon788/powerline,IvanAli/powerline,junix/powerline,DoctorJellyface/powerline,Liangjianghao/powerline,QuLogic/powerline,wfsc... | ---
+++
@@ -7,7 +7,7 @@
from powerline.bindings.vim import buffer_name
-NERD_TREE_RE = re.compile(b'NERD_TREE_\\d+')
+NERD_TREE_RE = re.compile(b'NERD_tree_\\d+')
def nerdtree(matcher_info): |
863102b71e87e508ff57523c42beba430405e358 | teamworkApp/lib/studentGraph.py | teamworkApp/lib/studentGraph.py | from enum import IntEnum
import matplotlib.pyplot as plt
import numpy as np
import sqlite3
DB = 'db/development.sqlite3'
Style = IntEnum('Style', 'Contributor, Collaborator, Communicator, Challenger', start=0)
Answer_Value = IntEnum(
'Answer_Value',
'1234 1243 1324 1342 1423 1432 2134 2143 2314 2341 2413 243... | Create individual student pie graph | Create individual student pie graph
| Python | mit | nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis,nathanljustin/teamwork-analysis | ---
+++
@@ -0,0 +1,68 @@
+from enum import IntEnum
+import matplotlib.pyplot as plt
+import numpy as np
+import sqlite3
+
+DB = 'db/development.sqlite3'
+
+Style = IntEnum('Style', 'Contributor, Collaborator, Communicator, Challenger', start=0)
+Answer_Value = IntEnum(
+ 'Answer_Value',
+ '1234 1243 1324 1342 ... | |
4b62369087de530a2ba879be40ae5f133e2496a0 | samples/ReturnUnicode.py | samples/ReturnUnicode.py | #------------------------------------------------------------------------------
# ReturnUnicode.py
# Returns all strings as unicode. This also demonstrates the use of an output
# type handler to change the way in which data is returned from a cursor.
#------------------------------------------------------------------... | Add sample code for returning all strings as unicode strings. | Add sample code for returning all strings as unicode strings.
git-svn-id: b746c3c07d6b14fe725b72f068c7252a81557b48@133 0cf6dada-cf32-0410-b4fe-d86b42e8394d
| Python | bsd-3-clause | Bluehorn/cx_Oracle,Bluehorn/cx_Oracle,Bluehorn/cx_Oracle | ---
+++
@@ -0,0 +1,19 @@
+#------------------------------------------------------------------------------
+# ReturnUnicode.py
+# Returns all strings as unicode. This also demonstrates the use of an output
+# type handler to change the way in which data is returned from a cursor.
+#----------------------------------... | |
3240053f7df81b6f2488ea6c6023b900ee3f8636 | proselint/checks/garner/denizen_labels.py | proselint/checks/garner/denizen_labels.py | # -*- coding: utf-8 -*-
"""MAU109: Denizen labels.
---
layout: post
error_code: MAU109
source: Garner's Modern American Usage
source_url: http://amzn.to/15wF76r
title: denizen labels
date: 2014-06-10 12:31:19
categories: writing
---
Denizen labels.
"""
import re
from proselint.tools import memoize... | Add check for denizen labels | Add check for denizen labels
| Python | bsd-3-clause | jstewmon/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint | ---
+++
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+"""MAU109: Denizen labels.
+
+---
+layout: post
+error_code: MAU109
+source: Garner's Modern American Usage
+source_url: http://amzn.to/15wF76r
+title: denizen labels
+date: 2014-06-10 12:31:19
+categories: writing
+---
+
+Denizen labels.
+
+"""
+i... | |
e5e63984354038c61681e9e14b18c3f5a88f9a83 | migrations/versions/1130_add_copied_to_following_framework_column.py | migrations/versions/1130_add_copied_to_following_framework_column.py | """add_copied_to_following_framework_column
Revision ID: 1130
Revises: 1120
Create Date: 2018-04-06 11:52:17.825501
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1130'
down_revision = '1120'
def upgrade():
op.add_column('archived_services', sa.Column(... | Add 'copied_to_following_framework' column to services | Add 'copied_to_following_framework' column to services
We need to keep track of whether a service has been copied to a
following framework during applications. Adding this column will allow
this.
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | ---
+++
@@ -0,0 +1,27 @@
+"""add_copied_to_following_framework_column
+
+Revision ID: 1130
+Revises: 1120
+Create Date: 2018-04-06 11:52:17.825501
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+
+# revision identifiers, used by Alembic.
+revision = '1130'
+down_revision = '1120'
+
+
+def upgrade():
+ ... | |
b8bec1944b999bda1b5452f3435b0c347ed0b24f | scripts/cligen/init_clifiles.py | scripts/cligen/init_clifiles.py | """When DEP expands, we have a problem that we have no close by precip files.
So lets ensure we have one file per 0.25 degree lat and lon, we can then use
these to fast-start newly expanded areas...
"""
from pyiem.dep import SOUTH, EAST, NORTH, WEST
import numpy as np
import os
import shutil
# We shall use this file,... | Add init of 0.25x0.25 climatefiles | Add init of 0.25x0.25 climatefiles
So that we can more quickly hot-start newly added DEP regions... | Python | mit | akrherz/dep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/idep,akrherz/idep | ---
+++
@@ -0,0 +1,28 @@
+"""When DEP expands, we have a problem that we have no close by precip files.
+
+So lets ensure we have one file per 0.25 degree lat and lon, we can then use
+these to fast-start newly expanded areas...
+"""
+from pyiem.dep import SOUTH, EAST, NORTH, WEST
+import numpy as np
+import os
+impo... | |
da9ee7ac5adeb4ebf364c886c99c9f0531bc156f | techgig_join.py | techgig_join.py | def main():
s=raw_input()
a=raw_input()
b=raw_input()
c=raw_input()
x = (a,b,c)
print s.join(x)
main()
| Concatenate each line of the string | Concatenate each line of the string
| Python | mit | kumarisneha/practice_repo | ---
+++
@@ -0,0 +1,10 @@
+def main():
+ s=raw_input()
+ a=raw_input()
+ b=raw_input()
+ c=raw_input()
+ x = (a,b,c)
+ print s.join(x)
+
+main()
+ | |
ba6d92b034ee9e71d2c17d16168c1a4cc0ca2821 | src/main/python/logs/makeUserEventList.py | src/main/python/logs/makeUserEventList.py | #!/usr/bin/env python
"""
Extract the usernames from a JSON file, and write a file of those usernames + event type and event times
Given a file with a field marked 'username', extract the values of those fields
and write, one per line, to a file with the supplied name.
"""
import json
import sys
if __name__ == '__ma... | Add script to make list of users + event types + event times | Add script to make list of users + event types + event times
| Python | bsd-3-clause | jimwaldo/HarvardX-Tools,jimwaldo/HarvardX-Tools | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+"""
+Extract the usernames from a JSON file, and write a file of those usernames + event type and event times
+
+Given a file with a field marked 'username', extract the values of those fields
+and write, one per line, to a file with the supplied name.
+"""
+import jso... | |
f9d113aa528b60d1a41b5caf0f1f0f7da4a8c8b3 | inbox/util/rdb.py | inbox/util/rdb.py | import socket
from gevent import monkey; monkey.patch_all()
import sys
import random
from code import InteractiveConsole
class RemoteConsole(InteractiveConsole):
def __init__(self, handle, locals=None):
self.handle = handle
sys.stderr = self.handle
InteractiveConsole.__init__(self, locals=... | Break into a python interpreter from anywhere | Break into a python interpreter from anywhere
Summary:
I use pdb a lot when debugging and I find it really annoying that we only get stack traces from errors on gunks. Wouldn't it be cool to be able to at least have access to an interpreter at the bottom of a stack trace? Well, rdb does this. To use it, insert a call ... | Python | agpl-3.0 | wakermahmud/sync-engine,closeio/nylas,jobscore/sync-engine,PriviPK/privipk-sync-engine,wakermahmud/sync-engine,PriviPK/privipk-sync-engine,EthanBlackburn/sync-engine,ErinCall/sync-engine,ErinCall/sync-engine,Eagles2F/sync-engine,gale320/sync-engine,PriviPK/privipk-sync-engine,nylas/sync-engine,PriviPK/privipk-sync-engi... | ---
+++
@@ -0,0 +1,52 @@
+import socket
+from gevent import monkey; monkey.patch_all()
+import sys
+import random
+from code import InteractiveConsole
+
+
+class RemoteConsole(InteractiveConsole):
+ def __init__(self, handle, locals=None):
+ self.handle = handle
+ sys.stderr = self.handle
+ In... | |
3a79cbf70e75689bd88418d831e5c8953c3d997f | bin/test_setup.py | bin/test_setup.py | """
Test that the installed modules in setup.py are up-to-date.
If this test fails, run
python bin/generate_test_list.py
and
python bin/generate_module_list.py
to generate the up-to-date test and modules list to put in setup.py.
"""
import generate_test_list
import generate_module_list
from get_sympy import path... | Add a script to test that tests and modules in setup.py are up-to-date | Add a script to test that tests and modules in setup.py are up-to-date
| Python | bsd-3-clause | aktech/sympy,souravsingh/sympy,madan96/sympy,sampadsaha5/sympy,kaushik94/sympy,drufat/sympy,chaffra/sympy,drufat/sympy,postvakje/sympy,yashsharan/sympy,drufat/sympy,jaimahajan1997/sympy,sampadsaha5/sympy,madan96/sympy,yashsharan/sympy,jaimahajan1997/sympy,jaimahajan1997/sympy,madan96/sympy,kaushik94/sympy,souravsingh/s... | ---
+++
@@ -0,0 +1,28 @@
+"""
+Test that the installed modules in setup.py are up-to-date.
+
+If this test fails, run
+
+python bin/generate_test_list.py
+
+and
+
+python bin/generate_module_list.py
+
+to generate the up-to-date test and modules list to put in setup.py.
+
+"""
+import generate_test_list
+import gener... | |
a77b72358132ac6f8d58fcb72dee7a762cebec87 | python/fire_rs/monitoring/ui.py | python/fire_rs/monitoring/ui.py | # Copyright (c) 2018, CNRS-LAAS
# 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 the f... | Add Zenity-based user interface for SuperSAOP | Add Zenity-based user interface for SuperSAOP
| Python | bsd-2-clause | fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop,fire-rs-laas/fire-rs-saop | ---
+++
@@ -0,0 +1,67 @@
+# Copyright (c) 2018, CNRS-LAAS
+# 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... | |
a15aecdc72b135fe55778a28416b1efaca6be727 | quran_text/tests/test_models.py | quran_text/tests/test_models.py | from django.test import TestCase
from model_mommy import mommy
from ..models import Ayah
class SuraModelTest(TestCase):
def setUp(self):
self.sura = mommy.make('quran_text.sura', name='Al-Fateha', index=1)
self.ayah = mommy.make('quran_text.ayah', number=1, sura=self.sura,
... | Add tests for Quran Text models | Add tests for Quran Text models
| Python | mit | EmadMokhtar/tafseer_api | ---
+++
@@ -0,0 +1,51 @@
+from django.test import TestCase
+
+from model_mommy import mommy
+
+from ..models import Ayah
+
+
+class SuraModelTest(TestCase):
+ def setUp(self):
+ self.sura = mommy.make('quran_text.sura', name='Al-Fateha', index=1)
+ self.ayah = mommy.make('quran_text.ayah', number=1, ... | |
704b2fe733ca8a8f5d680c1cf829a124bf3041bd | crawler/wikitravel-manual-rename.py | crawler/wikitravel-manual-rename.py | #!/opt/local/bin/python
import hashlib
import json
import os.path
import sys
import string
for i, line in enumerate(sys.stdin):
(url, title, fileName1) = json.loads(line)
page1 = url[27:]
page2 = page1.replace('(', '%28').replace(')', '%29')
fileName2 = page2.replace('/', '_') + '_' + hashlib.md5(page2).hexdig... | Add script to do manual renames. | [crawler] Add script to do manual renames.
| Python | apache-2.0 | TimurTarasenko/omim,milchakov/omim,matsprea/omim,yunikkk/omim,trashkalmar/omim,yunikkk/omim,krasin/omim,mapsme/omim,UdjinM6/omim,programming086/omim,andrewshadura/omim,milchakov/omim,sidorov-panda/omim,syershov/omim,Transtech/omim,goblinr/omim,augmify/omim,Komzpa/omim,mgsergio/omim,mpimenov/omim,ygorshenin/omim,felipeb... | ---
+++
@@ -0,0 +1,18 @@
+#!/opt/local/bin/python
+import hashlib
+import json
+import os.path
+import sys
+import string
+
+for i, line in enumerate(sys.stdin):
+ (url, title, fileName1) = json.loads(line)
+ page1 = url[27:]
+ page2 = page1.replace('(', '%28').replace(')', '%29')
+ fileName2 = page2.replace('/',... | |
4b36485fa49da975ce624f287febf02ac967ce03 | tensorflow/mydatasets.py | tensorflow/mydatasets.py | import tensorflow as tf
import numpy as np
#import pandas as pd
def getdataset(myobj):
if myobj.dataset == 'mnist':
return getmnist()
if myobj.dataset == 'dailymintemperatures':
return getdailymintemperatures(myobj)
def getmnist():
#load mnist data
(x_train, y_train), (x_test, y_test)... | Add tests for neural net (I106). | Add tests for neural net (I106).
| Python | agpl-3.0 | rroart/stockstat,rroart/stockstat,rroart/stockstat,rroart/stockstat,rroart/stockstat,rroart/stockstat,rroart/stockstat | ---
+++
@@ -0,0 +1,40 @@
+import tensorflow as tf
+import numpy as np
+#import pandas as pd
+
+def getdataset(myobj):
+ if myobj.dataset == 'mnist':
+ return getmnist()
+ if myobj.dataset == 'dailymintemperatures':
+ return getdailymintemperatures(myobj)
+
+def getmnist():
+ #load mnist data
+... | |
1dfb79111690a43fbf780119c153e096be9c122e | docker/kolla-ansible/kolla_zookeeper.py | docker/kolla-ansible/kolla_zookeeper.py | #!/usr/bin/python
# Copyright 2015 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... | Add ZooKeeper support in kolla-ansible | Add ZooKeeper support in kolla-ansible
In kolla-mesos, ZK will be used for storing information about
actions done in bootstrap.
Change-Id: Id7067a493b457cf7b73eb007852df7b13f4363b3
Partially-Implements: blueprint zookeeper
| Python | apache-2.0 | dardelean/kolla-ansible,negronjl/kolla,limamauricio/mykolla,stackforge/kolla,openstack/kolla,dardelean/kolla-ansible,GalenMa/kolla,mrangana/kolla,stackforge/kolla,negronjl/kolla,mrangana/kolla,nihilifer/kolla,stackforge/kolla,nihilifer/kolla,openstack/kolla,mandre/kolla,mandre/kolla,coolsvap/kolla,intel-onp/kolla,negro... | ---
+++
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+
+# Copyright 2015 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/L... | |
2544eab8770577b3dfe3ae4559965393eab69a45 | python/tag_img.py | python/tag_img.py | import requests
import json
# Tag an image based on detected visual content which mean running a CNN on top of it.
# https://pixlab.io/#/cmd?id=tagimg for more info.
# Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the sample set for more info.
img = 'https://s-... | Tag an image based on detected visual content which mean running a CNN on top of it. | Tag an image based on detected visual content which mean running a CNN on top of it. | Python | bsd-2-clause | symisc/pixlab,symisc/pixlab,symisc/pixlab | ---
+++
@@ -0,0 +1,21 @@
+import requests
+import json
+
+# Tag an image based on detected visual content which mean running a CNN on top of it.
+# https://pixlab.io/#/cmd?id=tagimg for more info.
+
+# Target Image: Change to any link or switch to POST if you want to upload your image directly, refer to the sample se... | |
0b6ee2e0f4a7431a120968fb487757fa53e9dc7d | server/kcaa/kcsapi_util_test.py | server/kcaa/kcsapi_util_test.py | #!/usr/bin/env python
import pytest
import kcsapi_util
class TestKCSAPIHandler(object):
def pytest_funcarg__kcsapi_handler(self):
return kcsapi_util.KCSAPIHandler(None, False)
def test_get_kcsapi_responses_ignore_unrelated_request(
self, kcsapi_handler):
entries = [
... | Add a test for kcsapi_util. | Add a test for kcsapi_util.
| Python | apache-2.0 | kcaa/kcaa,kcaa/kcaa,kcaa/kcaa,kcaa/kcaa | ---
+++
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+import pytest
+
+import kcsapi_util
+
+
+class TestKCSAPIHandler(object):
+
+ def pytest_funcarg__kcsapi_handler(self):
+ return kcsapi_util.KCSAPIHandler(None, False)
+
+ def test_get_kcsapi_responses_ignore_unrelated_request(
+ self, kcsapi_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.