commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
c358123651df5eb900ddeff113512462c842d2a6 | Expand as_dict on Link | LINKIWI/linkr,LINKIWI/linkr,LINKIWI/linkr | models/link.py | models/link.py | import time
import config.options
import util.cryptography
from linkr import db
class Link(db.Model):
__tablename__ = 'link'
link_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Integer, index=True, default=None)
submit_time = db.Column(db.Integer)
passwor... | import time
import util.cryptography
from linkr import db
class Link(db.Model):
__tablename__ = 'link'
link_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
user_id = db.Column(db.Integer, index=True, default=None)
submit_time = db.Column(db.Integer)
password_hash = db.Column(db.... | mit | Python |
0ea9172e253d36dffab40b3df64ee08cbfc908aa | remove only from the user and not from the group | moranmo29/ShareLink,moranmo29/ShareLink,moranmo29/ShareLink | models/link.py | models/link.py | #this model keeps the link
from google.appengine.ext import ndb
from user import User
import datetime
import time
class Link(ndb.Model):
user = ndb.KeyProperty()
description = ndb.StringProperty()
url_link = ndb.StringProperty() #error when write linkproperty
from_link = ndb.StringProperty()
time_of_enter_the_link... | #this model keeps the link
from google.appengine.ext import ndb
from user import User
import datetime
import time
class Link(ndb.Model):
user = ndb.KeyProperty()
description = ndb.StringProperty()
url_link = ndb.StringProperty() #error when write linkproperty
from_link = ndb.StringProperty()
time_of_enter_the_link... | mit | Python |
18736f7ef302ee75453c41a2f08bb69ca96e4d9f | Bump version | hypothesis/bouncer,hypothesis/bouncer,hypothesis/bouncer | bouncer/__about__.py | bouncer/__about__.py | """Metadata about bouncer shared between setup.py and bouncer code."""
__all__ = ["__version__"]
__version__ = "0.0.7" # PEP440-compliant version number.
| """Metadata about bouncer shared between setup.py and bouncer code."""
__all__ = ["__version__"]
__version__ = "0.0.6" # PEP440-compliant version number.
| bsd-2-clause | Python |
e46c6c85027dcb596392056972350b4e4073b628 | delete grappelli | undocume/undocume,undocume/undocume | undocume/settings/base.py | undocume/settings/base.py | """
Django settings for undocume project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_D... | """
Django settings for undocume project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
i... | mit | Python |
7d30c3e74d2400bb4c976a02f671880560c65b43 | Update merge sort | kirnap/algorithms-in-python | merge_sort.py | merge_sort.py | # Implementation of merge-sort algorithm is purely for educational purposes.
# This example is an intermediate for python learners and will be really helpful to better understand the programming
# and algorithm paradigm and highly recommended for python learners.
# Input is an list of any length and any entries and th... | # Implementation of merge-sort algorithm is purely for educational purposes.
# This example is an intermediate for python learners and will be really helpful to better understand the programming
# and algorithm paradigm and highly recommended for python learners.
# Input is an list of any length and any entries and th... | mit | Python |
4732cfb10dc4a7126166b340c3bc2a6023de924e | Save work on performance demo | jonathanstallings/data-structures | merge_sort.py | merge_sort.py | """
Placeholder for Jonathan's ridiculously long docstring
"""
def merge_srt(un_list):
if len(un_list) > 1:
mid = len(un_list) // 2
left_half = un_list[:mid]
right_half = un_list[mid:]
merge_srt(left_half)
merge_srt(right_half)
x = y = z = 0
while x < len... | """
Placeholder for Jonathan's ridiculously long docstring
"""
def merge_srt(un_list):
if len(un_list) > 1:
mid = len(un_list) // 2
left_half = un_list[:mid]
right_half = un_list[mid:]
merge_srt(left_half)
merge_srt(right_half)
x = y = z = 0
while x < len... | mit | Python |
788913436e9924d6fde9e5c573f71a2f270f2bc4 | Correct import | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | luigi/tasks/rgd/organism.py | luigi/tasks/rgd/organism.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | apache-2.0 | Python |
0307c6bae5eaf6859ac157d53a50035cde4d6313 | Update utils.py | huyouare/SnapchatBot,huyouare/SnapchatBot,Gendreau/SnapchatBot,agermanidis/SnapchatBot,N07070/SnapchatBot,N07070/SnapchatBot,agermanidis/SnapchatBot,Gendreau/SnapchatBot | snapchat_bots/utils.py | snapchat_bots/utils.py | import tempfile, mimetypes, datetime, subprocess, re, math
from PIL import Image
from constants import MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO, MEDIA_TYPE_VIDEO_WITHOUT_AUDIO, SNAP_IMAGE_DIMENSIONS
def file_extension_for_type(media_type):
if media_type is MEDIA_TYPE_IMAGE:
return ".jpg"
else:
return... | import tempfile, mimetypes, datetime, subprocess, re, math
from PIL import Image
from constants import MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO, MEDIA_TYPE_VIDEO_WITHOUT_AUDIO, SNAP_IMAGE_DIMENSIONS
def file_extension_for_type(media_type):
print media_type
if media_type is MEDIA_TYPE_IMAGE:
return ".jpg"
... | mit | Python |
d3574ab8e83fa1ca8bb86cc30b6bc29f36c78eac | Update piece.py | Niceboy5275/PythonChess,Niceboy5275/PythonChess | classes/piece.py | classes/piece.py | class piece(object):
_players = {'BLANC' : -1, 'NOIR' : 1}
_color = 0
_moved = False
def __init__(self, color):
self._color = color
def move(self, pox_x, pos_y, tableau, isPossible):
raise NotImplementedException()
def getLetter(self):
raise NotImplementedException()
... | class piece(object):
_players = {'BLANC' : -1, 'NOIR' : 1}
_color = 0
_moved = False
def __init__(self, color):
self._color = color
def move(self, pox_x, pos_y, tableau, isPossible):
raise NotImplementedException()
def getLetter(self):
raise NotImplementedException()
... | mit | Python |
8ba94b216531f249a7097f10eb74f363af6151e2 | Rename internal variables to start with a _ | dstufft/xmlrpc2 | xmlrpc2/client.py | xmlrpc2/client.py | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import urllib.parse
class BaseTransport(object):
@property
def scheme(self):
raise NotImplementedError("Transports must have a scheme")
class HTTPTransport(BaseTransport):
scheme = "... | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import urllib.parse
class BaseTransport(object):
@property
def scheme(self):
raise NotImplementedError("Transports must have a scheme")
class HTTPTransport(BaseTransport):
scheme = "... | bsd-2-clause | Python |
8265ac5a97e487ba690bc832e3c398365f76975f | Fix for Python 3.6 | healthchecks/healthchecks,iphoting/healthchecks,healthchecks/healthchecks,iphoting/healthchecks,iphoting/healthchecks,healthchecks/healthchecks,healthchecks/healthchecks,iphoting/healthchecks | hc/api/management/commands/smtpd.py | hc/api/management/commands/smtpd.py | import asyncore
import re
from smtpd import SMTPServer
from django.core.management.base import BaseCommand
from hc.api.models import Check
RE_UUID = re.compile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$")
class Listener(SMTPServer):
def __init__(self, localaddr, s... | import asyncore
import re
from smtpd import SMTPServer
from django.core.management.base import BaseCommand
from hc.api.models import Check
RE_UUID = re.compile("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[8|9|aA|bB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$")
class Listener(SMTPServer):
def __init__(self, localaddr, s... | bsd-3-clause | Python |
9548ab5b95d59b4fd55653e163ea5c9f1f53dd6e | Bump the version. | delfick/bespin,realestate-com-au/bespin,realestate-com-au/bespin,delfick/bespin | bespin/__init__.py | bespin/__init__.py | VERSION="0.5.5.8"
| VERSION="0.5.5.7"
| mit | Python |
0cfb5f53f3cea5ec9cb42f205d79cd25b3034d90 | clean up the admin for task log | crateio/crate.io | crate_project/apps/pypi/admin.py | crate_project/apps/pypi/admin.py | from django.contrib import admin
from pypi.models import ChangeLog, Log, PackageModified, TaskLog
class ChangeLogAdmin(admin.ModelAdmin):
list_display = ["package", "version", "timestamp", "action", "handled"]
list_filter = ["timestamp", "handled"]
search_fields = ["package", "action"]
class LogAdmin(a... | from django.contrib import admin
from pypi.models import ChangeLog, Log, PackageModified, TaskLog
class ChangeLogAdmin(admin.ModelAdmin):
list_display = ["package", "version", "timestamp", "action", "handled"]
list_filter = ["timestamp", "handled"]
search_fields = ["package", "action"]
class LogAdmin(a... | bsd-2-clause | Python |
d01528228b647fb55b9e60f0279349adf0438ac1 | Solve Module2/assignment2 | kHarshit/DAT210x_Microsoft | Module2/assignment2.py | Module2/assignment2.py | import pandas as pd
import os
os.chdir("../Module1/")
cwd = os.getcwd()
print(cwd)
# TODO: Load up the 'tutorial.csv' dataset
csv_df = pd.read_csv('tutorial.csv', sep=',')
# TODO: Print the results of the .describe() method
print(csv_df)
print(csv_df.describe())
print(csv_df.info())
print(csv_df.head(3... | import pandas as pd
# TODO: Load up the 'tutorial.csv' dataset
#
# .. your code here ..
# TODO: Print the results of the .describe() method
#
# .. your code here ..
# TODO: Figure out which indexing method you need to
# use in order to index your dataframe with: [2:4,'col3']
# And print the results
#
# .. your c... | mit | Python |
d9d2e8ce6ef1365eaa7e722128529ad5142ca31c | Add sleep to prevent 100% CPU usage in some cases | 5225225/bar,5225225/bar | modules/mpd.py | modules/mpd.py | import socket
import signal
import linelib
import time
import json
ID = "mpd"
def handler(x, y):
pass
signal.signal(signal.SIGUSR1, handler)
signal.signal(signal.SIGALRM, handler)
def mpd2dict(output):
x = output.split("\n")
d = dict()
for item in x[:-2]:
# MPD returns OK at the end, and th... | import socket
import signal
import linelib
import time
import json
ID = "mpd"
def handler(x, y):
pass
signal.signal(signal.SIGUSR1, handler)
signal.signal(signal.SIGALRM, handler)
def mpd2dict(output):
x = output.split("\n")
d = dict()
for item in x[:-2]:
# MPD returns OK at the end, and th... | mit | Python |
e64195a005be583f32754e49e870b198ee7bc396 | Increase case search limit to 100 results | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/pillows/mappings/case_search_mapping.py | corehq/pillows/mappings/case_search_mapping.py | from corehq.pillows.mappings.case_mapping import CASE_ES_TYPE
from corehq.pillows.mappings.utils import mapping_from_json
from corehq.util.elastic import es_index
from pillowtop.es_utils import ElasticsearchIndexInfo
CASE_SEARCH_INDEX = es_index("case_search_2016-03-15")
CASE_SEARCH_ALIAS = "case_search"
CASE_SEARCH_... | from corehq.pillows.mappings.case_mapping import CASE_ES_TYPE
from corehq.pillows.mappings.utils import mapping_from_json
from corehq.util.elastic import es_index
from pillowtop.es_utils import ElasticsearchIndexInfo
CASE_SEARCH_INDEX = es_index("case_search_2016-03-15")
CASE_SEARCH_ALIAS = "case_search"
CASE_SEARCH_... | bsd-3-clause | Python |
cd395e2f183ec01fd7ce8245e2de2c5bd802eac4 | handle no groups on partner in admin | Socialsquare/verellen.biz,Socialsquare/verellen.biz,Socialsquare/verellen.biz,Socialsquare/verellen.biz | verellen/partner/admin.py | verellen/partner/admin.py | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from partner.models import Partner, PartnerGroup, PriceList, SalesTool
class UserInline(admin.TabularInline):
model = User
class PartnerGroupAdmin(admin.ModelAdmin):
fields = [ 'name',... | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from partner.models import Partner, PartnerGroup, PriceList, SalesTool
class UserInline(admin.TabularInline):
model = User
class PartnerGroupAdmin(admin.ModelAdmin):
fields = [ 'name',... | mit | Python |
11580c007cda3e43fe38dfe10ecc36b75eaa7c56 | Add missing coma ',' | SerpentCS/purchase-workflow,SerpentCS/purchase-workflow,SerpentCS/purchase-workflow | purchase_order_variant_mgmt/__openerp__.py | purchase_order_variant_mgmt/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Handle easily multiple variants on Purchase Orders',
'summary': 'Handle the addition/removal of multiple variants from '
'product templat... | # -*- coding: utf-8 -*-
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Handle easily multiple variants on Purchase Orders',
'summary': 'Handle the addition/removal of multiple variants from '
'product templat... | agpl-3.0 | Python |
37671781813c5dca3c8d8eaf65c0fa9f91a6117f | Set up default request timeout to 15 seconds #18081 | business-factory/gold-digger | gold_digger/data_providers/_provider.py | gold_digger/data_providers/_provider.py | # -*- coding: utf-8 -*-
import requests
import requests.exceptions
from abc import ABCMeta, abstractmethod
from decimal import Decimal, InvalidOperation
class Provider(metaclass=ABCMeta):
DEFAULT_REQUEST_TIMEOUT = 15 # 15 seconds for both connect & read timeouts
def __init__(self, logger):
self.lo... | # -*- coding: utf-8 -*-
import requests
import requests.exceptions
from abc import ABCMeta, abstractmethod
from decimal import Decimal, InvalidOperation
class Provider(metaclass=ABCMeta):
def __init__(self, logger):
self.logger = logger
@property
@abstractmethod
def name(self):
pass... | apache-2.0 | Python |
eb2e4e8c69ed722363aa9d93ecc7c4c0c24d12b3 | increase version to 0.4.1 | arneb/django-campaign,arneb/django-campaign | campaign/__init__.py | campaign/__init__.py | __version__ = '0.4.1'
default_app_config = 'campaign.apps.CampaignConfig'
| __version__ = '0.4.0'
default_app_config = 'campaign.apps.CampaignConfig'
| bsd-3-clause | Python |
68711ec4c5ef45730b6bbde252468a05fdaf184f | FIX drop pdb | gisce/primestg | spec/Order_B07_spec.py | spec/Order_B07_spec.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from primestg.order.orders import Order
from expects import expect, equal
with description('Order B07 IP FTP Generation'):
with it('generates expected B07 xml'):
expected_result = '<Order IdPet="1234" IdReq="B07" Version="3.1.c">\n ' \
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from primestg.order.orders import Order
from expects import expect, equal
with description('Order B07 IP FTP Generation'):
with it('generates expected B07 xml'):
import pdb; pdb.set_trace()
expected_result = '<Order IdPet="1234" IdReq="B07" Version="3.... | agpl-3.0 | Python |
f202efa24934a197a45b261a403edf4fdcd4673e | fix login required decorator | bulletshot60/primer-web,bulletshot60/primer-web,bulletshot60/primer-web,bulletshot60/primer-web | blockly/views.py | blockly/views.py | from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
import logging
import json
from .models import BlocklyBot
# Get an instance of a logger
logger = logging.... | from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
import logging
import json
from .models import BlocklyBot
# Get an instance of a logger
logger = logging.... | mit | Python |
a19d09a65af1370e6c35946c720d1258072113aa | add csv as allowed format | ExCiteS/geokey-export,ExCiteS/geokey-export,ExCiteS/geokey-export | geokey_export/urls.py | geokey_export/urls.py | from django.conf.urls import include, url
from rest_framework.urlpatterns import format_suffix_patterns
from views import (
IndexPage,
ExportOverview,
ExportCreate,
ExportDelete,
ExportToRenderer,
ExportGetExportContributions,
ExportGetProjectCategories,
ExportGetProjectCategoryContrib... | from django.conf.urls import include, url
from rest_framework.urlpatterns import format_suffix_patterns
from views import (
IndexPage,
ExportOverview,
ExportCreate,
ExportDelete,
ExportToRenderer,
ExportGetExportContributions,
ExportGetProjectCategories,
ExportGetProjectCategoryContrib... | mit | Python |
c3f6b4ddf56b8844f2ddf91c566e233270c42f74 | Add `SampleArtifactCache` and `SampleReadsFileCache` SQL models | igboyes/virtool,igboyes/virtool,virtool/virtool,virtool/virtool | virtool/samples/models.py | virtool/samples/models.py | from sqlalchemy import Column, DateTime, Enum, Integer, String
from virtool.pg.utils import Base, SQLEnum
class ArtifactType(str, SQLEnum):
"""
Enumerated type for possible artifact types
"""
sam = "sam"
bam = "bam"
fasta = "fasta"
fastq = "fastq"
csv = "csv"
tsv = "tsv"
jso... | from sqlalchemy import Column, DateTime, Enum, Integer, String
from virtool.pg.utils import Base, SQLEnum
class ArtifactType(str, SQLEnum):
"""
Enumerated type for possible artifact types
"""
sam = "sam"
bam = "bam"
fasta = "fasta"
fastq = "fastq"
csv = "csv"
tsv = "tsv"
jso... | mit | Python |
474e79bfd64aeeb4e0ef0f24b614f3d19a72120e | Fix doctests | Ceasar/trees | trees/heap.py | trees/heap.py | """
Convenience wrapper for the functional heapq library.
"""
import heapq
# TODO: add a __contains__ method
class heap(object):
'''A tree-based data structure that satisfies the heap property.
A heap can be used as priority queue by pushing tuples onto the heap.
>>> import trees
>>> h = trees.heap.... | """
Convenience wrapper for the functional heapq library.
"""
import heapq
# TODO: add a __contains__ method
class heap(object):
'''A tree-based data structure that satisfies the heap property.
A heap can be used as priority queue by pushing tuples onto the heap.
>>> import trees
>>> h = trees.heap(... | mit | Python |
00d9483d405972352786b164881031a2b11cb5e4 | Fix previous commit. | eriklovlie/scaling-octo-bear,eriklovlie/scaling-octo-bear | get-long-functions.py | get-long-functions.py | #!/usr/bin/env python
import os.path
import json
import glob
def get_long(json_files):
threshold = 100
longfun = {}
for path in json_files:
print "Reading {}".format(path)
with open(path) as f:
doc = json.load(f)
for func in doc:
length = func['line_end'] - f... | #!/usr/bin/env python
import os.path
import json
import glob
def get_long(json_files):
threshold = 100
longfun = {}
for path in json_files:
print "Reading {}".format(path)
with open(path) as f:
doc = json.load(f)
for func in doc:
length = func['line_end'] - f... | mit | Python |
ba75e76df78b2b09f8b94584360187b719a39b19 | Fix init value | daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various,daveinnyc/various | project_euler/021.amicable_numbers.py | project_euler/021.amicable_numbers.py | '''
Problem 021
Let d(n) be defined as the sum of proper divisors of n (numbers less than n
which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and
each of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, ... | '''
Problem 021
Let d(n) be defined as the sum of proper divisors of n (numbers less than n
which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and
each of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, ... | mit | Python |
8ba35ff373fea95278034a3d50d0dc95db5c6e20 | test properties app name modified | buildbuild/buildbuild,buildbuild/buildbuild,buildbuild/buildbuild | buildbuild/properties/tests/test_available_language.py | buildbuild/properties/tests/test_available_language.py | from properties.models import AvailableLanguage
from django.test import TestCase
from django.core.exceptions import ObjectDoesNotExist
class TestLanguage(TestCase):
fixtures = ['properties_data.yaml']
def setUp(self):
pass
def test_get_all_available_language(self):
self.assertIsNotNone(Lan... | from properties.models import Language
from django.test import TestCase
from django.core.exceptions import ObjectDoesNotExist
class TestLanguage(TestCase):
fixtures = ['properties_data.yaml']
def setUp(self):
pass
def test_get_all_available_language(self):
self.assertIsNotNone(Language.obj... | bsd-3-clause | Python |
a8252d8e8323ffeeb3e222d03aa1caabd9fa10db | expand ambiguities test | nkhuyu/blaze,alexmojaki/blaze,jcrist/blaze,jdmcbr/blaze,LiaoPan/blaze,dwillmer/blaze,scls19fr/blaze,ChinaQuants/blaze,ContinuumIO/blaze,ChinaQuants/blaze,alexmojaki/blaze,cpcloud/blaze,caseyclements/blaze,xlhtc007/blaze,cowlicks/blaze,jcrist/blaze,jdmcbr/blaze,caseyclements/blaze,cpcloud/blaze,maxalbert/blaze,nkhuyu/bl... | blaze/tests/test_core.py | blaze/tests/test_core.py | from blaze import into, compute_up, compute_down, drop, create_index
from multipledispatch.conflict import ambiguities
def test_no_dispatch_ambiguities():
for func in [into, compute_up, compute_down, drop, create_index]:
assert not ambiguities(func.funcs)
| from blaze import into, compute_up
from multipledispatch.conflict import ambiguities
def test_into_non_ambiguous():
assert not ambiguities(into.funcs)
def test_compute_up_non_ambiguous():
assert not ambiguities(compute_up.funcs)
| bsd-3-clause | Python |
9f3cdd657a6fb1916cb82a0423f3da7d2738bf49 | change api name | zeluspudding/googlefinance,hongtaocai/googlefinance | googlefinance/__init__.py | googlefinance/__init__.py | '''
MIT License
'''
from urllib2 import Request, urlopen
import json
import sys
__author__ = 'hongtaocai@gmail.com'
googleFinanceKeyToFullName = {
u'id' : u'ID',
u't' : u'StockSymbol',
u'e' : u'Index',
u'l' : u'LastTradePrice',
u'l_cur' : u'LastTradeWithCurrency',
u'ltt' ... | '''
MIT License
'''
from urllib2 import Request, urlopen
import json
import sys
__author__ = 'hongtaocai@gmail.com'
googleFinanceKeyToFullName = {
u'id' : u'ID',
u't' : u'StockSymbol',
u'e' : u'Index',
u'l' : u'LastTradePrice',
u'l_cur' : u'LastTradeWithCurrency',
u'ltt' ... | mit | Python |
0789b9afc84757b7cef1d4cf6d433e90c7cb78d3 | Make stream return headers immediately | grengojbo/st2,jtopjian/st2,pinterb/st2,alfasin/st2,pixelrebel/st2,nzlosh/st2,alfasin/st2,Plexxi/st2,armab/st2,nzlosh/st2,punalpatel/st2,emedvedev/st2,tonybaloney/st2,StackStorm/st2,peak6/st2,StackStorm/st2,jtopjian/st2,tonybaloney/st2,peak6/st2,armab/st2,alfasin/st2,pinterb/st2,nzlosh/st2,jtopjian/st2,dennybaa/st2,gren... | st2api/st2api/controllers/v1/stream.py | st2api/st2api/controllers/v1/stream.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... | # 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... | apache-2.0 | Python |
db20fc6b7a21efbd7de0f5b0d1aa754c19c1a21f | Remove all scores before populating the sorted set. | theju/f1oracle,theju/f1oracle | race/management/commands/update_leaderboard.py | race/management/commands/update_leaderboard.py | from django.core.management.base import BaseCommand
from django.conf import settings
from ...models import OverallDriverPrediction, OverallConstructorPrediction
class Command(BaseCommand):
can_import_settings = True
def handle(self, *args, **kwargs):
conn = settings.REDIS_CONN
num_ranks = con... | from django.core.management.base import BaseCommand
from django.conf import settings
from ...models import OverallDriverPrediction, OverallConstructorPrediction
class Command(BaseCommand):
can_import_settings = True
def handle(self, *args, **kwargs):
conn = settings.REDIS_CONN
num_ranks = con... | bsd-3-clause | Python |
0f0e0e91db679f18ad9dc7568047b76e447ac589 | Change of the module version | kmee/stock-logistics-warehouse,acsone/stock-logistics-warehouse,open-synergy/stock-logistics-warehouse | stock_inventory_chatter/__openerp__.py | stock_inventory_chatter/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2018 initOS GmbH
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': 'Stock Inventory Chatter',
'version': '8.0.1.0.0',
'author': "Eficent, "
... | # -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': 'Stock Inventory Chatter',
'version': '9.0.1.0.0',
'author': "Eficent, "
"Odoo Community Assoc... | agpl-3.0 | Python |
137904809733720d24f8715545652820c0a93cd6 | change tag to type for all records | stacybird/CS510CouchDB,stacybird/CS510CouchDB,stacybird/CS510CouchDB | scripts/csv_to_json_file_tag.py | scripts/csv_to_json_file_tag.py | #!/usr/bin/env python
import sys
import csv
import json
import re
if len(sys.argv) != 3:
print 'Incorrect number of arguments.'
print 'Usage: csv_to_json.py path_to_csv path_to_json'
exit()
print 'Argument List:', str(sys.argv)
csvFileName = sys.argv[1]
jsonFileArray = sys.argv[2].split(".")
csvFile = open (cs... | #!/usr/bin/env python
import sys
import csv
import json
import re
if len(sys.argv) != 3:
print 'Incorrect number of arguments.'
print 'Usage: csv_to_json.py path_to_csv path_to_json'
exit()
print 'Argument List:', str(sys.argv)
csvFileName = sys.argv[1]
jsonFileArray = sys.argv[2].split(".")
csvFile = open (cs... | apache-2.0 | Python |
51cc1df39a53ef26d36ff8d65aa690f08b57dd99 | Add tests for SentryLogObserver. | harrissoerja/vumi,harrissoerja/vumi,vishwaprakashmishra/xmatrix,vishwaprakashmishra/xmatrix,TouK/vumi,TouK/vumi,harrissoerja/vumi,TouK/vumi,vishwaprakashmishra/xmatrix | vumi/tests/test_sentry.py | vumi/tests/test_sentry.py | """Tests for vumi.sentry."""
import logging
from twisted.trial.unittest import TestCase
from twisted.internet.defer import inlineCallbacks
from twisted.web import http
from twisted.python.failure import Failure
from vumi.tests.utils import MockHttpServer, LogCatcher
from vumi.sentry import quiet_get_page, SentryLogO... | """Tests for vumi.sentry."""
from twisted.trial.unittest import TestCase
from twisted.internet.defer import inlineCallbacks
from twisted.web import http
from vumi.tests.utils import MockHttpServer, LogCatcher
from vumi.sentry import quiet_get_page
class TestQuietGetPage(TestCase):
@inlineCallbacks
def setU... | bsd-3-clause | Python |
0599acdaa610324de36805503aff133f5d6aff08 | set notification logger to warning instead of error | thp44/delphin_6_automation | delphin_6_automation/logging/ribuild_logger.py | delphin_6_automation/logging/ribuild_logger.py | __author__ = 'Christian Kongsgaard'
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules:
import logging
import os
from notifiers.logging import NotificationHandler
import platform
# RiBuild Modules:
try:
... | __author__ = 'Christian Kongsgaard'
__license__ = 'MIT'
# -------------------------------------------------------------------------------------------------------------------- #
# IMPORTS
# Modules:
import logging
import os
from notifiers.logging import NotificationHandler
import platform
# RiBuild Modules:
try:
... | mit | Python |
517cc83aff398b62073abbcd2d23bbaae556d3ae | fix Python 3 check | Kamekameha/vapoursynth,vapoursynth/vapoursynth,vapoursynth/vapoursynth,Kamekameha/vapoursynth,vapoursynth/vapoursynth,Kamekameha/vapoursynth,Kamekameha/vapoursynth,vapoursynth/vapoursynth | waftools/checks/custom.py | waftools/checks/custom.py | from waftools.inflectors import DependencyInflector
from waftools.checks.generic import *
from waflib import Utils, Errors
import os
__all__ = ["check_python", "check_cpu_x86", "check_cpu_x86_64"]
def check_python(ctx, dependency_identifier):
ctx.find_program(['python3', 'python'], var = 'PYTHON')
ctx.load('p... | from waftools.inflectors import DependencyInflector
from waftools.checks.generic import *
from waflib import Utils
import os
__all__ = ["check_python", "check_cpu_x86", "check_cpu_x86_64"]
def check_python(ctx, dependency_identifier):
ctx.find_program(['python3', 'python'], var = 'PYTHON')
ctx.load('python')
... | lgpl-2.1 | Python |
87010af869f58e23f89c7d47e5aa173127114a54 | Update eidos_reader.py for new Eidos version | johnbachman/belpy,johnbachman/indra,johnbachman/indra,pvtodorov/indra,bgyori/indra,sorgerlab/indra,pvtodorov/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/belpy,bgyori/indra,pvtodorov/indra,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,bgyori/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy | indra/sources/eidos/eidos_reader.py | indra/sources/eidos/eidos_reader.py | import json
from indra.java_vm import autoclass, JavaException
class EidosReader(object):
"""Reader object keeping an instance of the Eidos reader as a singleton.
This allows the Eidos reader to need initialization when the first piece of
text is read, the subsequent readings are done with the same
in... | import json
from indra.java_vm import autoclass, JavaException
class EidosReader(object):
"""Reader object keeping an instance of the Eidos reader as a singleton.
This allows the Eidos reader to need initialization when the first piece of
text is read, the subsequent readings are done with the same
in... | bsd-2-clause | Python |
2366b4fa6ca940c4c774a2f3b3c5e5be14edb0af | Refactor dice rolling algorithm in DiceRollerSuite | johnmarcampbell/twircBot | src/DiceRollerSuite.py | src/DiceRollerSuite.py | import random
import re
from src.CommandSuite import CommandSuite
class DiceRollerSuite(CommandSuite):
"""Suite for rolling dice"""
def __init__(self, name):
"""Initialize some variables"""
CommandSuite.__init__(self, name)
self.config = self.config_manager.parse_file('config/defaultLo... | import random
import re
from src.CommandSuite import CommandSuite
class DiceRollerSuite(CommandSuite):
"""Suite for rolling dice"""
def __init__(self, name):
"""Initialize some variables"""
CommandSuite.__init__(self, name)
self.config = self.config_manager.parse_file('config/defaultLo... | mit | Python |
2228084849ce3e2e17e91402b6ae6e7e3a5cb7a4 | Use key().name() instead of link_id | MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging | app/soc/views/helper/redirects.py | app/soc/views/helper/redirects.py | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | #!/usr/bin/python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 | Python |
4593bedda981bff49a3ddb54f20e2f17b55f4c0b | Fix for web interface CLI backup. | lukacu/manus,lukacu/manus,lukacu/manus,lukacu/manus,lukacu/manus | python/manus_webshell/cli/__main__.py | python/manus_webshell/cli/__main__.py | import sys
import os
import json
import errno
import glob
import urllib2
import argparse
import mimetypes
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def d... | import sys
import os
import json
import errno
import glob
import urllib2
import argparse
import mimetypes
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def d... | mit | Python |
020564bdcbcb6586e8d9ed622624db47e0a122d8 | fix incorrect type for empty tags | ProgVal/irctest | irctest/irc_utils/message_parser.py | irctest/irc_utils/message_parser.py | import re
import collections
import supybot.utils
# http://ircv3.net/specs/core/message-tags-3.2.html#escaping-values
TAG_ESCAPE = [
('\\', '\\\\'), # \ -> \\
(' ', r'\s'),
(';', r'\:'),
('\r', r'\r'),
('\n', r'\n'),
]
unescape_tag_value = supybot.utils.str.MultipleReplacer(
dict(map(la... | import re
import collections
import supybot.utils
# http://ircv3.net/specs/core/message-tags-3.2.html#escaping-values
TAG_ESCAPE = [
('\\', '\\\\'), # \ -> \\
(' ', r'\s'),
(';', r'\:'),
('\r', r'\r'),
('\n', r'\n'),
]
unescape_tag_value = supybot.utils.str.MultipleReplacer(
dict(map(la... | mit | Python |
7381f2367bc155434c155e2116cd0d046b3d66ae | add alarm message | dgu-dna/DNA-Bot | apps/alarm.py | apps/alarm.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from apps.decorators import on_command
from apps.slackutils import cat_token, get_nickname, send_msg
import time
@on_command(['!알람', '!ㅇㄹ'])
def run(robot, channel, tokens, user, command):
'''일정시간 이후에 알람 울려줌'''
msg = '사용법 오류'
if le... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from apps.decorators import on_command
from apps.slackutils import cat_token, get_nickname
import time
@on_command(['!알람', '!ㅇㄹ'])
def run(robot, channel, tokens, user, command):
'''일정시간 이후에 알람 울려줌'''
msg = '사용법 오류'
if len(tokens) ... | mit | Python |
0eb0608eeecd287ce5d286fc244013781c29214f | Split admin.globalConfig into two endpoints | luci/luci-py,luci/luci-py,luci/luci-py,luci/luci-py | appengine/config_service/admin.py | appengine/config_service/admin.py | # Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Administration API accessible only by service admins.
Defined as Endpoints API mostly to abuse API Explorer UI and not to write our
own admin ... | # Copyright 2015 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Administration API accessible only by service admins.
Defined as Endpoints API mostly to abuse API Explorer UI and not to write our
own admin ... | apache-2.0 | Python |
da10771e21c2dee4eee0f4fb046b3135d51aa3a9 | Fix file path issue while trying to save the file on Windows. | kerma/Sublime-AdvancedNewFile,yogiben/Sublime-AdvancedNewFile,skuroda/Sublime-AdvancedNewFile,kerma/Sublime-AdvancedNewFile,yogiben/Sublime-AdvancedNewFile | AdvancedNewFile.py | AdvancedNewFile.py | import os
import sublime, sublime_plugin
class AdvancedNewFileCommand(sublime_plugin.TextCommand):
def run(self, edit, is_python=False):
self.count = 0
self.window = self.view.window()
self.root = self.get_root()
self.is_python = is_python
self.show_filename_input()
d... | import os
import sublime, sublime_plugin
class AdvancedNewFileCommand(sublime_plugin.TextCommand):
def run(self, edit, is_python=False):
self.count = 0
self.window = self.view.window()
self.root = self.get_root()
self.is_python = is_python
self.show_filename_input()
d... | mit | Python |
88bdc56cad7c0dba165de26940fd19997e4d9862 | Complete solution | CubicComet/exercism-python-solutions | atbash-cipher/atbash_cipher.py | atbash-cipher/atbash_cipher.py | import re
from string import ascii_lowercase, digits
ATBASH = {k: v for k, v in zip(ascii_lowercase + digits,
ascii_lowercase[::-1] + digits)}
def encode(s):
return " ".join(re.findall(r'.{1,5}', atbash(s)))
def decode(s):
return atbash(s)
def atbash(s):
return "".join... | from string import ascii_lowercase, digits
ATBASH = {k: v for k, v in zip(ascii_lowercase + digits,
ascii_lowercase[::-1] + digits)}
def encode(s):
encoded = atbash(s)
def decode(s):
return atbash(s)
def atbash(s):
return "".join(ATBASH.get(ch, "") for ch in s.lower())... | agpl-3.0 | Python |
e0f92f43200d290d657dbbb09dd1d66451393f3d | Fix appcast script | qvacua/vimr,qvacua/vimr,qvacua/vimr,qvacua/vimr,qvacua/vimr | bin/set_appcast.py | bin/set_appcast.py | #!/usr/bin/env python
# pip install requests
# pip install Markdown
import os
import io
import sys
import subprocess
import requests
import json
import markdown
from datetime import datetime
from string import Template
SIGN_UPDATE = './bin/sign_update'
PRIVATE_KEY_PATH = os.path.expanduser('~/Projects/sparkle_priv.p... | #!/usr/bin/env python
# pip install requests
# pip install Markdown
import os
import sys
import subprocess
import requests
import json
import markdown
from datetime import datetime
from string import Template
SIGN_UPDATE = './bin/sign_update'
PRIVATE_KEY_PATH = os.path.expanduser('~/Projects/sparkle_priv.pem')
GITHU... | mit | Python |
0c506e9e29096c4feb118694b00020d631d67082 | add two drawNetworkGraph functions | oeg8168/PTT-ID-correlator | src/PTTpushAnalyser.py | src/PTTpushAnalyser.py | import collections
import networkx as nx
import matplotlib.pyplot as plt
from src.DBmanage import DBmanage
class PTTpushAnalyser:
def __init__(self):
db = DBmanage()
def analyse(self):
pass
def getAllAuthorPusherPairs(self, crawlArticles):
allAuthorPusherPairs = []
for ... | import collections
import networkx as nx
from src.DBmanage import DBmanage
class PTTpushAnalyser:
def __init__(self):
db = DBmanage()
def analyse(self):
pass
def getAllAuthorPusherPairs(self, crawlArticles):
allAuthorPusherPairs = []
for artical in crawlArticles:
... | mit | Python |
794113ebfd3ea480ac745640b592b893359a62e0 | Use existing service function to look up sessio token for tests | m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | tests/base.py | tests/base.py | """
tests.base
~~~~~~~~~~
Base classes for test cases
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from contextlib import contextmanager
import os
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch
from byceps.application import ... | """
tests.base
~~~~~~~~~~
Base classes for test cases
:Copyright: 2006-2019 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from contextlib import contextmanager
import os
from pathlib import Path
from unittest import TestCase
from unittest.mock import patch
from byceps.application import ... | bsd-3-clause | Python |
8ef3a5841f35af7348581cdd49224c007c9e8729 | Add open assets testcase | flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost | tests/main.py | tests/main.py |
from importlib import import_module
import sys
def try_import(module_name):
try:
sys.stdout.write("Import %s ... " % module_name)
sys.stdout.flush()
import_module(module_name)
sys.stdout.write("OK\n")
sys.stdout.flush()
except ImportError as e:
sys.stdout.wr... |
from importlib import import_module
import sys
def try_import(module_name):
try:
sys.stdout.write("Import %s ... " % module_name)
sys.stdout.flush()
m = import_module(module_name)
sys.stdout.write("OK\n")
sys.stdout.flush()
except ImportError as e:
sys.stdou... | agpl-3.0 | Python |
82f9c36998a526d302be1b7e10e61983d7dbd182 | adjust view for the renaming of log keys | SuperCowPowers/workbench,djtotten/workbench,SuperCowPowers/workbench,djtotten/workbench,djtotten/workbench,SuperCowPowers/workbench | server/workers/view_pcap_bro.py | server/workers/view_pcap_bro.py | ''' view_pcap_bro worker '''
import zerorpc
import itertools
def plugin_info():
return {'name':'view_pcap_bro', 'class':'ViewPcapBro', 'dependencies': ['pcap_bro', 'pcap_meta'],
'description': 'This worker generates a pcap view for the sample. Output keys: [bro_output_log_names...]'}
class ViewPcapBr... | ''' view_pcap_bro worker '''
import zerorpc
import itertools
def plugin_info():
return {'name':'view_pcap_bro', 'class':'ViewPcapBro', 'dependencies': ['pcap_bro', 'pcap_meta'],
'description': 'This worker generates a pcap view for the sample. Output keys: [bro_output_log_names...]'}
class ViewPcapBr... | mit | Python |
021dc3e1fa90bad39ce92ea08f3233dd87236d8e | Bump version | markstory/lint-review,markstory/lint-review,markstory/lint-review | lintreview/__init__.py | lintreview/__init__.py | __version__ = '2.9.0'
| __version__ = '2.8.0'
| mit | Python |
eba09997f1208b729eac4a3c8cf37a92dbc1e6ed | fix raising Exception | wenh123/news-diff,g0v/news-diff | lib/util/net.py | lib/util/net.py | # -*- coding: utf-8 -*-
#
import urllib
portal_ptrn_list = {
'feedsportal': "\.feedsportal\.com",
}
def get_portal(url):
import re
for portal in portal_ptrn_list:
ptrn = re.compile(portal_ptrn_list[portal])
if (ptrn.search(url)): return portal
return False
def break_portal(portal, payload, uo):
... | # -*- coding: utf-8 -*-
#
import urllib
portal_ptrn_list = {
'feedsportal': "\.feedsportal\.com",
}
def get_portal(url):
import re
for portal in portal_ptrn_list:
ptrn = re.compile(portal_ptrn_list[portal])
if (ptrn.search(url)): return portal
return False
def break_portal(portal, payload, uo):
... | mit | Python |
665eb8182e57e729790e83d2bf925e67ab864e6e | Update discord backend | python-social-auth/social-core,python-social-auth/social-core | social_core/backends/discord.py | social_core/backends/discord.py | """
Discord Auth OAuth2 backend, docs at:
https://discordapp.com/developers/docs/topics/oauth2
"""
from social_core.backends.oauth import BaseOAuth2
class DiscordOAuth2(BaseOAuth2):
name = 'discord'
AUTHORIZATION_URL = 'https://discordapp.com/api/oauth2/authorize'
ACCESS_TOKEN_URL = 'https:/... | """
Discord Auth OAuth2 backend, docs at:
https://discordapp.com/developers/docs/topics/oauth2
"""
from social_core.backends.oauth import BaseOAuth2
class DiscordOAuth2(BaseOAuth2):
name = 'discord'
AUTHORIZATION_URL = 'https://discordapp.com/api/oauth2/authorize'
ACCESS_TOKEN_URL = 'https:/... | bsd-3-clause | Python |
d3227e87b658b4ee634dd273a97d1a8fba4c96c9 | Revise docstring and add space line | bowen0701/algorithms_data_structures | lc461_hamming_distance.py | lc461_hamming_distance.py | """Leetcode 461. Hamming Distance
Medium
URL: https://leetcode.com/problems/hamming-distance/description/
The Hamming distance between two integers is the number of positions at which
the corresponding bits are different.
Given two integers x and y, calculate the Hamming distance.
Note:
0 ≤ x, y < 231.
Example:
... | """Leetcode 461. Hamming Distance
Medium
URL: https://leetcode.com/problems/hamming-distance/description/
The Hamming distance between two integers is the number of positions at which
the corresponding bits are different.
Given two integers x and y, calculate the Hamming distance.
Note:
0 ≤ x, y < 231.
Example:
... | bsd-2-clause | Python |
5d33de3868df4549621763db07267ef59fb94eb8 | Fix ohe type in ce | analysiscenter/dataset | dataset/models/tf/losses/core.py | dataset/models/tf/losses/core.py | """ Contains base tf losses """
import tensorflow as tf
def softmax_cross_entropy(labels, logits, *args, **kwargs):
""" Multi-class CE which takes plain or one-hot labels
Parameters
----------
labels : tf.Tensor
logits : tf.Tensor
args
other positional parameters from `tf.losses.sof... | """ Contains base tf losses """
import tensorflow as tf
def softmax_cross_entropy(labels, logits, *args, **kwargs):
""" Multi-class CE which takes plain or one-hot labels
Parameters
----------
labels : tf.Tensor
logits : tf.Tensor
args
other positional parameters from `tf.losses.sof... | apache-2.0 | Python |
33e581931859eb23d541332f9f31ca2fe8be6630 | Update device_credentials to work with new RestClient | auth0/auth0-python,auth0/auth0-python | auth0/v2/device_credentials.py | auth0/v2/device_credentials.py | from .rest import RestClient
class DeviceCredentials(object):
def __init__(self, domain, jwt_token):
self.domain = domain
self.client = RestClient(jwt=jwt_token)
def _url(self, id=None):
url = 'https://%s/api/v2/device-credentials' % self.domain
if id is not None:
... | from .rest import RestClient
class DeviceCredentials(object):
def __init__(self, domain, jwt_token):
url = 'https://%s/api/v2/device-credentials' % domain
self.client = RestClient(endpoint=url, jwt=jwt_token)
def get(self, user_id=None, client_id=None, type=None,
fields=[], incl... | mit | Python |
ef4d1de9c30df4c2d75f09e1d23ab306a9762f71 | call super init in IncludeHandler | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | misc/scripts/check-qhelp.py | misc/scripts/check-qhelp.py | #!/bin/env python3
"""cross platform wrapper around codeql generate query-help to check .qhelp files
This takes care of:
* providing a temporary directory to --output
* finding usages of .inc.qhelp arguments
"""
import pathlib
import subprocess
import sys
import tempfile
import xml.sax
include_cache = {}
class In... | #!/bin/env python3
"""cross platform wrapper around codeql generate query-help to check .qhelp files
This takes care of:
* providing a temporary directory to --output
* finding usages of .inc.qhelp arguments
"""
import pathlib
import tempfile
import sys
import subprocess
import xml.sax
include_cache = {}
class In... | mit | Python |
cd45585233acfe7db1f757b244e2edba8dbb6f6b | Use environment variable REDIS_SERVER. | ooda/cloudly,ooda/cloudly | cloudly/cache.py | cloudly/cache.py | import os
import redis as pyredis
from cloudly.aws import ec2
from cloudly.memoized import Memoized
@Memoized
def get_conn():
ip_addresses = (os.environ.get("REDIS_SERVER") or
ec2.find_service_ip('redis-server') or
["127.0.0.1"])
redis_url = os.getenv('REDISTOGO_URL'... | import os
import redis as pyredis
from cloudly.aws import ec2
from cloudly.memoized import Memoized
@Memoized
def get_conn():
ip_addresses = ec2.find_service_ip('redis-server') or ["127.0.0.1"]
redis_url = os.getenv('REDISTOGO_URL', # Set when on Heroku.
'redis://{}:6379'.format(ip... | mit | Python |
15aeb761e07ce3a1f6aef696abf3c2a0b6c6e394 | change status codes | hmisty/bson-rpc | bson_rpc/status.py | bson_rpc/status.py | # MIT License
#
# Copyright (c) 2017 Evan Liu (hmisty)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | # MIT License
#
# Copyright (c) 2017 Evan Liu (hmisty)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | mit | Python |
aef238386c71d52def424c8f47a103bd25f12e26 | Make fix_updated migration (sort of) reversible | cityofsomerville/citydash,cityofsomerville/citydash,codeforboston/cornerwise,codeforboston/cornerwise,codeforboston/cornerwise,codeforboston/cornerwise,cityofsomerville/citydash,cityofsomerville/cornerwise,cityofsomerville/citydash,cityofsomerville/cornerwise,cityofsomerville/cornerwise,cityofsomerville/cornerwise | server/proposal/migrations/0034_fix_updated.py | server/proposal/migrations/0034_fix_updated.py | import django.contrib.gis.db.models.fields
from django.db import migrations
from django.contrib.gis.db.models import Max
def fix_updated(apps, _):
Proposal = apps.get_model("proposal", "Proposal")
proposals = Proposal.objects.annotate(published=Max("documents__published"))
for proposal in proposals:
... | import django.contrib.gis.db.models.fields
from django.db import migrations
from django.contrib.gis.db.models import Max
def fix_updated(apps, _):
Proposal = apps.get_model("proposal", "Proposal")
proposals = Proposal.objects.annotate(published=Max("documents__published"))
for proposal in proposals:
... | mit | Python |
8ca32b33db506ba9083b98dd3ecf740cbee89ab1 | Update authentication.JWTAuthentication | davesque/django-rest-framework-simplejwt,davesque/django-rest-framework-simplejwt | rest_framework_simplejwt/authentication.py | rest_framework_simplejwt/authentication.py | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from django.utils.six import text_type
from jose import jwt
from rest_framework import HTTP_HEADER_ENCODING
from rest_framework.authentication import BaseAuthentication
from re... | from __future__ import unicode_literals
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from jose import jwt
from rest_framework.authentication import BaseAuthentication, get_authorization_header
from rest_framework.exceptions import AuthenticationFailed
AUTH_HEA... | mit | Python |
f29e177ff039990463ce4af3e08b9df014d4542c | put output files in a separate dir and tar from there | sassoftware/jobslave,sassoftware/jobslave,sassoftware/jobslave | jobslave/generators/raw_fs_image.py | jobslave/generators/raw_fs_image.py | #
# Copyright (c) 2004-2007 rPath, Inc.
#
# All Rights Reserved
#
import os
import tempfile
from jobslave.generators import bootable_image, constants
from jobslave.filesystems import sortMountPoints
from conary.lib import util, log
class RawFsImage(bootable_image.BootableImage):
def makeBlankFS(self, image, fsT... | #
# Copyright (c) 2004-2007 rPath, Inc.
#
# All Rights Reserved
#
import os
import tempfile
from jobslave.generators import bootable_image, constants
from jobslave.filesystems import sortMountPoints
from conary.lib import util, log
class RawFsImage(bootable_image.BootableImage):
def makeBlankFS(self, image, fsT... | apache-2.0 | Python |
8e20d2e6fde371fcc85979f0ee0b10a38a19d00b | Remove unused environment variable | laughingman7743/PyAthena | tests/util.py | tests/util.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import contextlib
import functools
import os
class Env(object):
def __init__(self):
self.region_name = os.getenv('AWS_DEFAULT_REGION', None)
assert self.region_name, \
... | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import codecs
import contextlib
import functools
import os
class Env(object):
def __init__(self):
# self.user = os.getenv('AWS_ACCESS_KEY_ID', None)
# assert self.user, \
# 'Required... | mit | Python |
b468faf2bc291b668ea3f32eeabdfa8933cfacac | use rffi.sizeof(rffi.INTPTR_T) instead of checking r_uint.BITS | topazproject/topaz,babelsberg/babelsberg-r,topazproject/topaz,topazproject/topaz,babelsberg/babelsberg-r,kachick/topaz,babelsberg/babelsberg-r,kachick/topaz,babelsberg/babelsberg-r,kachick/topaz,babelsberg/babelsberg-r,topazproject/topaz | rupypy/utils/packing/stringpacking.py | rupypy/utils/packing/stringpacking.py | from pypy.rpython.lltypesystem import rffi
pointerlen = rffi.sizeof(rffi.INTPTR_T)
def make_string_packer(padding=" ", nullterminated=False):
def pack_string(packer, width):
space = packer.space
try:
string = space.str_w(
space.convert_type(packer.args_w[packer.args_i... | from pypy.rlib.rarithmetic import r_uint
pointerlen = 8 if r_uint.BITS > 32 else 4
def make_string_packer(padding=" ", nullterminated=False):
def pack_string(packer, width):
space = packer.space
try:
string = space.str_w(
space.convert_type(packer.args_w[packer.args_i... | bsd-3-clause | Python |
206fe7c34f3f15f52c27f0b40d419e84b5a28644 | Fix fabfile typo. | nexiles/nexiles.fabric.tasks,nexiles/nexiles.fabric.tasks | fabfile.py | fabfile.py | import os
from fabric.api import env
from nexiles.fabric.tasks import docs
from nexiles.fabric.tasks import utils
from nexiles.fabric.tasks import release
from nexiles.fabric.tasks import environment
PACKAGE_NAME = "nexiles.fabric.tasks"
VERSION = utils.get_version_from_setup_py()
ROOT_DIR = os.path.abspat... | import os
from fabric.api import env
from nexiles.fabric.tasks import docs
from nexiles.fabric.tasks import utils
from nexiles.fabric.tasks import release
PACKAGE_NAME = "nexiles.fabric.tasks"
VERSION = utils.get_version_from_setup_py()
ROOT_DIR = os.path.abspath(os.path.dirname(__file__))
BUILD_DIR = "... | bsd-3-clause | Python |
482c3952213fdaef8336d3fe4abbc7ca0f78156c | Use `magick` instead of `imgconvert` | kms70847/Animation | lib/animation/__init__.py | lib/animation/__init__.py | #prerequisites: ImageMagick (http://www.imagemagick.org/script/index.php)
import itertools
import os
import os.path
import subprocess
import shutil
import math
def generate_unused_folder_name():
base = "temp_{}"
for i in itertools.count():
name = base.format(i)
if not os.path.exists(name):
... | #prerequisites: ImageMagick (http://www.imagemagick.org/script/index.php)
import itertools
import os
import os.path
import subprocess
import shutil
import math
def generate_unused_folder_name():
base = "temp_{}"
for i in itertools.count():
name = base.format(i)
if not os.path.exists(name):
... | mit | Python |
b43e59a5389ebbd1e57d4fcf62b0958937b504df | Add OCA as author of OCA addons | Eficent/manufacture-reporting,Endika/manufacture-reporting | __unported__/mrp_webkit/__openerp__.py | __unported__/mrp_webkit/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011-2013 Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
#
# This program is free software: you can redistribute it and/or modif... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011-2013 Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
#
# This program is free software: you can redistribute it and/or modif... | agpl-3.0 | Python |
a7b5041f42a7ea621f5b484e24cc36e751776474 | Add unit test for reader reconnect | mre/kafka-influxdb,mre/kafka-influxdb | kafka_influxdb/tests/test_worker.py | kafka_influxdb/tests/test_worker.py | import unittest
from mock import Mock
import random
from kafka_influxdb.worker import Worker
from kafka_influxdb.encoder import echo_encoder
class Config:
def __init__(self, buffer_size):
self.buffer_size = buffer_size
self.kafka_topic = "test"
self.influxdb_dbname = "mydb"
class DummyRe... | import unittest
from mock import Mock
import random
from kafka_influxdb.worker import Worker
from kafka_influxdb.encoder import echo_encoder
class Config:
def __init__(self, buffer_size):
self.buffer_size = buffer_size
self.kafka_topic = "test"
self.influxdb_dbname = "mydb"
class DummyRe... | apache-2.0 | Python |
0ac7b18c846fe8df134a2241bb0163e9fd4b7633 | Initialize empty MonadicDict by default. | genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2 | wqflask/utility/monads.py | wqflask/utility/monads.py | """Monadic utilities
This module is a collection of monadic utilities for use in
GeneNetwork. It includes:
* MonadicDict - monadic version of the built-in dictionary
* MonadicDictCursor - monadic version of MySQLdb.cursors.DictCursor
that returns a MonadicDict instead of the built-in dictionary
"""
from collection... | """Monadic utilities
This module is a collection of monadic utilities for use in
GeneNetwork. It includes:
* MonadicDict - monadic version of the built-in dictionary
* MonadicDictCursor - monadic version of MySQLdb.cursors.DictCursor
that returns a MonadicDict instead of the built-in dictionary
"""
from collection... | agpl-3.0 | Python |
06c860b317471221fb27285aa9f42ac088c96867 | update Trim | naturalis/HTS-barcode-checker,naturalis/HTS-barcode-checker,naturalis/HTS-barcode-checker | bin/Trim/Trim.py | bin/Trim/Trim.py | #!/usr/bin/python2.7
'''
Created on 22 Nov. 2012
Author: Alex Hoogkamer
E-mail: aqhoogkamer@outlook.com / s1047388@student.hsleiden.nl
this script will trim fastq files based on the phred quality scores.
'''
from Bio import SeqIO
import os
'''
this block counts the number of reads and filters reads that have more
th... | #!/usr/bin/python2.7
'''
Created on 22 Nov. 2012
Author: Alex Hoogkamer
E-mail: aqhoogkamer@outlook.com / s1047388@student.hsleiden.nl
this script will trim fastq files based on the phred quality scores.
'''
import Bio
| bsd-3-clause | Python |
d35b9c4973cba355b1924072c992731191124722 | Make image title editable in the list | jodal/comics,jodal/comics,datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics | comics/core/admin.py | comics/core/admin.py | from django.contrib import admin
from comics.core import models
class ComicAdmin(admin.ModelAdmin):
list_display = ('slug', 'name', 'language', 'url', 'rights', 'start_date',
'end_date', 'active')
list_filter = ['active', 'language']
readonly_fields = ('name', 'slug', 'language', 'url', 'rights',... | from django.contrib import admin
from comics.core import models
class ComicAdmin(admin.ModelAdmin):
list_display = ('slug', 'name', 'language', 'url', 'rights', 'start_date',
'end_date', 'active')
list_filter = ['active', 'language']
readonly_fields = ('name', 'slug', 'language', 'url', 'rights',... | agpl-3.0 | Python |
3dcba234b5c29e393d611adf88bfdca2a081f8db | fix dump_syms.py to work with python 3 (#28910) | electron/electron,electron/electron,bpasero/electron,electron/electron,bpasero/electron,electron/electron,gerhardberger/electron,bpasero/electron,electron/electron,gerhardberger/electron,electron/electron,bpasero/electron,bpasero/electron,gerhardberger/electron,gerhardberger/electron,gerhardberger/electron,electron/ele... | build/dump_syms.py | build/dump_syms.py | from __future__ import print_function
import collections
import os
import subprocess
import sys
import errno
# The BINARY_INFO tuple describes a binary as dump_syms identifies it.
BINARY_INFO = collections.namedtuple('BINARY_INFO',
['platform', 'arch', 'hash', 'name'])
def get_mo... | from __future__ import print_function
import collections
import os
import subprocess
import sys
import errno
# The BINARY_INFO tuple describes a binary as dump_syms identifies it.
BINARY_INFO = collections.namedtuple('BINARY_INFO',
['platform', 'arch', 'hash', 'name'])
def get_mo... | mit | Python |
c9568f90c3605d5a8b647f01c68362f71669fa1a | Use six.moves.reduce for compatibility | utgwkk/py-timeparser,utgwkk/py-timeparser | timeparser.py | timeparser.py | # coding: utf-8
from __future__ import print_function
import re
from six.moves import reduce
def parse(s):
'''
'''
RE_HOUR = r'([0-9]+)h(our)?'
RE_MINUTE = r'([0-9]+)m(in(ute)?)?'
RE_SECOND = r'([0-9]+)(s(ec(ond)?)?)?'
def _parse_time_with_unit(s):
retval = 0
mh = re.match(RE_... | # coding: utf-8
from __future__ import print_function
import re
def parse(s):
'''
'''
RE_HOUR = r'([0-9]+)h(our)?'
RE_MINUTE = r'([0-9]+)m(in(ute)?)?'
RE_SECOND = r'([0-9]+)(s(ec(ond)?)?)?'
def _parse_time_with_unit(s):
retval = 0
mh = re.match(RE_HOUR, s)
mm = re.matc... | mit | Python |
9669fb2b733d1a4051ccd744307f358cab2737e4 | Rename private fields | arthurlockman/p.haul,jne100/p.haul,aburluka/p.haul,xemul/p.haul,xemul/p.haul,aburluka/p.haul,jne100/p.haul,biddyweb/phaul,marcosnils/p.haul,arthurlockman/p.haul,jne100/p.haul,aburluka/p.haul,marcosnils/p.haul,jne100/p.haul,biddyweb/phaul,aburluka/p.haul,xemul/p.haul,biddyweb/phaul,arthurlockman/p.haul,jne100/p.haul,abu... | p_haul_criu.py | p_haul_criu.py | #
# CRIU API
# Includes class to work with CRIU service and helpers
#
import socket
import struct
import os
import subprocess
import rpc_pb2 as cr_rpc
import stats_pb2 as crs
criu_binary = "/root/criu/criu"
req_types = {
cr_rpc.DUMP: "dump",
cr_rpc.PRE_DUMP: "pre_dump",
cr_rpc.PAGE_SERVER: "page_server",
cr_rpc.... | #
# CRIU API
# Includes class to work with CRIU service and helpers
#
import socket
import struct
import os
import subprocess
import rpc_pb2 as cr_rpc
import stats_pb2 as crs
criu_binary = "/root/criu/criu"
req_types = {
cr_rpc.DUMP: "dump",
cr_rpc.PRE_DUMP: "pre_dump",
cr_rpc.PAGE_SERVER: "page_server",
cr_rpc.... | lgpl-2.1 | Python |
0ca8edc752a104dcb7faaa6b5c303a1a8fdbc6aa | Mark functions `{get,set}_extension_value` as internal | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | byceps/config.py | byceps/config.py | """
byceps.config
~~~~~~~~~~~~~
:Copyright: 2006-2022 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from enum import Enum
from typing import Any, Optional
from flask import current_app, Flask
from .services.site.transfer.models import SiteID
EXTENSION_KEY = 'byceps_config'
KEY_AP... | """
byceps.config
~~~~~~~~~~~~~
:Copyright: 2006-2022 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from enum import Enum
from typing import Any, Optional
from flask import current_app, Flask
from .services.site.transfer.models import SiteID
EXTENSION_KEY = 'byceps_config'
KEY_AP... | bsd-3-clause | Python |
9be2bf94043dbf49e5510c34d0bdff98e71b8022 | add read_assembly as main entrance for this module; use redesigned logging class | svm-zhang/AGOUTI | src/agouti_sequence.py | src/agouti_sequence.py | import os
import sys
from lib import agouti_log as agLOG
#def set_module_name(name):
# global moduleName
# moduleName = name
def get_contigs(assemblyFile, agSeqProgress):
# try:
# fCONTIG = open(assemblyFile, 'r')
# except IOError:
# agSeqProgress.logger.error("Error opening contig file: %s" %(assemblyFile), exc_i... | import os
import sys
import logging
from lib import agouti_log as agLOG
def set_module_name(name):
global moduleName
moduleName = name
def get_contigs(contigFasta, moduleOutDir, prefix, logLevel):
moduleLogFile = os.path.join(moduleOutDir, "%s.agouti_seq.progressMeter" %(prefix))
moduleProgressLogger = agLOG.AGO... | mit | Python |
339415048005a9eba957357a02459a977a2e3007 | Update bazel deps to hopefully get CI happy again. | google/google-toolbox-for-mac,thomasvl/google-toolbox-for-mac,google/google-toolbox-for-mac,thomasvl/google-toolbox-for-mac | bazel_support/repositories.bzl | bazel_support/repositories.bzl | """Definitions for handling Bazel repositories for GoogleToolboxForMac. """
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def _maybe(repo_rule, name, **kwargs):
"""Executes the given repository rule if it hasn't been executed already.
Args:
repo_rule: The repository rule to be ex... | """Definitions for handling Bazel repositories for GoogleToolboxForMac. """
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def _maybe(repo_rule, name, **kwargs):
"""Executes the given repository rule if it hasn't been executed already.
Args:
repo_rule: The repository rule to be ex... | apache-2.0 | Python |
835cc8cbc939b582eea0357f11045633df531779 | Use ipyparallel instead IPython.parallel | alexandrucoman/bcbio-nextgen-vm,alexandrucoman/bcbio-nextgen-vm | bcbiovm/docker/ipythontasks.py | bcbiovm/docker/ipythontasks.py | """IPython interface to run bcbio distributed functions inside
a docker container.
Exports processing of a specific function and arguments within docker using
bcbio_nextgen.py runfn.
"""
from ipyparallel import require
from bcbio.distributed import ipython
from bcbio.distributed.ipythontasks import _setup_logging
fro... | """IPython interface to run bcbio distributed functions inside
a docker container.
Exports processing of a specific function and arguments within docker using
bcbio_nextgen.py runfn.
"""
from IPython.parallel import require
from bcbio.distributed import ipython
from bcbio.distributed.ipythontasks import _setup_loggin... | mit | Python |
57db2a901afe8a5b0c80c9dab7d2370c18e656a2 | Expand AUTHORS | Eficent/manufacture,Endika/manufacture,credativUK/manufacture,raycarnes/manufacture | mrp_bom_note/__openerp__.py | mrp_bom_note/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# 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... | # -*- encoding: utf-8 -*-
##############################################################################
#
# 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... | agpl-3.0 | Python |
d6866c6bc7c0c6851912f299d0160080d162c4b3 | Add a lot more resiliancy/output to better_webbrowser.py. We now use webbrowser, but register a WindowsHttpDefault class | protron/namebench,rogers0/namebench,google/namebench,google/namebench,google/namebench | libnamebench/better_webbrowser.py | libnamebench/better_webbrowser.py | #!/usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | #!/usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | apache-2.0 | Python |
45d21d4a6c8dd27e904b154366c96069072ecacd | Add register_as() to simplify replacing formatter implementations (if necessary). | jenisys/behave,vrutkovs/behave,Abdoctor/behave,kymbert/behave,metaperl/behave,Gimpneek/behave,KevinOrtman/behave,allanlewis/behave,mzcity123/behave,vrutkovs/behave,charleswhchan/behave,spacediver/behave,kymbert/behave,Gimpneek/behave,joshal/behave,Abdoctor/behave,charleswhchan/behave,connorsml/behave,jenisys/behave,met... | behave/formatter/formatters.py | behave/formatter/formatters.py | # -*- coding: utf-8 -*-
import sys
import codecs
# -----------------------------------------------------------------------------
# FORMATTER REGISTRY:
# -----------------------------------------------------------------------------
formatters = {}
def register_as(formatter_class, name):
"""
Register formatter... | # -*- coding: utf-8 -*-
import sys
import codecs
# -----------------------------------------------------------------------------
# FORMATTER REGISTRY:
# -----------------------------------------------------------------------------
formatters = {}
def register(formatter):
formatters[formatter.name] = formatter
... | bsd-2-clause | Python |
3710295bd34c23c8a2fc1f37c3523c49cf22ecf9 | Bump the version. | c4fcm/MediaCloud-API-Client | mediacloud/__init__.py | mediacloud/__init__.py |
from api import MediaCloud
from storage import *
__version__ = '2.23.0'
|
from api import MediaCloud
from storage import *
__version__ = '2.22.2'
| mit | Python |
98d6b11c05dad95bdece060094baa81c4eabcfe6 | Update enums.py | sammchardy/python-binance | binance/enums.py | binance/enums.py | # coding=utf-8
SYMBOL_TYPE_SPOT = 'SPOT'
ORDER_STATUS_NEW = 'NEW'
ORDER_STATUS_PARTIALLY_FILLED = 'PARTIALLY_FILLED'
ORDER_STATUS_FILLED = 'FILLED'
ORDER_STATUS_CANCELED = 'CANCELED'
ORDER_STATUS_PENDING_CANCEL = 'PENDING_CANCEL'
ORDER_STATUS_REJECTED = 'REJECTED'
ORDER_STATUS_EXPIRED = 'EXPIRED'
KLINE_INTERVAL_1MIN... | # coding=utf-8
SYMBOL_TYPE_SPOT = 'SPOT'
ORDER_STATUS_NEW = 'NEW'
ORDER_STATUS_PARTIALLY_FILLED = 'PARTIALLY_FILLED'
ORDER_STATUS_FILLED = 'FILLED'
ORDER_STATUS_CANCELED = 'CANCELED'
ORDER_STATUS_PENDING_CANCEL = 'PENDING_CANCEL'
ORDER_STATUS_REJECTED = 'REJECTED'
ORDER_STATUS_EXPIRED = 'EXPIRED'
KLINE_INTERVAL_1MIN... | mit | Python |
3b271300b5921753691a65236652b5c46060e882 | Fix issue 36 | pombreda/django-page-cms,pombreda/django-page-cms,Alwnikrotikz/django-page-cms,Alwnikrotikz/django-page-cms,google-code-export/django-page-cms,PiRSquared17/django-page-cms,odyaka341/django-page-cms,Alwnikrotikz/django-page-cms,PiRSquared17/django-page-cms,odyaka341/django-page-cms,google-code-export/django-page-cms,goo... | pages/views.py | pages/views.py | from django.http import Http404
from django.shortcuts import get_object_or_404
from django.contrib.sites.models import SITE_CACHE
from pages import settings
from pages.models import Page, Content
from pages.utils import auto_render, get_language_from_request
def details(request, page_id=None, slug=None,
temp... | from django.http import Http404
from django.shortcuts import get_object_or_404
from django.contrib.sites.models import SITE_CACHE
from pages import settings
from pages.models import Page, Content
from pages.utils import auto_render, get_language_from_request
def details(request, page_id=None, slug=None,
temp... | bsd-3-clause | Python |
184d6984b9c1a21dea35500edb56de2f94d66371 | Split up logout and authorization checks. | bueda/django-comrade | comrade/test/base.py | comrade/test/base.py | from django import test
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.cache import cache
from nose.tools import eq_, ok_
import json
import mockito
class BaseTest(test.TestCase):
fixtures = ['dev']
... | from django import test
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.cache import cache
from nose.tools import eq_, ok_
import json
import mockito
class BaseTest(test.TestCase):
fixtures = ['dev']
... | mit | Python |
9baa355e1224115a707c0dc507372b20d76cc322 | Clear cache after each test run. | bueda/django-comrade | comrade/test/base.py | comrade/test/base.py | from django import test
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.core.cache import cache
from nose.tools import eq_, ok_
import json
import mockito
class BaseTest(test.TestCase):
fixtures = ['dev']
... | from django import test
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth import REDIRECT_FIELD_NAME
from nose.tools import eq_, ok_
import json
import mockito
class BaseTest(test.TestCase):
fixtures = ['dev']
def setUp(self):
super(Base... | mit | Python |
154878c635d1fbb820a3a3ff89b8711b6cc0a6c5 | Bring 1st cut of the CLI | bendtherules/godaddycli,bendtherules/godaddycli | godaddycli/godaddycli/godaddycli.py | godaddycli/godaddycli/godaddycli.py | #!/usr/bin/env python
# Copyright 2015 by Wojciech A. Koszek <wojciech@koszek.com>
# -*- coding: utf-8 -*-
import os
import sys
import json
import argparse
import getpass
from pygodaddy import GoDaddyClient
g_dns_record_types = [ "A", "CNAME", "MX", "TXT", "SRV", "NS", "AAAA" ]
g_debug = False
def dbg(s):
if g_d... | # -*- coding: utf-8 -*-
| bsd-2-clause | Python |
91f995c87463c82badc79d2515a769b2dd178a6d | Fix get_members.py to use correct environment variables | tiegz/ThreatExchange,wxsBSD/ThreatExchange,theCatWisel/ThreatExchange,tiegz/ThreatExchange,wxsBSD/ThreatExchange,tiegz/ThreatExchange,tiegz/ThreatExchange,wxsBSD/ThreatExchange,theCatWisel/ThreatExchange,wxsBSD/ThreatExchange,theCatWisel/ThreatExchange,theCatWisel/ThreatExchange,RyPeck/ThreatExchange,wxsBSD/ThreatExcha... | members/get_members.py | members/get_members.py | #!/usr/local/bin/python
'''
Search for and retrieve threat indicators from ThreatExchange
'''
from __future__ import print_function
import json
import os
import re
from urllib import urlencode
from urllib2 import urlopen
FB_APP_ID = os.environ['TX_APP_ID']
FB_ACCESS_TOKEN = os.environ['TX_APP_SECRET']
SERVER = 'ht... | #!/usr/local/bin/python
'''
Search for and retrieve threat indicators from ThreatExchange
'''
from __future__ import print_function
import json
import os
import re
from urllib import urlencode
from urllib2 import urlopen
FB_APP_ID = os.environ['FB_THREATEXCHANGE_APP_ID']
FB_ACCESS_TOKEN = os.environ['FB_THREATEXCHA... | bsd-3-clause | Python |
6e526a173de970f2cc8f7cd62823a257786e348e | Add the missing category-detail urlconf to not to break bookmarked users | PARINetwork/pari,PARINetwork/pari,PARINetwork/pari,PARINetwork/pari | category/urls.py | category/urls.py | from django.conf.urls import patterns, url
from .views import CategoriesList, GalleryDetail, StoryDetail
urlpatterns = patterns('category.views',
url(r'^categories/$', CategoriesList.as_view(), name='category-list'),
url(r'^categories/(?P<slug>.+)/$', StoryDetail.as_view(), name='category-detail'),
url(r'... | from django.conf.urls import patterns, url
from .views import CategoriesList, GalleryDetail, StoryDetail
urlpatterns = patterns('category.views',
url(r'^gallery/categories/(?P<slug>.+)/$', GalleryDetail.as_view(), name='gallery-detail'),
url(r'^stories/categories/(?P<slug>.+)/$', StoryDetail.as_view(), name='... | bsd-3-clause | Python |
f41a4e00ac2def76d1ea6f149d08f16be6760b71 | bump version to 0.1.2 | dcoker/cfpp,dcoker/cfpp | cfpp/_version.py | cfpp/_version.py | """0.1.2"""
VERSION = __doc__
| """0.0.1"""
VERSION = __doc__
| apache-2.0 | Python |
4c97b40ff15b3eb41a30d43518a8d922f7e30581 | Update compat.py | mocketize/python-mocket,mindflayer/python-mocket | mocket/compat.py | mocket/compat.py | import sys
import shlex
import six
PY2 = sys.version_info[0] == 2
if PY2:
from BaseHTTPServer import BaseHTTPRequestHandler
from urlparse import urlsplit, parse_qs
else:
from http.server import BaseHTTPRequestHandler
from urllib.parse import urlsplit, parse_qs
text_type = six.text_type
byte_type = si... | import sys
import shlex
import six
PY2 = sys.version_info[0] == 2
if PY2:
from BaseHTTPServer import BaseHTTPRequestHandler
from urlparse import urlsplit, parse_qs
else:
from http.server import BaseHTTPRequestHandler
from urllib.parse import urlsplit, parse_qs
text_type = six.text_type
byte_type = si... | bsd-3-clause | Python |
3fb5b55637f6835da578605d3229fb6833415420 | refactor __repr__ | deseret-tech/litecoin-python,doged/dogecoindark-python,deseret-tech/litecoin-python,laanwj/bitcoin-python,laanwj/bitcoin-python,doged/dogecoindark-python | src/bitcoinrpc/util.py | src/bitcoinrpc/util.py | # Copyright (c) 2010 Witchspace <witchspace81@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... | # Copyright (c) 2010 Witchspace <witchspace81@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... | mit | Python |
077ad3e5227c3ad9831a6c94c14cd640f7e933d9 | Use reverse function for urls in carusele app | SarFootball/backend,SarFootball/backend,SarFootball/backend | carusele/models.py | carusele/models.py | from django.core.urlresolvers import reverse
from django.db import models
class News (models.Model):
"""
News model represent detail description and
content of each carusele element.
"""
title = models.CharField(max_length=400)
description = models.TextField(default="")
content = models.Te... | from django.db import models
class News (models.Model):
"""
News model represent detail description and
content of each carusele element.
"""
title = models.CharField(max_length=400)
description = models.TextField(default="")
content = models.TextField()
pubdate = models.DateTimeField(... | apache-2.0 | Python |
e046b9e47d4ce26403f7bd2054460f6f671bffaf | Fix Typo | iGene/igene_bot,aver803bath5/igene_bot | models/google.py | models/google.py | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import logging
import re
import requests
import urllib.parse
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def google(bot, update):
search = update.message.text
s... | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import logging
import re
import requests
import urllib.parse
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def google(bot, update):
search = update.message.text
s... | mit | Python |
b3c1eecf617cf9278cbd000537f9fac1f9303c4c | Disable django-registration tests in Jenkins. | onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site | bluebottle/settings/jenkins.py | bluebottle/settings/jenkins.py |
# SECRET_KEY and DATABASES needs to be defined before the base settings is imported.
SECRET_KEY = 'hbqnTEq+m7Tk61bvRV/TLANr3i0WZ6hgBXDh3aYpSU8m+E1iCtlU3Q=='
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
from .base import *
#
# Put jenkins environ... |
# SECRET_KEY and DATABASES needs to be defined before the base settings is imported.
SECRET_KEY = 'hbqnTEq+m7Tk61bvRV/TLANr3i0WZ6hgBXDh3aYpSU8m+E1iCtlU3Q=='
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
from .base import *
#
# Put jenkins environ... | bsd-3-clause | Python |
1f6448b0d67d28dcca77bef1ac6bdb45d6c3f5d2 | swap emphasis | MUNComputerScienceSociety/Frisket | modules/fetch.py | modules/fetch.py | import willie.module
import re
from random import randint
from willie.formatting import bold
@willie.module.commands('throw')
@willie.module.commands('fetch')
def fetch(bot, trigger):
"""
Fetch command
"""
x = randint(0,10) #inclusive
words = re.split(' ' , trigger)
del words[0]
joined_wor... | import willie.module
import re
from random import randint
from willie.formatting import bold
@willie.module.commands('throw')
@willie.module.commands('fetch')
def fetch(bot, trigger):
"""
Fetch command
"""
x = randint(0,10) #inclusive
words = re.split(' ' , trigger)
del words[0]
joined_wor... | mit | Python |
4aba708916984c61cc7f5fd205d66e8f64634589 | Make compatible with python 3.4 | Davidyuk/witcoin,Davidyuk/witcoin | main/widgets.py | main/widgets.py | from django_filters.widgets import RangeWidget
class CustomRangeWidget(RangeWidget):
def __init__(self, widget, attrs={}):
attrs_start = {'placeholder': 'От'}
attrs_start.update(attrs)
attrs_stop = {'placeholder': 'До'}
attrs_stop.update(attrs)
super(RangeWidget, self).__in... | from django_filters.widgets import RangeWidget
class CustomRangeWidget(RangeWidget):
def __init__(self, widget, attrs=None):
attrs_start = {'placeholder': 'От', **(attrs or {})}
attrs_stop = {'placeholder': 'До', **(attrs or {})}
widgets = (widget(attrs_start), widget(attrs_stop))
... | agpl-3.0 | Python |
312962b85e3f59117efbdb7d7faf7c1c4ff17f5d | Adjust messages_path to support having the locale files in /usr/share/locale | Xender/wtforms,subyraman/wtforms,Aaron1992/wtforms,Aaron1992/wtforms,hsum/wtforms,skytreader/wtforms,cklein/wtforms,pawl/wtforms,pawl/wtforms,jmagnusson/wtforms,wtforms/wtforms,crast/wtforms | wtforms/i18n.py | wtforms/i18n.py | import os
def messages_path():
"""
Determine the path to the 'messages' directory as best possible.
"""
module_path = os.path.abspath(__file__)
locale_path = os.path.join(os.path.dirname(module_path), 'locale')
if not os.path.exists(locale_path):
locale_path = '/usr/share/locale'
r... | import os
def messages_path():
"""
Determine the path to the 'messages' directory as best possible.
"""
module_path = os.path.abspath(__file__)
return os.path.join(os.path.dirname(module_path), 'locale')
def get_builtin_gnu_translations(languages=None):
"""
Get a gettext.GNUTranslations ... | bsd-3-clause | Python |
94d66121368906b52fa8a9f214813b7b798c2b5b | Add constant for settings schema file path | MarquisLP/Sidewalk-Champion | lib/custom_data/settings_manager.py | lib/custom_data/settings_manager.py | """This module provides functions for saving to and loading data from
the settings XML file.
Attributes:
SETTINGS_PATH (String): The file path for the settings file.
SETTINGS_SCHEMA_PATH (String): The file path for the settings'
XML Schema.
"""
SETTINGS_PATH = 'settings.xml'
SETTINGS_SCHEMA_PATH = 'set... | """This module provides functions for saving to and loading data from
the settings XML file.
Attributes:
SETTINGS_PATH Filepath for the settings file.
"""
SETTINGS_PATH = 'settings.xml'
| unlicense | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.