commit
stringlengths
40
40
old_file
stringlengths
5
117
new_file
stringlengths
5
117
old_contents
stringlengths
0
1.93k
new_contents
stringlengths
19
3.3k
subject
stringlengths
17
320
message
stringlengths
18
3.28k
lang
stringclasses
1 value
license
stringclasses
13 values
repos
stringlengths
7
42.4k
completion
stringlengths
19
3.3k
prompt
stringlengths
21
3.65k
98dd2759a184ba1066e8fd49cd09ff4194d2da0f
docweb/tests/__init__.py
docweb/tests/__init__.py
import os, sys from django.conf import settings # -- Setup Django configuration appropriately TESTDIR = os.path.abspath(os.path.dirname(__file__)) settings.MODULE_DIR = TESTDIR settings.PULL_SCRIPT = os.path.join(TESTDIR, 'pull-test.sh') # The CSRF middleware prevents the Django test client from working, so # disabl...
import os, sys from django.conf import settings # -- Setup Django configuration appropriately TESTDIR = os.path.abspath(os.path.dirname(__file__)) settings.MODULE_DIR = TESTDIR settings.PULL_SCRIPT = os.path.join(TESTDIR, 'pull-test.sh') settings.SITE_ID = 1 # The CSRF middleware prevents the Django test client from...
Set SITE_ID=1 in tests (corresponds to that in the test fixtures)
Set SITE_ID=1 in tests (corresponds to that in the test fixtures)
Python
bsd-3-clause
pv/pydocweb,pv/pydocweb
import os, sys from django.conf import settings # -- Setup Django configuration appropriately TESTDIR = os.path.abspath(os.path.dirname(__file__)) settings.MODULE_DIR = TESTDIR settings.PULL_SCRIPT = os.path.join(TESTDIR, 'pull-test.sh') settings.SITE_ID = 1 # The CSRF middleware prevents the Django test client from...
Set SITE_ID=1 in tests (corresponds to that in the test fixtures) import os, sys from django.conf import settings # -- Setup Django configuration appropriately TESTDIR = os.path.abspath(os.path.dirname(__file__)) settings.MODULE_DIR = TESTDIR settings.PULL_SCRIPT = os.path.join(TESTDIR, 'pull-test.sh') # The CSRF mi...
e4ebbbb010f43612da13691b003f392f56b88fec
bitbots_body_behaviour/scripts/cheering_behaviour.py
bitbots_body_behaviour/scripts/cheering_behaviour.py
#!/usr/bin/env python3 import actionlib import rospy from humanoid_league_msgs.msg import PlayAnimationGoal, PlayAnimationAction, GameState class CheeringBehaviour: def __init__(self): rospy.init_node('cheering_behvaiour') self.opponent_goals = 0 self.animation_running = False ro...
Add simple behaviour to cheer when the opponent scores a goal
Add simple behaviour to cheer when the opponent scores a goal
Python
bsd-3-clause
bit-bots/bitbots_behaviour
#!/usr/bin/env python3 import actionlib import rospy from humanoid_league_msgs.msg import PlayAnimationGoal, PlayAnimationAction, GameState class CheeringBehaviour: def __init__(self): rospy.init_node('cheering_behvaiour') self.opponent_goals = 0 self.animation_running = False ro...
Add simple behaviour to cheer when the opponent scores a goal
6cdcb7f089c0440ad551ec44b3667a1a5cd380d1
kafka/tools/assigner/batcher.py
kafka/tools/assigner/batcher.py
from kafka.tools.assigner.exceptions import ProgrammingException def split_partitions_into_batches(partitions, batch_size=10, use_class=None): # Currently, this is a very simplistic implementation that just breaks the list of partitions down # into even sized chunks. While it could be implemented as a generat...
from kafka.tools.assigner.exceptions import ProgrammingException def split_partitions_into_batches(partitions, batch_size=10, use_class=None): # Currently, this is a very simplistic implementation that just breaks the list of partitions down # into even sized chunks. While it could be implemented as a generat...
Remove used of xrange to support python 3
Remove used of xrange to support python 3
Python
apache-2.0
toddpalino/kafka-tools
from kafka.tools.assigner.exceptions import ProgrammingException def split_partitions_into_batches(partitions, batch_size=10, use_class=None): # Currently, this is a very simplistic implementation that just breaks the list of partitions down # into even sized chunks. While it could be implemented as a generat...
Remove used of xrange to support python 3 from kafka.tools.assigner.exceptions import ProgrammingException def split_partitions_into_batches(partitions, batch_size=10, use_class=None): # Currently, this is a very simplistic implementation that just breaks the list of partitions down # into even sized chunks....
96ace17d9cd800a5649ad32a8cb496a55d73ca9f
wapps/templatetags/wagtail.py
wapps/templatetags/wagtail.py
import jinja2 from django.conf import settings from django_jinja import library from jinja2.ext import Extension from wagtail.wagtailcore.models import Page from wagtail.contrib.wagtailroutablepage.templatetags.wagtailroutablepage_tags import ( routablepageurl as dj_routablepageurl ) from wapps.utils import get_i...
import jinja2 from django.conf import settings from django_jinja import library from jinja2.ext import Extension from wagtail.wagtailcore.models import Page from wagtail.contrib.wagtailroutablepage.templatetags.wagtailroutablepage_tags import ( routablepageurl as dj_routablepageurl ) from wapps.utils import get_i...
Fix is_site_root when no page
Fix is_site_root when no page
Python
mit
apihackers/wapps,apihackers/wapps,apihackers/wapps,apihackers/wapps
import jinja2 from django.conf import settings from django_jinja import library from jinja2.ext import Extension from wagtail.wagtailcore.models import Page from wagtail.contrib.wagtailroutablepage.templatetags.wagtailroutablepage_tags import ( routablepageurl as dj_routablepageurl ) from wapps.utils import get_i...
Fix is_site_root when no page import jinja2 from django.conf import settings from django_jinja import library from jinja2.ext import Extension from wagtail.wagtailcore.models import Page from wagtail.contrib.wagtailroutablepage.templatetags.wagtailroutablepage_tags import ( routablepageurl as dj_routablepageurl )...
6a8295baf32c80ea447d92fd3c7a01a2ad2e0df8
openquake/risklib/__init__.py
openquake/risklib/__init__.py
# coding=utf-8 # Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake Risklib 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. ...
# coding=utf-8 # Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake Risklib 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. ...
Upgrade release number to 0.6.0 (oq-engine 1.3.0)
Upgrade release number to 0.6.0 (oq-engine 1.3.0)
Python
agpl-3.0
g-weatherill/oq-risklib,vup1120/oq-risklib,raoanirudh/oq-risklib,gem/oq-engine,gem/oq-engine,g-weatherill/oq-risklib,gem/oq-engine,gem/oq-engine,raoanirudh/oq-risklib,g-weatherill/oq-risklib,gem/oq-engine,vup1120/oq-risklib
# coding=utf-8 # Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake Risklib 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. ...
Upgrade release number to 0.6.0 (oq-engine 1.3.0) # coding=utf-8 # Copyright (c) 2010-2014, GEM Foundation. # # OpenQuake Risklib 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 # t...
010416fd3888aeae2ab0b50a5d9b02ad23f5cab3
setup.py
setup.py
import sys from setuptools import setup if sys.version_info < (2, 6): raise Exception('Wiggelen requires Python 2.6 or higher.') # Todo: How does this play with pip freeze requirement files? requires = ['nose'] # Python 2.6 does not include the argparse module. try: import argparse except ImportError: re...
import sys from setuptools import setup if sys.version_info < (2, 6): raise Exception('Wiggelen requires Python 2.6 or higher.') # Todo: How does this play with pip freeze requirement files? requires = ['nose'] # Python 2.6 does not include the argparse module. try: import argparse except ImportError: re...
Use README.rst as long description for PyPi
Use README.rst as long description for PyPi
Python
mit
martijnvermaat/wiggelen
import sys from setuptools import setup if sys.version_info < (2, 6): raise Exception('Wiggelen requires Python 2.6 or higher.') # Todo: How does this play with pip freeze requirement files? requires = ['nose'] # Python 2.6 does not include the argparse module. try: import argparse except ImportError: re...
Use README.rst as long description for PyPi import sys from setuptools import setup if sys.version_info < (2, 6): raise Exception('Wiggelen requires Python 2.6 or higher.') # Todo: How does this play with pip freeze requirement files? requires = ['nose'] # Python 2.6 does not include the argparse module. try: ...
a795d94a9c885b97ab5bffc313524ae46626d556
tools/analyze_code_size.py
tools/analyze_code_size.py
import os import re import sys import optparse MARKER_START_FUNCS = "// EMSCRIPTEN_START_FUNCS" MARKER_END_FUNCS = "// EMSCRIPTEN_END_FUNCS" FUNCTION_CODE_RE = re.compile( r"function (?P<name>[a-zA-Z0-9_]+)(?P<defn>.*?)((?=function)|(?=$))" ) def analyze_code_size(fileobj, opts): funcs = {} name_re = Non...
Add simple function-size analysis tool.
Add simple function-size analysis tool.
Python
mit
pypyjs/pypyjs,perkinslr/pypyjs,perkinslr/pypyjs,perkinslr/pypyjs,albertjan/pypyjs,pombredanne/pypyjs,albertjan/pypyjs,perkinslr/pypyjs,pombredanne/pypyjs,pypyjs/pypyjs,trinketapp/pypyjs,pypyjs/pypyjs,pypyjs/pypyjs,perkinslr/pypyjs,trinketapp/pypyjs,albertjan/pypyjs
import os import re import sys import optparse MARKER_START_FUNCS = "// EMSCRIPTEN_START_FUNCS" MARKER_END_FUNCS = "// EMSCRIPTEN_END_FUNCS" FUNCTION_CODE_RE = re.compile( r"function (?P<name>[a-zA-Z0-9_]+)(?P<defn>.*?)((?=function)|(?=$))" ) def analyze_code_size(fileobj, opts): funcs = {} name_re = Non...
Add simple function-size analysis tool.
27f6f1a352ddb72e48550e7d656a3882126d6de6
pythonic_rules.example/upload/__init__.py
pythonic_rules.example/upload/__init__.py
#!/usr/bin/python from config import INTERFACES from built_in_classes import RootHTBClass from .upload import Interactive, TCPACK, SSH, HTTP, Default def apply_qos(): public_if = INTERFACES["public_if"] root_class = RootHTBClass( interface=public_if["name"], rate=public_if["speed"], b...
#!/usr/bin/python from config import INTERFACES from built_in_classes import RootHTBClass from .upload import Interactive, TCPACK, SSH, HTTP, Default def apply_qos(): public_if = INTERFACES["public_if"] root_class = RootHTBClass( interface=public_if["name"], rate=public_if["speed"], b...
Enable all rules in pythonic_rules
Enable all rules in pythonic_rules Has been disabled to avoid errors until the new design was nos finished.
Python
bsd-2-clause
Anthony25/python_tc_qos
#!/usr/bin/python from config import INTERFACES from built_in_classes import RootHTBClass from .upload import Interactive, TCPACK, SSH, HTTP, Default def apply_qos(): public_if = INTERFACES["public_if"] root_class = RootHTBClass( interface=public_if["name"], rate=public_if["speed"], b...
Enable all rules in pythonic_rules Has been disabled to avoid errors until the new design was nos finished. #!/usr/bin/python from config import INTERFACES from built_in_classes import RootHTBClass from .upload import Interactive, TCPACK, SSH, HTTP, Default def apply_qos(): public_if = INTERFACES["public_if"] ...
0515f71d861529262aada1ad416c626277e11d9e
django_excel_to_model/forms.py
django_excel_to_model/forms.py
from django.utils.translation import ugettext_lazy as _ from django import forms from models import ExcelImportTask from django.forms import ModelForm class ExcelFormatTranslateForm(forms.Form): # title = forms.CharField(max_length=50) import_file = forms.FileField( label=_('File to import') ) ...
from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext_lazy as _ from django import forms from models import ExcelImportTask from django.forms import ModelForm class ExcelFormatTranslateForm(forms.Form): # title = forms.CharField(max_length=50) import_file = f...
Sort content for data import.
Sort content for data import.
Python
bsd-3-clause
weijia/django-excel-to-model,weijia/django-excel-to-model
from django.contrib.contenttypes.models import ContentType from django.utils.translation import ugettext_lazy as _ from django import forms from models import ExcelImportTask from django.forms import ModelForm class ExcelFormatTranslateForm(forms.Form): # title = forms.CharField(max_length=50) import_file = f...
Sort content for data import. from django.utils.translation import ugettext_lazy as _ from django import forms from models import ExcelImportTask from django.forms import ModelForm class ExcelFormatTranslateForm(forms.Form): # title = forms.CharField(max_length=50) import_file = forms.FileField( labe...
28478db4b317e35ecbb63e5c2b1f4a7724b256d9
della/inbox/urls.py
della/inbox/urls.py
from django.conf.urls import url from .views import MessageCreateView, ThreadDetailView, ThreadListView urlpatterns = [ url(r'^(?P<recipient>[a-zA-Z0-9_]+)/$', ThreadDetailView.as_view(), name='thread-detail'), url(r'^(?P<pk>\d+)/new/$', MessageCreateView.as_view(), name='new-message'), ur...
from django.conf.urls import url from .views import MessageCreateView, ThreadDetailView, ThreadListView urlpatterns = [ url(r'^@(?P<recipient>[a-zA-Z0-9_]+)/$', ThreadDetailView.as_view(), name='thread-detail'), url(r'^(?P<pk>\d+)/new/$', MessageCreateView.as_view(), name='new-message'), u...
Use `@` in message thread
Use `@` in message thread
Python
mit
avinassh/della,avinassh/della,avinassh/della
from django.conf.urls import url from .views import MessageCreateView, ThreadDetailView, ThreadListView urlpatterns = [ url(r'^@(?P<recipient>[a-zA-Z0-9_]+)/$', ThreadDetailView.as_view(), name='thread-detail'), url(r'^(?P<pk>\d+)/new/$', MessageCreateView.as_view(), name='new-message'), u...
Use `@` in message thread from django.conf.urls import url from .views import MessageCreateView, ThreadDetailView, ThreadListView urlpatterns = [ url(r'^(?P<recipient>[a-zA-Z0-9_]+)/$', ThreadDetailView.as_view(), name='thread-detail'), url(r'^(?P<pk>\d+)/new/$', MessageCreateView.as_view(), ...
dbc09d03f62bf2d5ee1661492a4c20a7942f81a9
tests/basics/list_slice.py
tests/basics/list_slice.py
# test slices; only 2 argument version supported by Micro Python at the moment x = list(range(10)) a = 2 b = 4 c = 3 print(x[:]) print(x[::]) #print(x[::c]) print(x[:b]) print(x[:b:]) #print(x[:b:c]) print(x[a]) print(x[a:]) print(x[a::]) #print(x[a::c]) print(x[a:b]) print(x[a:b:]) #print(x[a:b:c]) # these should not...
# test list slices, getting values x = list(range(10)) a = 2 b = 4 c = 3 print(x[:]) print(x[::]) print(x[::c]) print(x[:b]) print(x[:b:]) print(x[:b:c]) print(x[a]) print(x[a:]) print(x[a::]) print(x[a::c]) print(x[a:b]) print(x[a:b:]) print(x[a:b:c]) # these should not raise IndexError print([][1:]) print([][-1:]) ...
Enable tests for list slice getting with 3rd arg.
tests/basics: Enable tests for list slice getting with 3rd arg. Also add a test to check case when 3rd arg is 0.
Python
mit
tuc-osg/micropython,mhoffma/micropython,trezor/micropython,blazewicz/micropython,AriZuu/micropython,kerneltask/micropython,swegener/micropython,MrSurly/micropython,mhoffma/micropython,hiway/micropython,alex-robbins/micropython,henriknelson/micropython,tuc-osg/micropython,adafruit/micropython,selste/micropython,ryannath...
# test list slices, getting values x = list(range(10)) a = 2 b = 4 c = 3 print(x[:]) print(x[::]) print(x[::c]) print(x[:b]) print(x[:b:]) print(x[:b:c]) print(x[a]) print(x[a:]) print(x[a::]) print(x[a::c]) print(x[a:b]) print(x[a:b:]) print(x[a:b:c]) # these should not raise IndexError print([][1:]) print([][-1:]) ...
tests/basics: Enable tests for list slice getting with 3rd arg. Also add a test to check case when 3rd arg is 0. # test slices; only 2 argument version supported by Micro Python at the moment x = list(range(10)) a = 2 b = 4 c = 3 print(x[:]) print(x[::]) #print(x[::c]) print(x[:b]) print(x[:b:]) #print(x[:b:c]) print...
e61e633e122953774ee4246ad61b23d9b7d264f3
semillas_backend/users/serializers.py
semillas_backend/users/serializers.py
from rest_framework import serializers from .models import User class UserSerializer(serializers.ModelSerializer): """ Usage: from rest_framework.renderers import JSONRenderer from semillas_backend.users.serializers import UserSerializer JSONRenderer().render(UserSerializer(user_instanc...
from rest_framework import serializers from .models import User class UserSerializer(serializers.ModelSerializer): """ Usage: from rest_framework.renderers import JSONRenderer from semillas_backend.users.serializers import UserSerializer JSONRenderer().render(UserSerializer(user_instance...
Add location, email, username and last_login to user serializer
Add location, email, username and last_login to user serializer
Python
mit
Semillas/semillas_backend,Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_platform,Semillas/semillas_platform,Semillas/semillas_backend
from rest_framework import serializers from .models import User class UserSerializer(serializers.ModelSerializer): """ Usage: from rest_framework.renderers import JSONRenderer from semillas_backend.users.serializers import UserSerializer JSONRenderer().render(UserSerializer(user_instance...
Add location, email, username and last_login to user serializer from rest_framework import serializers from .models import User class UserSerializer(serializers.ModelSerializer): """ Usage: from rest_framework.renderers import JSONRenderer from semillas_backend.users.serializers import UserSeria...
8a7fd251454026baf3cf7a0a1aa0300a0f3772bc
pycanvas/assignment.py
pycanvas/assignment.py
from canvas_object import CanvasObject from util import combine_kwargs class Assignment(CanvasObject): def __str__(self): # pragma: no cover return "{} ({})".format(self.name, self.id) def delete(self): """ Delete this assignment. :calls: `DELETE /api/v1/courses/:course_id/...
from canvas_object import CanvasObject from util import combine_kwargs class Assignment(CanvasObject): def __str__(self): return "{} ({})".format(self.name, self.id) def delete(self): """ Delete this assignment. :calls: `DELETE /api/v1/courses/:course_id/assignments/:id \ ...
Remove no-cover from __str__ method
Remove no-cover from __str__ method
Python
mit
ucfopen/canvasapi,ucfopen/canvasapi,ucfopen/canvasapi
from canvas_object import CanvasObject from util import combine_kwargs class Assignment(CanvasObject): def __str__(self): return "{} ({})".format(self.name, self.id) def delete(self): """ Delete this assignment. :calls: `DELETE /api/v1/courses/:course_id/assignments/:id \ ...
Remove no-cover from __str__ method from canvas_object import CanvasObject from util import combine_kwargs class Assignment(CanvasObject): def __str__(self): # pragma: no cover return "{} ({})".format(self.name, self.id) def delete(self): """ Delete this assignment. :calls...
5fbf5bac84a7ededde99e109d206681af99c112c
sort/bubble_sort_optimized/python/bubble_sort_optimized.py
sort/bubble_sort_optimized/python/bubble_sort_optimized.py
class Solution: def bubbleSortOptimized(self, nums: List[int]) -> None: if len(nums) == 1: return nums else: swapped = False while not swapped: swapped = True for i in range(0, len(nums)-1): if nums[i] > nums[i+1...
class Solution: def bubbleSortOptimized(self, nums): if len(nums) == 1: return nums else: swapped = False while not swapped: swapped = True for i in range(0, len(nums)-1): if nums[i] > nums[i+1]: ...
Add dijkstras algorithm and depth first search in python
Add dijkstras algorithm and depth first search in python
Python
cc0-1.0
ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs...
class Solution: def bubbleSortOptimized(self, nums): if len(nums) == 1: return nums else: swapped = False while not swapped: swapped = True for i in range(0, len(nums)-1): if nums[i] > nums[i+1]: ...
Add dijkstras algorithm and depth first search in python class Solution: def bubbleSortOptimized(self, nums: List[int]) -> None: if len(nums) == 1: return nums else: swapped = False while not swapped: swapped = True for i in range(...
0c913d4bf94637da916b609b1b1d0d34b03776b7
tests/test_logger.py
tests/test_logger.py
import pytest from mugloar import dragon, logger @pytest.fixture def log_instance(): """Returns a Logger instance""" return logger.Logger() @pytest.fixture def knight(): return {'agility': 8, 'endurance': 8, 'armor': 0, 'attack': 4} @pytest.fixture def dragon_instance(): return dragon.Dragon() @...
import pytest from mugloar import dragon, logger @pytest.fixture def log_instance(): """Returns a Logger instance""" return logger.Logger() @pytest.fixture def knight(): return [('endurance', 8), ('attack', 8), ('armor', 0), ('agility', 4)] @pytest.fixture def dragon_instance(): return dragon.Drag...
Implement rudimentary unit tests for logger class
Implement rudimentary unit tests for logger class
Python
mit
reinikai/mugloar
import pytest from mugloar import dragon, logger @pytest.fixture def log_instance(): """Returns a Logger instance""" return logger.Logger() @pytest.fixture def knight(): return [('endurance', 8), ('attack', 8), ('armor', 0), ('agility', 4)] @pytest.fixture def dragon_instance(): return dragon.Drag...
Implement rudimentary unit tests for logger class import pytest from mugloar import dragon, logger @pytest.fixture def log_instance(): """Returns a Logger instance""" return logger.Logger() @pytest.fixture def knight(): return {'agility': 8, 'endurance': 8, 'armor': 0, 'attack': 4} @pytest.fixture de...
abbae774903165f19d144905ad77553ec913c78d
saves.py
saves.py
import os import json from serializable import Serializable class Saves: #Only partially implemembted- only works for PlayerCharacters #Because we want the user to be able to play on whatever world they want with whatever character #they want, characters have to be stored independently of everything else #We nee...
import os import json from serializable import Serializable class Saves: #Only partially implemembted- only works for PlayerCharacters #Because we want the user to be able to play on whatever world they want with whatever character #they want, characters have to be stored independently of everything else #We nee...
Fix for non-existent character folder bug
Fix for non-existent character folder bug
Python
mit
benjamincongdon/adept
import os import json from serializable import Serializable class Saves: #Only partially implemembted- only works for PlayerCharacters #Because we want the user to be able to play on whatever world they want with whatever character #they want, characters have to be stored independently of everything else #We nee...
Fix for non-existent character folder bug import os import json from serializable import Serializable class Saves: #Only partially implemembted- only works for PlayerCharacters #Because we want the user to be able to play on whatever world they want with whatever character #they want, characters have to be store...
2b58a34a6bde9c7db39fc436928e344284de633b
app/DataLogger/sqlite_logger.py
app/DataLogger/sqlite_logger.py
import sqlite3 import time class SQLiteLogger: def __init__(self, filename="g2x.db"): self.filename = filename self.connection = None def __enter__(self): try: with open(self.filename): self.connection = sqlite3.connect(self.filename) except IOError...
import sqlite3 import time class SQLiteLogger: def __init__(self, filename="g2x.db"): self.filename = filename self.connection = None def __enter__(self): self.open() return self def __exit__(self, type, value, traceback): self.close() def open(self): ...
Allow logger to be opened and closed directly
Allow logger to be opened and closed directly
Python
mit
gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x,gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x
import sqlite3 import time class SQLiteLogger: def __init__(self, filename="g2x.db"): self.filename = filename self.connection = None def __enter__(self): self.open() return self def __exit__(self, type, value, traceback): self.close() def open(self): ...
Allow logger to be opened and closed directly import sqlite3 import time class SQLiteLogger: def __init__(self, filename="g2x.db"): self.filename = filename self.connection = None def __enter__(self): try: with open(self.filename): self.connection = sqlite...
78bbb6cbf145ee7d78c41f39b4f078d986265232
comics/comics/pennyarcade.py
comics/comics/pennyarcade.py
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "Penny Arcade" language = "en" url = "http://penny-arcade.com/" start_date = "1998-11-18" rights = "Mike Krahulik & Jerry Holkins" class Crawler...
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "Penny Arcade" language = "en" url = "http://penny-arcade.com/" start_date = "1998-11-18" rights = "Mike Krahulik & Jerry Holkins" class Crawler...
Check "Penny Arcade" for 404 page without 404 header
Check "Penny Arcade" for 404 page without 404 header
Python
agpl-3.0
jodal/comics,jodal/comics,datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics,datagutten/comics,jodal/comics
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "Penny Arcade" language = "en" url = "http://penny-arcade.com/" start_date = "1998-11-18" rights = "Mike Krahulik & Jerry Holkins" class Crawler...
Check "Penny Arcade" for 404 page without 404 header from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = "Penny Arcade" language = "en" url = "http://penny-arcade.com/" start_date = "1998-11-18" ri...
480c89d81e1610d698269c41f4543c38193bef13
test/test_orthomcl_database.py
test/test_orthomcl_database.py
import shutil import tempfile import unittest import orthomcl_database class Test(unittest.TestCase): def setUp(self): self.run_dir = tempfile.mkdtemp() def tearDown(self): shutil.rmtree(self.run_dir) def test_get_configuration_file(self): conffile = orthomcl_database.get_confi...
import MySQLdb import shutil import tempfile import unittest import orthomcl_database class Test(unittest.TestCase): def setUp(self): self.run_dir = tempfile.mkdtemp() self.credentials = orthomcl_database._get_root_credentials() def tearDown(self): shutil.rmtree(self.run_dir) d...
Expand test to include query on the created database as restricted user
Expand test to include query on the created database as restricted user
Python
mit
ODoSE/odose.nl
import MySQLdb import shutil import tempfile import unittest import orthomcl_database class Test(unittest.TestCase): def setUp(self): self.run_dir = tempfile.mkdtemp() self.credentials = orthomcl_database._get_root_credentials() def tearDown(self): shutil.rmtree(self.run_dir) d...
Expand test to include query on the created database as restricted user import shutil import tempfile import unittest import orthomcl_database class Test(unittest.TestCase): def setUp(self): self.run_dir = tempfile.mkdtemp() def tearDown(self): shutil.rmtree(self.run_dir) def test_get_...
644a25e2b61bec8847af2f6d64b9b41b8798092d
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages VERSION = '0.4.2' def readme(): with open('README.rst') as f: return f.read() setup( name='django-backupdb', version=VERSION, description='Management commands for backing up and restoring databases in Django.', long_des...
#!/usr/bin/env python from setuptools import setup, find_packages VERSION = '0.4.2' def readme(): with open('README.rst') as f: return f.read() setup( name='django-backupdb', version=VERSION, description='Management commands for backing up and restoring databases in Django.', long_des...
Add coverage as a testing requirement
Add coverage as a testing requirement
Python
bsd-2-clause
fusionbox/django-backupdb
#!/usr/bin/env python from setuptools import setup, find_packages VERSION = '0.4.2' def readme(): with open('README.rst') as f: return f.read() setup( name='django-backupdb', version=VERSION, description='Management commands for backing up and restoring databases in Django.', long_des...
Add coverage as a testing requirement #!/usr/bin/env python from setuptools import setup, find_packages VERSION = '0.4.2' def readme(): with open('README.rst') as f: return f.read() setup( name='django-backupdb', version=VERSION, description='Management commands for backing up and restor...
1a761c9360f185d6bd07be9f16ea2cfa239f4bdd
groupy/api/base.py
groupy/api/base.py
from groupy import utils class Manager: """Class for interacting with the endpoint for a resource. :param session: the requests session :type session: :class:`~groupy.session.Session` :param str path: path relative to the base URL """ #: the base URL base_url = 'https://api.groupme.com/v...
from groupy import utils class Manager: """Class for interacting with the endpoint for a resource. :param session: the requests session :type session: :class:`~groupy.session.Session` :param str path: path relative to the base URL """ #: the base URL base_url = 'https://api.groupme.com/v...
Fix pickling/unpickling of Resource objects
Fix pickling/unpickling of Resource objects Add __getstate__ and __setstate__ methods to the Resource class to avoid hitting the recursion limit when trying to pickle/unpickle Resource objects. A similar issue/solution can be found here: https://stackoverflow.com/a/12102691
Python
apache-2.0
rhgrant10/Groupy
from groupy import utils class Manager: """Class for interacting with the endpoint for a resource. :param session: the requests session :type session: :class:`~groupy.session.Session` :param str path: path relative to the base URL """ #: the base URL base_url = 'https://api.groupme.com/v...
Fix pickling/unpickling of Resource objects Add __getstate__ and __setstate__ methods to the Resource class to avoid hitting the recursion limit when trying to pickle/unpickle Resource objects. A similar issue/solution can be found here: https://stackoverflow.com/a/12102691 from groupy import utils class Manager: ...
6049a916ea3adfe4ef8a7ae9dbfc918b69907ef4
OnionLauncher/main.py
OnionLauncher/main.py
import sys from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5.uic import loadUi class MainWindow(QMainWindow): def __init__(self, *args): super(MainWindow, self).__init__(*args) loadUi("ui_files/main.ui", self) self.tbAdd.clicked.connect(self.addRow) self.tbRemove.clicked.connect(self.removeRo...
import sys from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5.uic import loadUi class MainWindow(QMainWindow): def __init__(self, *args): super(MainWindow, self).__init__(*args) loadUi("ui_files/main.ui", self) buttons = { self.tbAdd: self.addRow, self.tbRemove: self.removeRow, self.btn...
Put mouse clicks in it's own dictionary
Put mouse clicks in it's own dictionary
Python
bsd-2-clause
neelchauhan/OnionLauncher
import sys from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5.uic import loadUi class MainWindow(QMainWindow): def __init__(self, *args): super(MainWindow, self).__init__(*args) loadUi("ui_files/main.ui", self) buttons = { self.tbAdd: self.addRow, self.tbRemove: self.removeRow, self.btn...
Put mouse clicks in it's own dictionary import sys from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5.uic import loadUi class MainWindow(QMainWindow): def __init__(self, *args): super(MainWindow, self).__init__(*args) loadUi("ui_files/main.ui", self) self.tbAdd.clicked.connect(self.addRow) se...
1889e03c139e0fb66d4241aa10b29345ef3bde5b
python_src/SerialUDPBridge.py
python_src/SerialUDPBridge.py
import serial #Serial port API http://pyserial.sourceforge.net/pyserial_api.html import socket import time from threading import Thread def recvUDP(sock,SerialIOArduino): while True: data, addr = sock.recvfrom(1280) # Max recieve size is 1280 bytes print "UDP received message:", data.strip() ...
Send the messages from the serial port as UDP messages to port 9050 Recieves UDP messages on port 9050 and sends them over the serial line
Send the messages from the serial port as UDP messages to port 9050 Recieves UDP messages on port 9050 and sends them over the serial line
Python
mit
rlangoy/socLabWeek43
import serial #Serial port API http://pyserial.sourceforge.net/pyserial_api.html import socket import time from threading import Thread def recvUDP(sock,SerialIOArduino): while True: data, addr = sock.recvfrom(1280) # Max recieve size is 1280 bytes print "UDP received message:", data.strip() ...
Send the messages from the serial port as UDP messages to port 9050 Recieves UDP messages on port 9050 and sends them over the serial line
e1d09aad308aabd76f2be808806c5ed024f31d14
dartcms/apps/modules/migrations/0004_insert_modules.py
dartcms/apps/modules/migrations/0004_insert_modules.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-20 02:26 from __future__ import unicode_literals from django.db import migrations from dartcms.apps.modules.models import Module, ModuleGroup MODULE_GROUPS = [ { 'sort': 4, 'description': '', 'fa': 'fa-rocket', 'slug':...
Add migration for Ads modules
Add migration for Ads modules
Python
mit
astrikov-d/dartcms,astrikov-d/dartcms,astrikov-d/dartcms
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-20 02:26 from __future__ import unicode_literals from django.db import migrations from dartcms.apps.modules.models import Module, ModuleGroup MODULE_GROUPS = [ { 'sort': 4, 'description': '', 'fa': 'fa-rocket', 'slug':...
Add migration for Ads modules
12c1ee81843e3e163756a39b68671cf5c1842df2
scrapi/harvesters/mason_archival.py
scrapi/harvesters/mason_archival.py
""" Harvester for Mason Archival Repository Service for the SHARE NS """ from __future__ import unicode_literals from scrapi.base import OAIHarvester class MasonArchival(OAIHarvester): short_name = 'mason' long_name = 'Mason Archival Repository Service' url = 'http://mars.gmu.edu/' base_url = 'http:...
""" Harvester for Mason Archival Repository Service for the SHARE NS """ from __future__ import unicode_literals from scrapi.base import OAIHarvester class MasonArchival(OAIHarvester): short_name = 'mason' long_name = 'Mason Archival Repository Service' url = 'http://mars.gmu.edu/' base_url = 'http:...
Add approved set to gmu
Add approved set to gmu
Python
apache-2.0
CenterForOpenScience/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,erinspace/scrapi,erinspace/scrapi
""" Harvester for Mason Archival Repository Service for the SHARE NS """ from __future__ import unicode_literals from scrapi.base import OAIHarvester class MasonArchival(OAIHarvester): short_name = 'mason' long_name = 'Mason Archival Repository Service' url = 'http://mars.gmu.edu/' base_url = 'http:...
Add approved set to gmu """ Harvester for Mason Archival Repository Service for the SHARE NS """ from __future__ import unicode_literals from scrapi.base import OAIHarvester class MasonArchival(OAIHarvester): short_name = 'mason' long_name = 'Mason Archival Repository Service' url = 'http://mars.gmu.edu...
c6b8ff0f5c8b67dd6d48ccfe8c82b98d33b979a6
openfisca_web_api/scripts/serve.py
openfisca_web_api/scripts/serve.py
# -*- coding: utf-8 -*- import os import sys from logging.config import fileConfig from wsgiref.simple_server import make_server from paste.deploy import loadapp hostname = 'localhost' port = 2000 def main(): conf_file_path = os.path.join(sys.prefix, 'share', 'openfisca', 'openfisca-web-api', 'development-fr...
# -*- coding: utf-8 -*- import os import sys from logging.config import fileConfig from wsgiref.simple_server import make_server from paste.deploy import loadapp hostname = 'localhost' port = 2000 def main(): conf_file_path = os.path.join(sys.prefix, 'share', 'openfisca', 'openfisca-web-api', 'development-fr...
Manage case where api installed with --editable
Manage case where api installed with --editable
Python
agpl-3.0
openfisca/openfisca-web-api,openfisca/openfisca-web-api
# -*- coding: utf-8 -*- import os import sys from logging.config import fileConfig from wsgiref.simple_server import make_server from paste.deploy import loadapp hostname = 'localhost' port = 2000 def main(): conf_file_path = os.path.join(sys.prefix, 'share', 'openfisca', 'openfisca-web-api', 'development-fr...
Manage case where api installed with --editable # -*- coding: utf-8 -*- import os import sys from logging.config import fileConfig from wsgiref.simple_server import make_server from paste.deploy import loadapp hostname = 'localhost' port = 2000 def main(): conf_file_path = os.path.join(sys.prefix, 'share', ...
9eafbdc888d29c19c930c69366b1d3ad431dde73
street_score/project/resources.py
street_score/project/resources.py
from djangorestframework import views from djangorestframework import resources from . import models class RatingResource (resources.ModelResource): model = models.Rating class RatingInstanceView (views.InstanceModelView): resource = RatingResource class RatingListView (views.ListOrCreateModelView): reso...
from djangorestframework import views from djangorestframework import resources from . import models class RatingResource (resources.ModelResource): model = models.Rating class RatingInstanceView (views.InstanceModelView): resource = RatingResource class RatingListView (views.ListOrCreateModelView): reso...
Add a function for questions to the survey resource
Add a function for questions to the survey resource
Python
mit
openplans/streetscore,openplans/streetscore,openplans/streetscore
from djangorestframework import views from djangorestframework import resources from . import models class RatingResource (resources.ModelResource): model = models.Rating class RatingInstanceView (views.InstanceModelView): resource = RatingResource class RatingListView (views.ListOrCreateModelView): reso...
Add a function for questions to the survey resource from djangorestframework import views from djangorestframework import resources from . import models class RatingResource (resources.ModelResource): model = models.Rating class RatingInstanceView (views.InstanceModelView): resource = RatingResource class R...
666b7b3597b857a3bfc99916354c6fc5bd15d68b
scripts/generate-user-email-list.py
scripts/generate-user-email-list.py
""" Usage: scripts/generate-user-email-list.py <data_api_url> <data_api_token> """ import csv import sys from docopt import docopt from dmutils.apiclient import DataAPIClient def generate_user_email_list(data_api_url, data_api_token): client = DataAPIClient(data_api_url, data_api_token) writer = csv.wr...
""" Usage: scripts/generate-user-email-list.py <data_api_url> <data_api_token> """ import csv import sys from docopt import docopt from dmutils.apiclient import DataAPIClient def generate_user_email_list(data_api_url, data_api_token): client = DataAPIClient(data_api_url, data_api_token) writer = csv.wr...
Fix typo in role check
Fix typo in role check
Python
mit
alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api
""" Usage: scripts/generate-user-email-list.py <data_api_url> <data_api_token> """ import csv import sys from docopt import docopt from dmutils.apiclient import DataAPIClient def generate_user_email_list(data_api_url, data_api_token): client = DataAPIClient(data_api_url, data_api_token) writer = csv.wr...
Fix typo in role check """ Usage: scripts/generate-user-email-list.py <data_api_url> <data_api_token> """ import csv import sys from docopt import docopt from dmutils.apiclient import DataAPIClient def generate_user_email_list(data_api_url, data_api_token): client = DataAPIClient(data_api_url, data_api_tok...
1655edcd359e810b10f7836dc2cbb3f99014d8f6
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup, Extension packages=['qutepart', 'qutepart/syntax'] package_data={'qutepart/syntax' : ['data/*.xml', 'data/syntax_db.json'] } extension = Extension('qutepart.syntax.cParser', sources = ['qute...
#!/usr/bin/env python import sys from distutils.core import setup, Extension import distutils.ccompiler packages=['qutepart', 'qutepart/syntax'] package_data={'qutepart/syntax' : ['data/*.xml', 'data/syntax_db.json'] } extension = Extension('qutepart.syntax.cParser',...
Check for pcre when building
Check for pcre when building
Python
lgpl-2.1
Aldenis2112/qutepart,Aldenis2112/qutepart,andreikop/qutepart,hlamer/qutepart,hlamer/qutepart,andreikop/qutepart,andreikop/qutepart,Aldenis2112/qutepart,hlamer/qutepart,hlamer/qutepart,Aldenis2112/qutepart,Aldenis2112/qutepart,hlamer/qutepart,andreikop/qutepart,hlamer/qutepart,andreikop/qutepart,Aldenis2112/qutepart,and...
#!/usr/bin/env python import sys from distutils.core import setup, Extension import distutils.ccompiler packages=['qutepart', 'qutepart/syntax'] package_data={'qutepart/syntax' : ['data/*.xml', 'data/syntax_db.json'] } extension = Extension('qutepart.syntax.cParser',...
Check for pcre when building #!/usr/bin/env python from distutils.core import setup, Extension packages=['qutepart', 'qutepart/syntax'] package_data={'qutepart/syntax' : ['data/*.xml', 'data/syntax_db.json'] } extension = Extension('qutepart.syntax.cParser', ...
e2e4b0b10dcc0cd98b0e87e63db073dd2f27882f
setup.py
setup.py
#!/usr/bin/env python # Author: Aziz Alto # email: iamaziz.alto@gmail.com try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='pydataset', description=("Provides instant access to many popular datasets right from " "Python (in dataframe...
#!/usr/bin/env python # Author: Aziz Alto # email: iamaziz.alto@gmail.com try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='pydataset', description=("Provides instant access to many popular datasets right from " "Python (in dataframe...
Add download URL for PyPI
Add download URL for PyPI
Python
mit
iamaziz/PyDataset
#!/usr/bin/env python # Author: Aziz Alto # email: iamaziz.alto@gmail.com try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='pydataset', description=("Provides instant access to many popular datasets right from " "Python (in dataframe...
Add download URL for PyPI #!/usr/bin/env python # Author: Aziz Alto # email: iamaziz.alto@gmail.com try: from setuptools import setup except ImportError: from distutils.core import setup setup( name='pydataset', description=("Provides instant access to many popular datasets right from " ...
4a41b33286cf881f0b3aa09c29a4aaa3568b5259
website/stats/plots/mimp.py
website/stats/plots/mimp.py
from analyses.mimp import glycosylation_sub_types, run_mimp from helpers.plots import stacked_bar_plot from ..store import counter @counter @stacked_bar_plot def gains_and_losses_for_glycosylation_subtypes(): results = {} effects = 'loss', 'gain' for source_name in ['mc3', 'clinvar']: for site_ty...
from analyses.mimp import glycosylation_sub_types, run_mimp from helpers.plots import stacked_bar_plot from ..store import counter @counter @stacked_bar_plot def gains_and_losses_for_glycosylation_subtypes(): results = {} effects = 'loss', 'gain' for source_name in ['mc3', 'clinvar']: for site_ty...
Convert numpy int to native int for JSON serialization
Convert numpy int to native int for JSON serialization
Python
lgpl-2.1
reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualis...
from analyses.mimp import glycosylation_sub_types, run_mimp from helpers.plots import stacked_bar_plot from ..store import counter @counter @stacked_bar_plot def gains_and_losses_for_glycosylation_subtypes(): results = {} effects = 'loss', 'gain' for source_name in ['mc3', 'clinvar']: for site_ty...
Convert numpy int to native int for JSON serialization from analyses.mimp import glycosylation_sub_types, run_mimp from helpers.plots import stacked_bar_plot from ..store import counter @counter @stacked_bar_plot def gains_and_losses_for_glycosylation_subtypes(): results = {} effects = 'loss', 'gain' fo...
32789be8f1f98f7538f4452a8118c261037f2d75
tempwatcher/watch.py
tempwatcher/watch.py
import json import requests class TemperatureWatch(object): thermostat_url = None alert_high = 80 alert_low = 60 _last_response = None def get_info(self): r = requests.get(self.thermostat_url + '/tstat') self._last_response = json.loads(r.text) return r.text def check...
import json import requests class TemperatureWatch(object): thermostat_url = None alert_high = 80 alert_low = 60 _last_response = None def get_info(self): r = requests.get(self.thermostat_url + '/tstat') self._last_response = json.loads(r.text) return r.text def check...
Refactor the initialization a bit to make configuration easier.
Refactor the initialization a bit to make configuration easier.
Python
bsd-3-clause
adamfast/tempwatcher
import json import requests class TemperatureWatch(object): thermostat_url = None alert_high = 80 alert_low = 60 _last_response = None def get_info(self): r = requests.get(self.thermostat_url + '/tstat') self._last_response = json.loads(r.text) return r.text def check...
Refactor the initialization a bit to make configuration easier. import json import requests class TemperatureWatch(object): thermostat_url = None alert_high = 80 alert_low = 60 _last_response = None def get_info(self): r = requests.get(self.thermostat_url + '/tstat') self._last_r...
373b0210483839b7ac5b4fd8eb0bcfdfe8d63d83
begood_sites/fields.py
begood_sites/fields.py
from django.db import models from django.contrib.sites.models import Site class MultiSiteField(models.ManyToManyField): def __init__(self, **kwargs): defaults = { 'blank': False, } defaults.update(kwargs) super(MultiSiteField, self).__init__(Site, **defaults) class SingleSiteField(mod...
from django.db import models from django.contrib.sites.models import Site class MultiSiteField(models.ManyToManyField): def __init__(self, **kwargs): defaults = { 'blank': False, } defaults.update(kwargs) if 'to' in defaults: del defaults['to'] super(MultiSiteField, self).__in...
Fix problem with South migrations.
Fix problem with South migrations.
Python
mit
AGoodId/begood-sites
from django.db import models from django.contrib.sites.models import Site class MultiSiteField(models.ManyToManyField): def __init__(self, **kwargs): defaults = { 'blank': False, } defaults.update(kwargs) if 'to' in defaults: del defaults['to'] super(MultiSiteField, self).__in...
Fix problem with South migrations. from django.db import models from django.contrib.sites.models import Site class MultiSiteField(models.ManyToManyField): def __init__(self, **kwargs): defaults = { 'blank': False, } defaults.update(kwargs) super(MultiSiteField, self).__init__(Site, **d...
ccc98ced56ee8dda02332720c7146e1548a3b53c
project/project/urls.py
project/project/urls.py
""" project URL Configuration """ from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^admin_tools/', include('admin_tools.urls')), url(r'^accounts/logout/$', 'allauth.account.views.logout', name='account_logout'), ...
""" project URL Configuration """ from django.conf.urls import include, url from django.conf import settings from django.contrib import admin from django.views.generic.base import RedirectView urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^admin_tools/', include('admin_tools.urls')), ...
Set up redirect to login view
Set up redirect to login view
Python
mit
jonsimington/app,compsci-hfh/app,compsci-hfh/app,jonsimington/app
""" project URL Configuration """ from django.conf.urls import include, url from django.conf import settings from django.contrib import admin from django.views.generic.base import RedirectView urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^admin_tools/', include('admin_tools.urls')), ...
Set up redirect to login view """ project URL Configuration """ from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^admin_tools/', include('admin_tools.urls')), url(r'^accounts/logout/$', 'allauth.account.views.logo...
e3b5e23566830ab20a7e0358e1040e7a6a889b22
podoc/conftest.py
podoc/conftest.py
# -*- coding: utf-8 -*- """py.test utilities.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import logging from tempfile import TemporaryDirectory from pytest import yield_fixture from pod...
# -*- coding: utf-8 -*- """py.test utilities.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import logging from tempfile import TemporaryDirectory from pytest import yield_fixture from pod...
Set the name of the dynamic plugin conversion tests
Set the name of the dynamic plugin conversion tests
Python
bsd-3-clause
rossant/podoc,podoc/podoc,rossant/podoc,podoc/podoc
# -*- coding: utf-8 -*- """py.test utilities.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import logging from tempfile import TemporaryDirectory from pytest import yield_fixture from pod...
Set the name of the dynamic plugin conversion tests # -*- coding: utf-8 -*- """py.test utilities.""" #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ import logging from tempfile import Temporary...
2438efb99b85fbc76cd285792c1511e7e2813a05
zeus/api/resources/repository_tests.py
zeus/api/resources/repository_tests.py
from datetime import timedelta from sqlalchemy.sql import func from zeus.config import db from zeus.constants import Result, Status from zeus.models import Repository, TestCase, Job from zeus.utils import timezone from .base_repository import BaseRepositoryResource from ..schemas import TestCaseStatisticsSchema test...
from datetime import timedelta from sqlalchemy.sql import func from zeus.config import db from zeus.constants import Result, Status from zeus.models import Repository, TestCase, Job from zeus.utils import timezone from .base_repository import BaseRepositoryResource from ..schemas import TestCaseStatisticsSchema test...
Simplify query plan for repo tests
ref: Simplify query plan for repo tests
Python
apache-2.0
getsentry/zeus,getsentry/zeus,getsentry/zeus,getsentry/zeus
from datetime import timedelta from sqlalchemy.sql import func from zeus.config import db from zeus.constants import Result, Status from zeus.models import Repository, TestCase, Job from zeus.utils import timezone from .base_repository import BaseRepositoryResource from ..schemas import TestCaseStatisticsSchema test...
ref: Simplify query plan for repo tests from datetime import timedelta from sqlalchemy.sql import func from zeus.config import db from zeus.constants import Result, Status from zeus.models import Repository, TestCase, Job from zeus.utils import timezone from .base_repository import BaseRepositoryResource from ..sche...
276f22927890051f66976468585d8351c0ccf5b9
sum-of-multiples/sum_of_multiples.py
sum-of-multiples/sum_of_multiples.py
def sum_of_multiples(limit, factors): return sum(filter(lambda n: n < limit, {f*i for i in range(1, limit) for f in factors}))
def sum_of_multiples(limit, factors): return sum({n for f in factors for n in range(f, limit, f)})
Use more optimal method of getting multiples
Use more optimal method of getting multiples
Python
agpl-3.0
CubicComet/exercism-python-solutions
def sum_of_multiples(limit, factors): return sum({n for f in factors for n in range(f, limit, f)})
Use more optimal method of getting multiples def sum_of_multiples(limit, factors): return sum(filter(lambda n: n < limit, {f*i for i in range(1, limit) for f in factors}))
9cfc5c5acf568b56f4f150e3040827e5856b52c2
insertion_sort.py
insertion_sort.py
def insertion_sort(un_list): for idx in range(1, len(un_list)): current = un_list[idx] position = idx while position > 0 and un_list[position-1] > current: un_list[position] = un_list[position-1] position = position - 1 un_list[position] = current if __name...
def insertion_sort(un_list): for idx in range(1, len(un_list)): current = un_list[idx] position = idx while position > 0 and un_list[position-1] > current: un_list[position] = un_list[position-1] position = position - 1 un_list[position] = current if __name...
Update module with timeit testing for best and worst case scenarios.
Update module with timeit testing for best and worst case scenarios.
Python
mit
jonathanstallings/data-structures
def insertion_sort(un_list): for idx in range(1, len(un_list)): current = un_list[idx] position = idx while position > 0 and un_list[position-1] > current: un_list[position] = un_list[position-1] position = position - 1 un_list[position] = current if __name...
Update module with timeit testing for best and worst case scenarios. def insertion_sort(un_list): for idx in range(1, len(un_list)): current = un_list[idx] position = idx while position > 0 and un_list[position-1] > current: un_list[position] = un_list[position-1] p...
97e244878215a802a4f70967cc984f3763be5a30
setup.py
setup.py
#!/usr/bin/env python from setuptools import setup, find_packages from pupa import __version__ long_description = '' setup(name='pupa', version=__version__, packages=find_packages(), author='James Turk', author_email='jturk@sunlightfoundation.com', license='BSD', url='http://github...
#!/usr/bin/env python from setuptools import setup, find_packages from pupa import __version__ long_description = '' setup(name='pupa', version=__version__, packages=find_packages(), author='James Turk', author_email='jturk@sunlightfoundation.com', license='BSD', url='http://github...
Revert "Revert "drop old requirements""
Revert "Revert "drop old requirements"" This reverts commit f444e853936eb95bbe61c2bbf26098e417cc5fef.
Python
bsd-3-clause
mileswwatkins/pupa,datamade/pupa,datamade/pupa,opencivicdata/pupa,opencivicdata/pupa,mileswwatkins/pupa
#!/usr/bin/env python from setuptools import setup, find_packages from pupa import __version__ long_description = '' setup(name='pupa', version=__version__, packages=find_packages(), author='James Turk', author_email='jturk@sunlightfoundation.com', license='BSD', url='http://github...
Revert "Revert "drop old requirements"" This reverts commit f444e853936eb95bbe61c2bbf26098e417cc5fef. #!/usr/bin/env python from setuptools import setup, find_packages from pupa import __version__ long_description = '' setup(name='pupa', version=__version__, packages=find_packages(), author='James...
fd0c556baa12de2fc22f3f4829d683556ca363a7
manager/trackmon_manager.py
manager/trackmon_manager.py
import sys def main(): if "-install" in sys.argv: print("Installing everything") elif "-installapi" in sys.argv: print("Installing API backend only") elif "-installdb" in sys.argv: print("Installing database only") elif "-installfrontend" in sys.argv: print("Installing f...
import sys import os from subprocess import call import urllib.request import json #from pprint import pprint # User needs to install postgres first trackmon_server_api_info = "https://api.github.com/repos/paulkramme/roverpi/releases/latest" def download(url, path): with urllib.request.urlopen(url) as response, o...
Add many todos and basic version download
Add many todos and basic version download
Python
bsd-2-clause
trackmon/trackmon-server,trackmon/trackmon-server
import sys import os from subprocess import call import urllib.request import json #from pprint import pprint # User needs to install postgres first trackmon_server_api_info = "https://api.github.com/repos/paulkramme/roverpi/releases/latest" def download(url, path): with urllib.request.urlopen(url) as response, o...
Add many todos and basic version download import sys def main(): if "-install" in sys.argv: print("Installing everything") elif "-installapi" in sys.argv: print("Installing API backend only") elif "-installdb" in sys.argv: print("Installing database only") elif "-installfronten...
cd992f1fbe4d7469cdc3d9a88863c61157cf90cc
content/test/gpu/gpu_tests/pixel_expectations.py
content/test/gpu/gpu_tests/pixel_expectations.py
# Copyright 2014 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 telemetry.page import test_expectations # Valid expectation conditions are: # # Operating systems: # win, xp, vista, win7, mac, leopard, snowleopar...
# Copyright 2014 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 telemetry.page import test_expectations # Valid expectation conditions are: # # Operating systems: # win, xp, vista, win7, mac, leopard, snowleopar...
Remove failing expectations for pixel tests.
Remove failing expectations for pixel tests. R=kbr@chromium.org BUG=252046, 371592 NOTRY=true Review URL: https://codereview.chromium.org/282953002 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@270785 0039d316-1c4b-4281-b951-d872f2087c98
Python
bsd-3-clause
Just-D/chromium-1,crosswalk-project/chromium-crosswalk-efl,Fireblend/chromium-crosswalk,markYoungH/chromium.src,Jonekee/chromium.src,M4sse/chromium.src,dushu1203/chromium.src,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,jaruba/chromium....
# Copyright 2014 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 telemetry.page import test_expectations # Valid expectation conditions are: # # Operating systems: # win, xp, vista, win7, mac, leopard, snowleopar...
Remove failing expectations for pixel tests. R=kbr@chromium.org BUG=252046, 371592 NOTRY=true Review URL: https://codereview.chromium.org/282953002 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@270785 0039d316-1c4b-4281-b951-d872f2087c98 # Copyright 2014 The Chromium Authors. All rights reserved. # Use of th...
444bba442e581226b650af929c85ccc885c60297
microcosm/tracing.py
microcosm/tracing.py
from jaeger_client.config import ( DEFAULT_REPORTING_HOST, DEFAULT_REPORTING_PORT, DEFAULT_SAMPLING_PORT, Config, ) from microcosm.api import binding, defaults, typed SPAN_NAME = "span_name" @binding("tracer") @defaults( sample_type="ratelimiting", sample_param=typed(int, 10), sampling_...
from jaeger_client.config import ( DEFAULT_REPORTING_HOST, DEFAULT_REPORTING_PORT, DEFAULT_SAMPLING_PORT, Config, ) from microcosm.api import binding, defaults, typed from microcosm.config.types import boolean SPAN_NAME = "span_name" @binding("tracer") @defaults( sample_type="ratelimiting", ...
Disable jaeger logging by default
Disable jaeger logging by default
Python
apache-2.0
globality-corp/microcosm,globality-corp/microcosm
from jaeger_client.config import ( DEFAULT_REPORTING_HOST, DEFAULT_REPORTING_PORT, DEFAULT_SAMPLING_PORT, Config, ) from microcosm.api import binding, defaults, typed from microcosm.config.types import boolean SPAN_NAME = "span_name" @binding("tracer") @defaults( sample_type="ratelimiting", ...
Disable jaeger logging by default from jaeger_client.config import ( DEFAULT_REPORTING_HOST, DEFAULT_REPORTING_PORT, DEFAULT_SAMPLING_PORT, Config, ) from microcosm.api import binding, defaults, typed SPAN_NAME = "span_name" @binding("tracer") @defaults( sample_type="ratelimiting", sample_...
36efa6e2615bdd600d80cc87ada27984c9806135
articles/search_indexes.py
articles/search_indexes.py
from haystack.indexes import * from haystack import site from models import Article class ArticleIndex(SearchIndex): name = CharField(model_attr='title') text = CharField(document=True, use_template=True) def get_queryset(self): """Used when the entire index for model is updated.""" return...
Add search index file - currently search across Articles, extend to search across Categories?
Add search index file - currently search across Articles, extend to search across Categories?
Python
bsd-2-clause
incuna/feincms-articles,michaelkuty/feincms-articles,incuna/feincms-articles,michaelkuty/feincms-articles
from haystack.indexes import * from haystack import site from models import Article class ArticleIndex(SearchIndex): name = CharField(model_attr='title') text = CharField(document=True, use_template=True) def get_queryset(self): """Used when the entire index for model is updated.""" return...
Add search index file - currently search across Articles, extend to search across Categories?
35d4bc796f27bdf5aea7c3dea83c581260a4669a
tests/testapp/testapp/blog/__init__.py
tests/testapp/testapp/blog/__init__.py
def includeme(config): config.add_route('test.new.routes', '/test/new/routes/{param:[a-z]+}') config.add_route('blog.page', '/page/{page_slug}')
def includeme(config): config.add_route('test.new.routes', '/test/new/routes/{param:[a-z]{1,}}') config.add_route('blog.page', '/page/{page_slug}')
Use patterns with explicit length
Use patterns with explicit length
Python
mit
avanov/Rhetoric,avanov/Rhetoric
def includeme(config): config.add_route('test.new.routes', '/test/new/routes/{param:[a-z]{1,}}') config.add_route('blog.page', '/page/{page_slug}')
Use patterns with explicit length def includeme(config): config.add_route('test.new.routes', '/test/new/routes/{param:[a-z]+}') config.add_route('blog.page', '/page/{page_slug}')
071926edc64241b0359c9a0148fc0825a09cb6ba
marionette/__init__.py
marionette/__init__.py
from cgi import parse_header import json from django.http import HttpResponse, Http404 RPC_MARKER = '_rpc' class Resource(object): def __init__(self, request, *args, **kwargs): self.request = request self.args = args self.kwargs = kwargs @classmethod def as_view(cls): ...
from cgi import parse_header import json from django.http import HttpResponse, Http404 RPC_MARKER = '_rpc' class Resource(object): def __init__(self, request, *args, **kwargs): self.request = request self.args = args self.kwargs = kwargs @classmethod def as_view(cls): ...
Add execute hook to allow wrapping handler calls
Add execute hook to allow wrapping handler calls
Python
mit
funkybob/django-marionette
from cgi import parse_header import json from django.http import HttpResponse, Http404 RPC_MARKER = '_rpc' class Resource(object): def __init__(self, request, *args, **kwargs): self.request = request self.args = args self.kwargs = kwargs @classmethod def as_view(cls): ...
Add execute hook to allow wrapping handler calls from cgi import parse_header import json from django.http import HttpResponse, Http404 RPC_MARKER = '_rpc' class Resource(object): def __init__(self, request, *args, **kwargs): self.request = request self.args = args self.kwargs = kwarg...
c21c2f4879c48b6a881b480df7bbfbff47ffffcc
src/mmw/apps/modeling/calcs.py
src/mmw/apps/modeling/calcs.py
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import absolute_import from django.contrib.gis.geos import GEOSGeometry from django.conf import settings from apps.modeling.mapshed.calcs import animal_energy_units ANIMAL_KEYS = settings.GWLFE_CONF...
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import absolute_import from django.contrib.gis.geos import GEOSGeometry from django.conf import settings from apps.modeling.mapshed.calcs import animal_energy_units ANIMAL_KEYS = settings.GWLFE_CONF...
Align animal population counts rounding
Align animal population counts rounding - round animal population counts down for the frontend "analyze" display to match the MapShed implementation
Python
apache-2.0
WikiWatershed/model-my-watershed,project-icp/bee-pollinator-app,project-icp/bee-pollinator-app,WikiWatershed/model-my-watershed,project-icp/bee-pollinator-app,kdeloach/model-my-watershed,WikiWatershed/model-my-watershed,kdeloach/model-my-watershed,kdeloach/model-my-watershed,project-icp/bee-pollinator-app,WikiWatershed...
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import absolute_import from django.contrib.gis.geos import GEOSGeometry from django.conf import settings from apps.modeling.mapshed.calcs import animal_energy_units ANIMAL_KEYS = settings.GWLFE_CONF...
Align animal population counts rounding - round animal population counts down for the frontend "analyze" display to match the MapShed implementation # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import absolute_import from django.contrib.gis.geo...
9ff59c13f0c1295e9a0acd45913f00d8c9a5c0af
mongoctl/errors.py
mongoctl/errors.py
__author__ = 'abdul' ############################################################################### # Mongoctl Exception class ############################################################################### class MongoctlException(Exception): def __init__(self, message,cause=None): self.message = messag...
__author__ = 'abdul' ############################################################################### # Mongoctl Exception class ############################################################################### class MongoctlException(Exception): def __init__(self, message, cause=None): super(MongoctlExcepti...
Remove ref to deprecated "message" property of BaseException
Remove ref to deprecated "message" property of BaseException
Python
mit
mongolab/mongoctl
__author__ = 'abdul' ############################################################################### # Mongoctl Exception class ############################################################################### class MongoctlException(Exception): def __init__(self, message, cause=None): super(MongoctlExcepti...
Remove ref to deprecated "message" property of BaseException __author__ = 'abdul' ############################################################################### # Mongoctl Exception class ############################################################################### class MongoctlException(Exception): def __in...
d1bae39247a1184f7d61fa015897103af2069703
pinax/notifications/urls.py
pinax/notifications/urls.py
from django.conf.urls import patterns, url from .views import NoticeSettingsView urlpatterns = patterns( "", url(r"^settings/$", NoticeSettingsView.as_view(), name="notification_notice_settings"), )
from django.conf.urls import url from .views import NoticeSettingsView urlpatterns = [ url(r"^settings/$", NoticeSettingsView.as_view(), name="notification_notice_settings"), ]
Make compatible with Django 1.9
Make compatible with Django 1.9
Python
mit
pinax/pinax-notifications,pinax/pinax-notifications
from django.conf.urls import url from .views import NoticeSettingsView urlpatterns = [ url(r"^settings/$", NoticeSettingsView.as_view(), name="notification_notice_settings"), ]
Make compatible with Django 1.9 from django.conf.urls import patterns, url from .views import NoticeSettingsView urlpatterns = patterns( "", url(r"^settings/$", NoticeSettingsView.as_view(), name="notification_notice_settings"), )
c42a9633d9b4bbd0d2dec33b1e343e76d167bf6a
fix_name.py
fix_name.py
import os import shutil import sys def fullpath_names(root_dir, file_list): """Create a list of fullpath file-name """ fullpath_list = [] for i in file_list: fullpath_list.append(os.path.join(root_dir, i)) return fullpath_list def get_files_and_subdirs(root_dir): """Return a tuple with...
Add program to rename files automatically
Add program to rename files automatically
Python
mit
escorciav/linux-utils,escorciav/linux-utils
import os import shutil import sys def fullpath_names(root_dir, file_list): """Create a list of fullpath file-name """ fullpath_list = [] for i in file_list: fullpath_list.append(os.path.join(root_dir, i)) return fullpath_list def get_files_and_subdirs(root_dir): """Return a tuple with...
Add program to rename files automatically
0bd4d05dd9c4840cef93ef280d241e1e6a863a5d
server-example/app.py
server-example/app.py
# Example CI server that serves badges from flask import Flask import pybadges app = Flask(__name__) @app.route('/') def serveBadges(): # First example badge_arg = dict( left_text='build', right_text='passing', right_color='#008000' ) badge = pybadges.badge(**badge_arg) ...
# Copyright 2018 The pybadge 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
Add license, right comment and format code
Add license, right comment and format code
Python
apache-2.0
google/pybadges,google/pybadges,google/pybadges
# Copyright 2018 The pybadge 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
Add license, right comment and format code # Example CI server that serves badges from flask import Flask import pybadges app = Flask(__name__) @app.route('/') def serveBadges(): # First example badge_arg = dict( left_text='build', right_text='passing', right_color='#008000' ) ...
64e5bf4187cd9a5e584901583a8ccd60a92314df
preshed/tests/test_pop.py
preshed/tests/test_pop.py
from ..maps import PreshMap def test_pop1(): table = PreshMap() table[10] = 20 table[30] = 25 assert table[10] == 20 assert table[30] == 25 table.pop(30) assert table[10] == 20
Add some tests for pop method
Add some tests for pop method
Python
mit
syllog1sm/preshed,explosion/preshed,explosion/preshed,spacy-io/preshed,spacy-io/preshed,explosion/preshed
from ..maps import PreshMap def test_pop1(): table = PreshMap() table[10] = 20 table[30] = 25 assert table[10] == 20 assert table[30] == 25 table.pop(30) assert table[10] == 20
Add some tests for pop method
05551b6b7ed1ed9a97be635f3d32b5bd4f26f635
tests/mltils/test_infrequent_value_encoder.py
tests/mltils/test_infrequent_value_encoder.py
# pylint: disable=missing-docstring, invalid-name, import-error import pandas as pd from mltils.encoders import InfrequentValueEncoder def test_infrequent_value_encoder_1(): ive = InfrequentValueEncoder() assert ive is not None def test_infrequent_value_encoder_2(): df = pd.DataFrame({'A': ['a', 'a', '...
# pylint: disable=missing-docstring, invalid-name, import-error import pandas as pd from mltils.encoders import InfrequentValueEncoder def test_infrequent_value_encoder_1(): ive = InfrequentValueEncoder() assert ive is not None def test_infrequent_value_encoder_2(): df = pd.DataFrame({'A': ['a', 'a', '...
Add more unit tests for InfrequentValueEncoder
Add more unit tests for InfrequentValueEncoder
Python
mit
rladeira/mltils
# pylint: disable=missing-docstring, invalid-name, import-error import pandas as pd from mltils.encoders import InfrequentValueEncoder def test_infrequent_value_encoder_1(): ive = InfrequentValueEncoder() assert ive is not None def test_infrequent_value_encoder_2(): df = pd.DataFrame({'A': ['a', 'a', '...
Add more unit tests for InfrequentValueEncoder # pylint: disable=missing-docstring, invalid-name, import-error import pandas as pd from mltils.encoders import InfrequentValueEncoder def test_infrequent_value_encoder_1(): ive = InfrequentValueEncoder() assert ive is not None def test_infrequent_value_encod...
1706472a183d50fb11513345b4c82ac201a00306
me_api/configs.py
me_api/configs.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import json from os import path class Config(object): cwd = path.abspath(path.dirname(__file__)) with open(path.join(cwd, 'me.json')) as me: me = json.load(me) with open(path.join(cwd, 'modules...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import json from os import path class Config(object): CACHE_TYPE = 'simple' cwd = path.abspath(path.dirname(__file__)) with open(path.join(cwd, 'me.json')) as me: me = json.load(me) with o...
Move CACHE_TYPE to Config; add TestingConfig
Move CACHE_TYPE to Config; add TestingConfig
Python
mit
lord63/me-api
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import json from os import path class Config(object): CACHE_TYPE = 'simple' cwd = path.abspath(path.dirname(__file__)) with open(path.join(cwd, 'me.json')) as me: me = json.load(me) with o...
Move CACHE_TYPE to Config; add TestingConfig #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import json from os import path class Config(object): cwd = path.abspath(path.dirname(__file__)) with open(path.join(cwd, 'me.json')) as me: me = json....
d650cbe26ce0fcc4c5146466d2827b930c153b0f
PlatformPhysicsOperation.py
PlatformPhysicsOperation.py
from UM.Operations.Operation import Operation from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation from UM.Operations.TranslateOperation import TranslateOperation ## A specialised operation designed specifically to modify the previous operation. class PlatformPhysicsOperation(Operation): def __in...
from UM.Operations.Operation import Operation from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation from UM.Operations.TranslateOperation import TranslateOperation from UM.Operations.GroupedOperation import GroupedOperation ## A specialised operation designed specifically to modify the previous operat...
Use GroupedOperation for merging PlatformPhyisicsOperation
Use GroupedOperation for merging PlatformPhyisicsOperation
Python
agpl-3.0
senttech/Cura,quillford/Cura,fxtentacle/Cura,hmflash/Cura,totalretribution/Cura,ynotstartups/Wanhao,bq/Ultimaker-Cura,lo0ol/Ultimaker-Cura,lo0ol/Ultimaker-Cura,DeskboxBrazil/Cura,derekhe/Cura,fxtentacle/Cura,fieldOfView/Cura,quillford/Cura,fieldOfView/Cura,derekhe/Cura,senttech/Cura,totalretribution/Cura,DeskboxBrazil/...
from UM.Operations.Operation import Operation from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation from UM.Operations.TranslateOperation import TranslateOperation from UM.Operations.GroupedOperation import GroupedOperation ## A specialised operation designed specifically to modify the previous operat...
Use GroupedOperation for merging PlatformPhyisicsOperation from UM.Operations.Operation import Operation from UM.Operations.AddSceneNodeOperation import AddSceneNodeOperation from UM.Operations.TranslateOperation import TranslateOperation ## A specialised operation designed specifically to modify the previous operat...
c9f8663e6b0bf38f6c041a3a6b77b8a0007a9f09
urls.py
urls.py
from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin from django.views.generic.simple import direct_to_template admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^i4p/', include('i4p.foo.urls')), # Uncomment the admin/d...
from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin from django.views.generic.simple import direct_to_template admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^i4p/', include('i4p.foo.urls')), # Uncomment the admin/d...
Add a name to the index URL
Add a name to the index URL
Python
agpl-3.0
ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople,ImaginationForPeople/imaginationforpeople
from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin from django.views.generic.simple import direct_to_template admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^i4p/', include('i4p.foo.urls')), # Uncomment the admin/d...
Add a name to the index URL from django.conf.urls.defaults import * # Uncomment the next two lines to enable the admin: from django.contrib import admin from django.views.generic.simple import direct_to_template admin.autodiscover() urlpatterns = patterns('', # Example: # (r'^i4p/', include('i4p.foo.urls')),...
4aa979273bfe698459d9a8066ee41741c3a68e3d
megamix/__init__.py
megamix/__init__.py
# Module of Gaussian Mixture models for python __all__ = ['batch','online']
# Module of Gaussian Mixture models for python import megamix.batch import megamix.online __all__ = ['batch','online']
Solve minor import problems with submodules
Solve minor import problems with submodules
Python
apache-2.0
14thibea/megamix
# Module of Gaussian Mixture models for python import megamix.batch import megamix.online __all__ = ['batch','online']
Solve minor import problems with submodules # Module of Gaussian Mixture models for python __all__ = ['batch','online']
ed10111f92b1f75d852647fe55e260974fab5eb4
apps/approval/api/serializers.py
apps/approval/api/serializers.py
from rest_framework import serializers from apps.approval.models import CommitteeApplication, CommitteePriority class CommitteeSerializer(serializers.ModelSerializer): group_name = serializers.SerializerMethodField(source='group') class Meta(object): model = CommitteePriority fields = ('grou...
from django.core.exceptions import ValidationError as DjangoValidationError from rest_framework import serializers from apps.approval.models import CommitteeApplication, CommitteePriority class CommitteeSerializer(serializers.ModelSerializer): group_name = serializers.SerializerMethodField(source='group') c...
Raise DRF ValidationError to get APIException base
Raise DRF ValidationError to get APIException base
Python
mit
dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4
from django.core.exceptions import ValidationError as DjangoValidationError from rest_framework import serializers from apps.approval.models import CommitteeApplication, CommitteePriority class CommitteeSerializer(serializers.ModelSerializer): group_name = serializers.SerializerMethodField(source='group') c...
Raise DRF ValidationError to get APIException base from rest_framework import serializers from apps.approval.models import CommitteeApplication, CommitteePriority class CommitteeSerializer(serializers.ModelSerializer): group_name = serializers.SerializerMethodField(source='group') class Meta(object): ...
6f6f6e183b574f8505b53ddb7651c8766992b953
pywikibot/families/lingualibre_family.py
pywikibot/families/lingualibre_family.py
"""Family module for Lingua Libre.""" # # (C) Pywikibot team, 2021 # # Distributed under the terms of the MIT license. # from pywikibot import family # The Lingua Libre family class Family(family.WikimediaFamily): """Family class for Lingua Libre. *New in version 6.5.* """ name = 'lingualibre' ...
"""Family module for Lingua Libre.""" # # (C) Pywikibot team, 2021 # # Distributed under the terms of the MIT license. # from pywikibot import family # The Lingua Libre family class Family(family.WikimediaFamily): """Family class for Lingua Libre. *New in version 6.5.* """ name = 'lingualibre' ...
Allow to request for item on Lingua Libre
Allow to request for item on Lingua Libre Bug: T286303 Change-Id: Ic0d8824d1bf326f2182fbb64d0cc2ed77f82fd4c
Python
mit
wikimedia/pywikibot-core,wikimedia/pywikibot-core
"""Family module for Lingua Libre.""" # # (C) Pywikibot team, 2021 # # Distributed under the terms of the MIT license. # from pywikibot import family # The Lingua Libre family class Family(family.WikimediaFamily): """Family class for Lingua Libre. *New in version 6.5.* """ name = 'lingualibre' ...
Allow to request for item on Lingua Libre Bug: T286303 Change-Id: Ic0d8824d1bf326f2182fbb64d0cc2ed77f82fd4c """Family module for Lingua Libre.""" # # (C) Pywikibot team, 2021 # # Distributed under the terms of the MIT license. # from pywikibot import family # The Lingua Libre family class Family(family.WikimediaFam...
b4ef0f107ca8fefbe556babb00f31c7b88019d50
pydarkstar/__init__.py
pydarkstar/__init__.py
__version__ = 0.1 import pydarkstar.logutils import logging pydarkstar.logutils.setError() try: import sqlalchemy except ImportError as e: logging.exception(e.__class__.__name__) logging.error('pip install sqlalchemy') exit(-1) try: import pymysql except ImportError as e: logging.exception(e...
__version__ = 0.1 import pydarkstar.logutils import logging pydarkstar.logutils.setError() try: import sqlalchemy except ImportError as e: logging.exception(e.__class__.__name__) logging.error('pip install sqlalchemy') exit(-1) try: import pymysql except ImportError as e: logging.exception(e...
Revert "Change imports to relative."
Revert "Change imports to relative." This reverts commit 9d0990249b7e0e46e38a665cb8c32a1ee435c291.
Python
mit
LegionXI/pydarkstar,AdamGagorik/pydarkstar
__version__ = 0.1 import pydarkstar.logutils import logging pydarkstar.logutils.setError() try: import sqlalchemy except ImportError as e: logging.exception(e.__class__.__name__) logging.error('pip install sqlalchemy') exit(-1) try: import pymysql except ImportError as e: logging.exception(e...
Revert "Change imports to relative." This reverts commit 9d0990249b7e0e46e38a665cb8c32a1ee435c291. __version__ = 0.1 import pydarkstar.logutils import logging pydarkstar.logutils.setError() try: import sqlalchemy except ImportError as e: logging.exception(e.__class__.__name__) logging.error('pip instal...
6b777abcc694ff8991cd522300d8d545fb49586a
cct/core2/stronginfo.py
cct/core2/stronginfo.py
import logging import colorlog logging.STRONGINFO = logging.DEBUG + 5 logging.addLevelName(logging.STRONGINFO, 'STRONGINFO') def logStrongInfo(msg, *args, **kwargs): """Log a message with severity 'STRONGINFO' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with...
import logging import colorlog logging.STRONGINFO = logging.INFO + 5 logging.addLevelName(logging.STRONGINFO, 'STRONGINFO') def logStrongInfo(msg, *args, **kwargs): """Log a message with severity 'STRONGINFO' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with ...
Correct priority for STRONGINFO log level
Correct priority for STRONGINFO log level
Python
bsd-3-clause
awacha/cct,awacha/cct,awacha/cct
import logging import colorlog logging.STRONGINFO = logging.INFO + 5 logging.addLevelName(logging.STRONGINFO, 'STRONGINFO') def logStrongInfo(msg, *args, **kwargs): """Log a message with severity 'STRONGINFO' on the root logger. If the logger has no handlers, call basicConfig() to add a console handler with ...
Correct priority for STRONGINFO log level import logging import colorlog logging.STRONGINFO = logging.DEBUG + 5 logging.addLevelName(logging.STRONGINFO, 'STRONGINFO') def logStrongInfo(msg, *args, **kwargs): """Log a message with severity 'STRONGINFO' on the root logger. If the logger has no handlers, call ...
20e293b49438a2428eee21bdc07799328a69ec48
dadd/worker/handlers.py
dadd/worker/handlers.py
import json import socket import requests from flask import request, jsonify from dadd.worker import app from dadd.worker.proc import ChildProcess @app.route('/run/', methods=['POST']) def run_process(): proc = ChildProcess(request.json) proc.run() return jsonify(proc.info()) @app.route('/register/',...
import os import json import socket import requests from flask import request, jsonify, Response, abort from dadd.worker import app from dadd.worker.proc import ChildProcess @app.route('/run/', methods=['POST']) def run_process(): proc = ChildProcess(request.json) proc.run() return jsonify(proc.info())...
Allow setting the HOSTNAME reported to the master via an env var; Stub and endpoint for tailing the log of a process assuming you know the path.
Allow setting the HOSTNAME reported to the master via an env var; Stub and endpoint for tailing the log of a process assuming you know the path. I'd like to get this log processing a bit more automatic but I need to spend more time in Dadd's API.
Python
bsd-3-clause
ionrock/dadd,ionrock/dadd,ionrock/dadd,ionrock/dadd
import os import json import socket import requests from flask import request, jsonify, Response, abort from dadd.worker import app from dadd.worker.proc import ChildProcess @app.route('/run/', methods=['POST']) def run_process(): proc = ChildProcess(request.json) proc.run() return jsonify(proc.info())...
Allow setting the HOSTNAME reported to the master via an env var; Stub and endpoint for tailing the log of a process assuming you know the path. I'd like to get this log processing a bit more automatic but I need to spend more time in Dadd's API. import json import socket import requests from flask import request, ...
a554be928f6123ad78d97c0e988bf78c2978e877
geotrek/infrastructure/migrations/0028_infrastructure_published_translation.py
geotrek/infrastructure/migrations/0028_infrastructure_published_translation.py
# Generated by Django 3.1.14 on 2022-03-11 15:06 from django.conf import settings from django.db import migrations def forward(apps, schema_editor): with schema_editor.connection.cursor() as cursor: cursor.execute( f"SELECT 1 FROM information_schema.columns WHERE table_name='infrastructure_in...
Add migration fix published language
Add migration fix published language
Python
bsd-2-clause
makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek
# Generated by Django 3.1.14 on 2022-03-11 15:06 from django.conf import settings from django.db import migrations def forward(apps, schema_editor): with schema_editor.connection.cursor() as cursor: cursor.execute( f"SELECT 1 FROM information_schema.columns WHERE table_name='infrastructure_in...
Add migration fix published language
2814d7b8060d1f468bb6fb34d1460cdad1811031
tools/android/emulator/reporting.py
tools/android/emulator/reporting.py
"""An interface to report the status of emulator launches.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import logging import os import uuid class NoOpReporter(object): """Captures all device and failure data and throws it away.""" ...
"""An interface to report the status of emulator launches.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import logging import os import uuid class NoOpReporter(object): """Captures all device and failure data and throws it away.""" ...
Update the reporter interface to even track the total runtime
Update the reporter interface to even track the total runtime PiperOrigin-RevId: 160982468
Python
apache-2.0
android/android-test,android/android-test,android/android-test,android/android-test,android/android-test
"""An interface to report the status of emulator launches.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import logging import os import uuid class NoOpReporter(object): """Captures all device and failure data and throws it away.""" ...
Update the reporter interface to even track the total runtime PiperOrigin-RevId: 160982468 """An interface to report the status of emulator launches.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import logging import os import uuid cl...
75402ed564a0e37732bceb2b44261630e69bc250
src/smsfly/util.py
src/smsfly/util.py
from functools import wraps from bs4 import BeautifulSoup as bs from errors import XMLError, PhoneError, StartTimeError, EndTimeError, LifetimeError, SpeedError, AlphanameError, TextError, InsufficientFundsError ERROR_MAP = { 'XMLERROR': XMLError, 'ERRPHONES': PhoneError, 'ERRSTARTTIME': StartTime...
from functools import wraps from bs4 import BeautifulSoup as bs from .errors import ( XMLError, PhoneError, StartTimeError, EndTimeError, LifetimeError, SpeedError, AlphanameError, TextError, InsufficientFundsError ) ERROR_MAP = { 'XMLERROR': XMLError, 'ERRPHONES': PhoneError, 'ERRSTARTTIME':...
Fix import of error classes
Fix import of error classes
Python
mit
wk-tech/python-smsfly
from functools import wraps from bs4 import BeautifulSoup as bs from .errors import ( XMLError, PhoneError, StartTimeError, EndTimeError, LifetimeError, SpeedError, AlphanameError, TextError, InsufficientFundsError ) ERROR_MAP = { 'XMLERROR': XMLError, 'ERRPHONES': PhoneError, 'ERRSTARTTIME':...
Fix import of error classes from functools import wraps from bs4 import BeautifulSoup as bs from errors import XMLError, PhoneError, StartTimeError, EndTimeError, LifetimeError, SpeedError, AlphanameError, TextError, InsufficientFundsError ERROR_MAP = { 'XMLERROR': XMLError, 'ERRPHONES': PhoneError, ...
5dc0061d912bf660c7e7885bd2a42f5b92834b7b
scripts/update_taxonomies.py
scripts/update_taxonomies.py
import os import json from framework.mongo import set_up_storage from website import settings from website.project.taxonomies import Subject from modularodm import Q, storage from modularodm.exceptions import NoResultsFound, MultipleResultsFound def update_taxonomies(): # Flat taxonomy is stored locally, read i...
Add a script that loads the taxonomies as a standalone thing
Add a script that loads the taxonomies as a standalone thing
Python
apache-2.0
acshi/osf.io,aaxelb/osf.io,chrisseto/osf.io,cwisecarver/osf.io,mluo613/osf.io,acshi/osf.io,caneruguz/osf.io,sloria/osf.io,CenterForOpenScience/osf.io,crcresearch/osf.io,mattclark/osf.io,Johnetordoff/osf.io,laurenrevere/osf.io,monikagrabowska/osf.io,felliott/osf.io,saradbowman/osf.io,pattisdr/osf.io,crcresearch/osf.io,b...
import os import json from framework.mongo import set_up_storage from website import settings from website.project.taxonomies import Subject from modularodm import Q, storage from modularodm.exceptions import NoResultsFound, MultipleResultsFound def update_taxonomies(): # Flat taxonomy is stored locally, read i...
Add a script that loads the taxonomies as a standalone thing
1849a7ce4e706c8f81a6f3f5b01e0f16c3beb35d
sahgutils/io/__init__.py
sahgutils/io/__init__.py
"""Provides convenience utilities for assorted data files. This package provides a means of organizing the code developed at UKZN for handling the dataflow and processing of information for the WRC funded research project K5-1683 "Soil Moisture from Space". The interface isn't stable yet so be prepared to upda...
"""Provides convenience utilities for assorted data files. This package provides a means of organizing the code developed at UKZN for handling the dataflow and processing of information for the WRC funded research project K5-1683 "Soil Moisture from Space". The interface isn't stable yet so be prepared to update your...
Change to Unix line endings
REF: Change to Unix line endings
Python
bsd-3-clause
sahg/SAHGutils
"""Provides convenience utilities for assorted data files. This package provides a means of organizing the code developed at UKZN for handling the dataflow and processing of information for the WRC funded research project K5-1683 "Soil Moisture from Space". The interface isn't stable yet so be prepared to update your...
REF: Change to Unix line endings """Provides convenience utilities for assorted data files. This package provides a means of organizing the code developed at UKZN for handling the dataflow and processing of information for the WRC funded research project K5-1683 "Soil Moisture from Space". The interface isn't...
c07e2bbbeb513429fc6ef4a5efba5cae71cac214
autostew_back/tests/test_assets/settings_no_plugins.py
autostew_back/tests/test_assets/settings_no_plugins.py
import logging from autostew_back.tests.test_assets import prl_s4_r2_zolder_casual logging.getLogger().setLevel(logging.INFO) logging.getLogger('django.db.backends').setLevel(logging.INFO) logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.INFO) class SettingsWithoutPlugins: host_nam...
import logging from autostew_back.tests.test_assets import prl_s4_r2_zolder_casual logging.getLogger().setLevel(logging.INFO) logging.getLogger('django.db.backends').setLevel(logging.INFO) logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.INFO) class SettingsWithoutPlugins: host_nam...
Set sleep times to zero for tests
Set sleep times to zero for tests
Python
agpl-3.0
Autostew/autostew,Autostew/autostew,Autostew/autostew
import logging from autostew_back.tests.test_assets import prl_s4_r2_zolder_casual logging.getLogger().setLevel(logging.INFO) logging.getLogger('django.db.backends').setLevel(logging.INFO) logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.INFO) class SettingsWithoutPlugins: host_nam...
Set sleep times to zero for tests import logging from autostew_back.tests.test_assets import prl_s4_r2_zolder_casual logging.getLogger().setLevel(logging.INFO) logging.getLogger('django.db.backends').setLevel(logging.INFO) logging.getLogger('requests.packages.urllib3.connectionpool').setLevel(logging.INFO) class S...
0d2f35ddc27cf4c7155a4d1648c0bbfe0ff3a528
numpy/_array_api/dtypes.py
numpy/_array_api/dtypes.py
from .. import int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64, bool __all__ = ['int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'bool']
from .. import int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64 # Note: This name is changed from .. import bool_ as bool __all__ = ['int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'bool']
Fix the bool name in the array API namespace
Fix the bool name in the array API namespace
Python
mit
cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy
from .. import int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64 # Note: This name is changed from .. import bool_ as bool __all__ = ['int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'bool']
Fix the bool name in the array API namespace from .. import int8, int16, int32, int64, uint8, uint16, uint32, uint64, float32, float64, bool __all__ = ['int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'bool']
04ff248c628e5523bc22c532cf4518f210376307
setup.py
setup.py
#!/usr/bin/env python # NOTE: setup.py does NOT install the contents of the library dir # for you, you should go through "make install" or "make RPMs" # for that, or manually copy modules over. import os import sys sys.path.insert(0, os.path.abspath('lib')) from ansible import __version__, __author__ from distutils....
#!/usr/bin/env python # NOTE: setup.py does NOT install the contents of the library dir # for you, you should go through "make install" or "make RPMs" # for that, or manually copy modules over. import os import sys sys.path.insert(0, os.path.abspath('lib')) from ansible import __version__, __author__ from distutils....
Include bin/ansible-pull as part of the sdist in distutils.
Include bin/ansible-pull as part of the sdist in distutils.
Python
mit
thaim/ansible,thaim/ansible
#!/usr/bin/env python # NOTE: setup.py does NOT install the contents of the library dir # for you, you should go through "make install" or "make RPMs" # for that, or manually copy modules over. import os import sys sys.path.insert(0, os.path.abspath('lib')) from ansible import __version__, __author__ from distutils....
Include bin/ansible-pull as part of the sdist in distutils. #!/usr/bin/env python # NOTE: setup.py does NOT install the contents of the library dir # for you, you should go through "make install" or "make RPMs" # for that, or manually copy modules over. import os import sys sys.path.insert(0, os.path.abspath('lib')...
e24674011454ce60bf1c4582af25262ae277771c
spreadchimp.py
spreadchimp.py
import os import xlrd import xlwt # Assumes the directory with the workbook is relative to the script's location. directory = 'workbooks/' workbook = '' for dirpath, dirnames, filenames in os.walk(directory): for files in filenames: workbook = (dirpath + files) ''' Test films include: Repulsion The Cryin...
import os import xlrd import xlwt # Assumes the directory with the workbook is relative to the script's location. directory = 'workbooks/' workbook = '' for dirpath, dirnames, filenames in os.walk(directory): for files in filenames: workbook = (dirpath + files) ''' Test films include: Repulsion The Cryin...
Add header row to worksheet in workbooks
Add header row to worksheet in workbooks
Python
mit
deadlyraptor/reels
import os import xlrd import xlwt # Assumes the directory with the workbook is relative to the script's location. directory = 'workbooks/' workbook = '' for dirpath, dirnames, filenames in os.walk(directory): for files in filenames: workbook = (dirpath + files) ''' Test films include: Repulsion The Cryin...
Add header row to worksheet in workbooks import os import xlrd import xlwt # Assumes the directory with the workbook is relative to the script's location. directory = 'workbooks/' workbook = '' for dirpath, dirnames, filenames in os.walk(directory): for files in filenames: workbook = (dirpath + files) '...
35d14348ce419421bba2b043ea2818c185526301
ratechecker/migrations/0002_remove_fee_loader.py
ratechecker/migrations/0002_remove_fee_loader.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-10-31 16:33 from __future__ import unicode_literals from django.db import migrations, OperationalError, ProgrammingError def fix_fee_product_index(apps, schema_editor): table_name = 'cfpb.ratechecker_fee' index_name = 'idx_16977_product_id' try...
# -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-10-31 16:33 from __future__ import unicode_literals from django.db import migrations, OperationalError, ProgrammingError def fix_fee_product_index(apps, schema_editor): try: schema_editor.execute( 'DROP INDEX idx_16977_product_id;' ...
Comment out fix_fee_product_index from migration
Comment out fix_fee_product_index from migration
Python
cc0-1.0
cfpb/owning-a-home-api
# -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-10-31 16:33 from __future__ import unicode_literals from django.db import migrations, OperationalError, ProgrammingError def fix_fee_product_index(apps, schema_editor): try: schema_editor.execute( 'DROP INDEX idx_16977_product_id;' ...
Comment out fix_fee_product_index from migration # -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-10-31 16:33 from __future__ import unicode_literals from django.db import migrations, OperationalError, ProgrammingError def fix_fee_product_index(apps, schema_editor): table_name = 'cfpb.ratechecker_fe...
3a67b514968f0c002f049ce8e34710412ca39904
setup.py
setup.py
from setuptools import setup, find_packages import os scriptnames = ['runElegant.sh', 'sddsprintdata.sh', 'renametolower.sh', 'file2lower.sh', 'lte2json', 'json2lte', 'latticeviewer', 'lv'] def readme(): with ...
from setuptools import setup, find_packages import os scriptnames = ['runElegant.sh', 'sddsprintdata.sh', 'renametolower.sh', 'file2lower.sh', 'lte2json', 'json2lte', 'latticeviewer', 'lv'] def readme(): with ...
Add wxPython and use install_requires
Add wxPython and use install_requires * Add wxPython as a depenency * Use `install_requires` so dependencies are installed if one installs this package
Python
mit
Archman/beamline
from setuptools import setup, find_packages import os scriptnames = ['runElegant.sh', 'sddsprintdata.sh', 'renametolower.sh', 'file2lower.sh', 'lte2json', 'json2lte', 'latticeviewer', 'lv'] def readme(): with ...
Add wxPython and use install_requires * Add wxPython as a depenency * Use `install_requires` so dependencies are installed if one installs this package from setuptools import setup, find_packages import os scriptnames = ['runElegant.sh', 'sddsprintdata.sh', 'renametolower.sh', ...
17ac329783bce0cb88d92659cf58a3ea476c66ef
scripts/sound_output_test.py
scripts/sound_output_test.py
import pyaudio import wave import time import sys import numpy as np if len(sys.argv) < 2: print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0]) sys.exit(-1) wf = wave.open(sys.argv[1], 'rb') p = pyaudio.PyAudio() DEVICE_ID=2 def callback(in_data, frame_count, time_info, status): data = w...
import pyaudio import wave import time import sys import numpy as np if len(sys.argv) < 2: print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0]) sys.exit(-1) wf = wave.open(sys.argv[1], 'rb') p = pyaudio.PyAudio() n_bytes_to_test = 1024 * 2 * 6 DEVICE_ID=2 def callback(in_data, frame_count, ...
Add support for looping sample
Add support for looping sample
Python
bsd-2-clause
mfergie/human-hive
import pyaudio import wave import time import sys import numpy as np if len(sys.argv) < 2: print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0]) sys.exit(-1) wf = wave.open(sys.argv[1], 'rb') p = pyaudio.PyAudio() n_bytes_to_test = 1024 * 2 * 6 DEVICE_ID=2 def callback(in_data, frame_count, ...
Add support for looping sample import pyaudio import wave import time import sys import numpy as np if len(sys.argv) < 2: print("Plays a wave file.\n\nUsage: %s filename.wav" % sys.argv[0]) sys.exit(-1) wf = wave.open(sys.argv[1], 'rb') p = pyaudio.PyAudio() DEVICE_ID=2 def callback(in_data, frame_count, ...
91396ed246166f610e9cfc4519862f061af4e6b2
cat/admin.py
cat/admin.py
from django.contrib import admin from models import MuseumObject,FunctionalCategory class MOAdmin(admin.ModelAdmin): fields = ('registration_number','country','description','comment') list_display = ('registration_number','country','description','comment') list_filter = ('country','functional_category') ...
Enable Django Admin for some of our data
Enable Django Admin for some of our data
Python
bsd-3-clause
uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam
from django.contrib import admin from models import MuseumObject,FunctionalCategory class MOAdmin(admin.ModelAdmin): fields = ('registration_number','country','description','comment') list_display = ('registration_number','country','description','comment') list_filter = ('country','functional_category') ...
Enable Django Admin for some of our data
e2d51e23f530202b82ba13ae11c686deb1388435
prototype/BioID.py
prototype/BioID.py
#!/usr/bin/env python # # A class for auto identifying bioinformatics file formats. # By Lee & Matt import re import json import mmap class BioID: defs = None def __init__(self, defpath): with open(defpath, "r") as deffile: conts = deffile.read() self.defs = json.loads(conts)["fo...
#!/usr/bin/env python # # A class for auto identifying bioinformatics file formats. # By Lee & Matt import re import json import mmap class BioID: defs = None def __init__(self, defpath): with open(defpath, "r") as deffile: conts = deffile.read() self.defs = json.loads(conts)["formats"] @classmethod def...
Indent return in identify class.
Indent return in identify class.
Python
mit
LeeBergstrand/BioMagick,LeeBergstrand/BioMagick
#!/usr/bin/env python # # A class for auto identifying bioinformatics file formats. # By Lee & Matt import re import json import mmap class BioID: defs = None def __init__(self, defpath): with open(defpath, "r") as deffile: conts = deffile.read() self.defs = json.loads(conts)["formats"] @classmethod def...
Indent return in identify class. #!/usr/bin/env python # # A class for auto identifying bioinformatics file formats. # By Lee & Matt import re import json import mmap class BioID: defs = None def __init__(self, defpath): with open(defpath, "r") as deffile: conts = deffile.read() ...
1721d2badb2168f79587d8c018ca65d89733da88
tests/test_keras.py
tests/test_keras.py
from __future__ import print_function import numpy as np np.random.seed(1337) import keras.backend as K from keras.models import Sequential from keras.layers.core import Dense from keras.layers.wrappers import TimeDistributed from keras.layers.recurrent import LSTM from keras.layers.normalization import BatchNormaliz...
Add simple test for Keras
Add simple test for Keras
Python
bsd-3-clause
mcf06/theano_ctc
from __future__ import print_function import numpy as np np.random.seed(1337) import keras.backend as K from keras.models import Sequential from keras.layers.core import Dense from keras.layers.wrappers import TimeDistributed from keras.layers.recurrent import LSTM from keras.layers.normalization import BatchNormaliz...
Add simple test for Keras
5a45a312eebe9e432b066b99d914b49a2adb920c
openfaas/yaml2json/function/handler.py
openfaas/yaml2json/function/handler.py
# Author: Milos Buncic # Date: 2017/10/14 # Description: Convert YAML to JSON and vice versa (OpenFaaS function) import os import sys import json import yaml def handle(data, **parms): def yaml2json(ydata): """ Convert YAML to JSON (output: JSON) """ try: d = yaml.load(ydata, Loader=yaml.Base...
# Author: Milos Buncic # Date: 2017/10/14 # Description: Convert YAML to JSON and vice versa (OpenFaaS function) import os import sys import json import yaml def yaml2json(data): """ Convert YAML to JSON (output: JSON) """ try: d = yaml.load(data, Loader=yaml.BaseLoader) except Exception as e: d = ...
Make handle function to behave similar as main function
Make handle function to behave similar as main function
Python
mit
psyhomb/serverless
# Author: Milos Buncic # Date: 2017/10/14 # Description: Convert YAML to JSON and vice versa (OpenFaaS function) import os import sys import json import yaml def yaml2json(data): """ Convert YAML to JSON (output: JSON) """ try: d = yaml.load(data, Loader=yaml.BaseLoader) except Exception as e: d = ...
Make handle function to behave similar as main function # Author: Milos Buncic # Date: 2017/10/14 # Description: Convert YAML to JSON and vice versa (OpenFaaS function) import os import sys import json import yaml def handle(data, **parms): def yaml2json(ydata): """ Convert YAML to JSON (output: JSON) ...
4d247da1ecd39bcd699a55b5387412a1ac9e1582
txlege84/topics/management/commands/bootstraptopics.py
txlege84/topics/management/commands/bootstraptopics.py
from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def load_topics(self): self.stdout.write(u'Loading hot list topics.....
from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def load_topics(self): self.stdout.write(u'Loading hot list topics.....
Split Energy and Environment, change Civil Liberties to Social Justice
Split Energy and Environment, change Civil Liberties to Social Justice
Python
mit
texastribune/txlege84,texastribune/txlege84,texastribune/txlege84,texastribune/txlege84
from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def load_topics(self): self.stdout.write(u'Loading hot list topics.....
Split Energy and Environment, change Civil Liberties to Social Justice from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def ...
cad499437969e6b1b23ab7d2639003d4ec6a86b1
datasets/ccgois/transform.py
datasets/ccgois/transform.py
import datetime import json import sys import ffs import re from publish.lib.helpers import filename_for_resource, download_file from publish.lib.upload import Uploader def main(workspace): DATA_DIR = ffs.Path(workspace) datasets = json.load(open(DATA_DIR / 'ccgois_indicators.json')) u = Uploader("ccgo...
import datetime import json import sys import ffs import re from publish.lib.helpers import filename_for_resource, download_file from publish.lib.upload import Uploader def main(workspace): DATA_DIR = ffs.Path(workspace) datasets = json.load(open(DATA_DIR / 'ccgois_indicators.json')) u = Uploader("ccgo...
Fix the naming of the newly created resources
Fix the naming of the newly created resources
Python
mit
nhsengland/publish-o-matic
import datetime import json import sys import ffs import re from publish.lib.helpers import filename_for_resource, download_file from publish.lib.upload import Uploader def main(workspace): DATA_DIR = ffs.Path(workspace) datasets = json.load(open(DATA_DIR / 'ccgois_indicators.json')) u = Uploader("ccgo...
Fix the naming of the newly created resources import datetime import json import sys import ffs import re from publish.lib.helpers import filename_for_resource, download_file from publish.lib.upload import Uploader def main(workspace): DATA_DIR = ffs.Path(workspace) datasets = json.load(open(DATA_DIR / 'cc...
28b5fef57580640cd78775d6c0544bc633e5958a
generate-key.py
generate-key.py
#!/usr/bin/python import os import sqlite3 import sys import time if len(sys.argv) < 3: raise ValueError('Usage: %s "Firstnam Lastname" email@example.com' % sys.argv[0]) db = sqlite3.connect('/var/lib/zon-api/data.db') api_key = str(os.urandom(26).encode('hex')) tier = 'free' name = sys.argv[1] email = sys.argv[...
Add helper script to generate API keys.
Add helper script to generate API keys.
Python
bsd-3-clause
ZeitOnline/content-api,ZeitOnline/content-api
#!/usr/bin/python import os import sqlite3 import sys import time if len(sys.argv) < 3: raise ValueError('Usage: %s "Firstnam Lastname" email@example.com' % sys.argv[0]) db = sqlite3.connect('/var/lib/zon-api/data.db') api_key = str(os.urandom(26).encode('hex')) tier = 'free' name = sys.argv[1] email = sys.argv[...
Add helper script to generate API keys.
776c1dbda3871c2b94d849ea59db25f93bb59525
src/mmw/apps/water_balance/views.py
src/mmw/apps/water_balance/views.py
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division from django.shortcuts import render_to_response def home_page(request): return render_to_response('home_page/index.html')
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division from django.shortcuts import render_to_response from django.template import RequestContext def home_page(request): return render_to_response('home_page/index.html', RequestContext...
Add RequestContext to Micro site
Add RequestContext to Micro site This allows us to populate settings variables such as Google Analytics codes. See original work done for #769. Refs #920
Python
apache-2.0
lliss/model-my-watershed,WikiWatershed/model-my-watershed,kdeloach/model-my-watershed,lliss/model-my-watershed,lliss/model-my-watershed,kdeloach/model-my-watershed,project-icp/bee-pollinator-app,kdeloach/model-my-watershed,WikiWatershed/model-my-watershed,WikiWatershed/model-my-watershed,lliss/model-my-watershed,WikiWa...
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division from django.shortcuts import render_to_response from django.template import RequestContext def home_page(request): return render_to_response('home_page/index.html', RequestContext...
Add RequestContext to Micro site This allows us to populate settings variables such as Google Analytics codes. See original work done for #769. Refs #920 # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division from django.shortcuts import...
3193abd844bae92159258a5cc80221e9a7d16b06
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup d = generate_distutils_setup( packages=['xacro'], package_dir={'': 'src'}, scripts=['scripts/xacro.py'] ) setup(**d)
#!/usr/bin/env python from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup d = generate_distutils_setup( packages=['xacro'], package_dir={'': 'src'} ) setup(**d)
Remove bin copy of xacro.py
Remove bin copy of xacro.py
Python
bsd-3-clause
ros/xacro,ros/xacro
#!/usr/bin/env python from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup d = generate_distutils_setup( packages=['xacro'], package_dir={'': 'src'} ) setup(**d)
Remove bin copy of xacro.py #!/usr/bin/env python from distutils.core import setup from catkin_pkg.python_setup import generate_distutils_setup d = generate_distutils_setup( packages=['xacro'], package_dir={'': 'src'}, scripts=['scripts/xacro.py'] ) setup(**d)
1f043dd959fa1e1d243a3278abeb66838a2f9305
server/auvsi_suas/migrations/0013_remove_ir_as_target_type.py
server/auvsi_suas/migrations/0013_remove_ir_as_target_type.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [('auvsi_suas', '0012_missionclockevent'), ] operations = [ migrations.AlterField( model_name='target', name='target...
Remove the IR target type in migration.
Remove the IR target type in migration.
Python
apache-2.0
justineaster/interop,auvsi-suas/interop,justineaster/interop,justineaster/interop,auvsi-suas/interop,justineaster/interop,auvsi-suas/interop,auvsi-suas/interop,justineaster/interop
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [('auvsi_suas', '0012_missionclockevent'), ] operations = [ migrations.AlterField( model_name='target', name='target...
Remove the IR target type in migration.
26b9bc9547865c9b4ea654504adbee15f21ed633
backend/populate_dionyziz.py
backend/populate_dionyziz.py
from string import ascii_lowercase import django import os import string os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') django.setup() from breach.models import Target, Victim endpoint = 'https://dionyziz.com/breach-test/reflect.php?ref=%s' prefix = 'imper' alphabet = ascii_lowercase secretlengt...
Add population script for dionyziz
Add population script for dionyziz
Python
mit
dimkarakostas/rupture,dionyziz/rupture,dimkarakostas/rupture,esarafianou/rupture,dimriou/rupture,dionyziz/rupture,dimriou/rupture,dionyziz/rupture,dimriou/rupture,dimriou/rupture,esarafianou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,esarafianou/rupture,dimkarakostas/rupture,esarafianou/rupture,dimriou/rupture...
from string import ascii_lowercase import django import os import string os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') django.setup() from breach.models import Target, Victim endpoint = 'https://dionyziz.com/breach-test/reflect.php?ref=%s' prefix = 'imper' alphabet = ascii_lowercase secretlengt...
Add population script for dionyziz
ea324a30823fbf18c72dd639b9c43d3ecb57b034
txircd/modules/extra/services/account_extban.py
txircd/modules/extra/services/account_extban.py
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ircLower from zope.interface import implements from fnmatch import fnmatchcase class AccountExtban(ModuleData): implements(IPlugin, IModuleData) name = "AccountExtban" def actions(self): ret...
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ircLower from zope.interface import implements from fnmatch import fnmatchcase class AccountExtban(ModuleData): implements(IPlugin, IModuleData) name = "AccountExtban" def actions(self): ret...
Fix matching users against R: extbans
Fix matching users against R: extbans
Python
bsd-3-clause
Heufneutje/txircd
from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ircLower from zope.interface import implements from fnmatch import fnmatchcase class AccountExtban(ModuleData): implements(IPlugin, IModuleData) name = "AccountExtban" def actions(self): ret...
Fix matching users against R: extbans from twisted.plugin import IPlugin from txircd.module_interface import IModuleData, ModuleData from txircd.utils import ircLower from zope.interface import implements from fnmatch import fnmatchcase class AccountExtban(ModuleData): implements(IPlugin, IModuleData) name = "Acc...
339f5c6d7cc5b3a70fa71fd423c0a4226acc77e7
valor/schema.py
valor/schema.py
import json class Schema(dict): """ Lightweight encapsulation of a JSON Schema. """ @classmethod def from_file(cls, path_or_stream): """ Create a schema from a file name or stream. """ if hasattr(path_or_stream, 'read'): return cls(json.load(path_or_stre...
import json import jsonpointer class Schema(dict): """ Lightweight encapsulation of a JSON Schema. """ @classmethod def from_file(cls, path_or_stream): """ Create a schema from a file name or stream. """ if hasattr(path_or_stream, 'read'): return cls(jso...
Use jsonpointer instead of my own terrible Reference class.
Use jsonpointer instead of my own terrible Reference class.
Python
bsd-3-clause
jacobian/valor
import json import jsonpointer class Schema(dict): """ Lightweight encapsulation of a JSON Schema. """ @classmethod def from_file(cls, path_or_stream): """ Create a schema from a file name or stream. """ if hasattr(path_or_stream, 'read'): return cls(jso...
Use jsonpointer instead of my own terrible Reference class. import json class Schema(dict): """ Lightweight encapsulation of a JSON Schema. """ @classmethod def from_file(cls, path_or_stream): """ Create a schema from a file name or stream. """ if hasattr(path_or_s...
69d22e9e7ff574d4f510269e589dafa45132047f
stdnum/br/__init__.py
stdnum/br/__init__.py
# __init__.py - collection of Brazilian numbers # coding: utf-8 # # Copyright (C) 2012 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License...
# __init__.py - collection of Brazilian numbers # coding: utf-8 # # Copyright (C) 2012 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License...
Add missing vat alias for Brazil
Add missing vat alias for Brazil
Python
lgpl-2.1
arthurdejong/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum
# __init__.py - collection of Brazilian numbers # coding: utf-8 # # Copyright (C) 2012 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License...
Add missing vat alias for Brazil # __init__.py - collection of Brazilian numbers # coding: utf-8 # # Copyright (C) 2012 Arthur de Jong # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; e...
43b5da74b17e313115e0576dbae2dd0e869b88af
course_discovery/apps/publisher/api/permissions.py
course_discovery/apps/publisher/api/permissions.py
from rest_framework.permissions import BasePermission from course_discovery.apps.publisher.mixins import check_course_organization_permission, check_roles_access from course_discovery.apps.publisher.models import OrganizationExtension from course_discovery.apps.publisher.utils import is_internal_user, is_publisher_use...
from rest_framework.permissions import BasePermission from course_discovery.apps.publisher.mixins import check_course_organization_permission, check_roles_access from course_discovery.apps.publisher.models import OrganizationExtension from course_discovery.apps.publisher.utils import is_internal_user, is_publisher_use...
Allow staff access to Publisher APIs
Allow staff access to Publisher APIs A few Publisher APIs were marked as only allowing publisher users. We should also let staff in. DISCO-1365
Python
agpl-3.0
edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery
from rest_framework.permissions import BasePermission from course_discovery.apps.publisher.mixins import check_course_organization_permission, check_roles_access from course_discovery.apps.publisher.models import OrganizationExtension from course_discovery.apps.publisher.utils import is_internal_user, is_publisher_use...
Allow staff access to Publisher APIs A few Publisher APIs were marked as only allowing publisher users. We should also let staff in. DISCO-1365 from rest_framework.permissions import BasePermission from course_discovery.apps.publisher.mixins import check_course_organization_permission, check_roles_access from cours...
5d182ac50d87c3d46d5419f449b7c9db7d9b2133
kb/keyboard.py
kb/keyboard.py
import abc from decimal import Decimal from core import Key, Keyboard class StandardKeyboard(Keyboard): """ A StandardKeyboard is a keyboard with standard Cherry MX key sizes and spacings. (see: http://www.fentek-ind.com/images/CHERRY_MX_keyswitch.pdf) """ def __init__(self): self.unit_height = ...
Implement parsing in StandardKeyboard class
Implement parsing in StandardKeyboard class
Python
mit
Cyanogenoid/kb-project
import abc from decimal import Decimal from core import Key, Keyboard class StandardKeyboard(Keyboard): """ A StandardKeyboard is a keyboard with standard Cherry MX key sizes and spacings. (see: http://www.fentek-ind.com/images/CHERRY_MX_keyswitch.pdf) """ def __init__(self): self.unit_height = ...
Implement parsing in StandardKeyboard class
898028dea2e04d52c32854752bda34d331c7696f
ynr/apps/candidatebot/management/commands/candidatebot_import_email_from_csv.py
ynr/apps/candidatebot/management/commands/candidatebot_import_email_from_csv.py
from __future__ import unicode_literals import csv from django.core.management.base import BaseCommand from candidatebot.helpers import CandidateBot from popolo.models import Person class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( 'filename', hel...
from __future__ import unicode_literals import csv from django.core.management.base import BaseCommand from candidatebot.helpers import CandidateBot from popolo.models import Person class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( 'filename', hel...
Move on if email exists
Move on if email exists
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
from __future__ import unicode_literals import csv from django.core.management.base import BaseCommand from candidatebot.helpers import CandidateBot from popolo.models import Person class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( 'filename', hel...
Move on if email exists from __future__ import unicode_literals import csv from django.core.management.base import BaseCommand from candidatebot.helpers import CandidateBot from popolo.models import Person class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( 'f...
edfd2edc5496cb412477b7409f43aa53acf7dea9
tests/test_loadproblem.py
tests/test_loadproblem.py
# -*- coding: utf-8 -*- import unittest import os from mathdeck import loadproblem class TestMathdeckLoadProblem(unittest.TestCase): def test_loadproblem_has_answers_attribute(self): file_name = 'has_answers_attribute.py' problem_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), ...
# -*- coding: utf-8 -*- import unittest import os from mathdeck import loadproblem class TestMathdeckLoadProblem(unittest.TestCase): def test_loadproblem_has_answers_attribute(self): file_name = 'has_answers_attribute.py' file = os.path.join(os.path.dirname(os.path.realpath(__file__)), ...
Fix parameter values for load function
Fix parameter values for load function
Python
apache-2.0
patrickspencer/mathdeck,patrickspencer/mathdeck
# -*- coding: utf-8 -*- import unittest import os from mathdeck import loadproblem class TestMathdeckLoadProblem(unittest.TestCase): def test_loadproblem_has_answers_attribute(self): file_name = 'has_answers_attribute.py' file = os.path.join(os.path.dirname(os.path.realpath(__file__)), ...
Fix parameter values for load function # -*- coding: utf-8 -*- import unittest import os from mathdeck import loadproblem class TestMathdeckLoadProblem(unittest.TestCase): def test_loadproblem_has_answers_attribute(self): file_name = 'has_answers_attribute.py' problem_dir = os.path.join(os.path...
e10f2b85775412dd60f11deea6e7a7f8b84edfbe
buysafe/urls.py
buysafe/urls.py
from django.conf.urls import patterns urlpatterns = patterns( 'buysafe.views', (r'^entry/(?P<order_id>\d+)/$', 'entry'), (r'^start/$', 'start'), (r'^success/(?P<payment_type>[01])/$', 'success'), (r'^fail/(?P<payment_type>[01])/$', 'fail'), (r'^check/(?P<payment_type>[01])/$', 'check') )
from django.conf.urls import patterns, url urlpatterns = patterns( 'buysafe.views', url(r'^entry/(?P<order_id>\d+)/$', 'entry', name='buysafe_pay'), (r'^start/$', 'start'), (r'^success/(?P<payment_type>[01])/$', 'success'), (r'^fail/(?P<payment_type>[01])/$', 'fail'), (r'^check/(?P<payment_typ...
Add name for entry view URL
Add name for entry view URL
Python
bsd-3-clause
uranusjr/django-buysafe
from django.conf.urls import patterns, url urlpatterns = patterns( 'buysafe.views', url(r'^entry/(?P<order_id>\d+)/$', 'entry', name='buysafe_pay'), (r'^start/$', 'start'), (r'^success/(?P<payment_type>[01])/$', 'success'), (r'^fail/(?P<payment_type>[01])/$', 'fail'), (r'^check/(?P<payment_typ...
Add name for entry view URL from django.conf.urls import patterns urlpatterns = patterns( 'buysafe.views', (r'^entry/(?P<order_id>\d+)/$', 'entry'), (r'^start/$', 'start'), (r'^success/(?P<payment_type>[01])/$', 'success'), (r'^fail/(?P<payment_type>[01])/$', 'fail'), (r'^check/(?P<payment_ty...
848d783bd988e0cdf31b690f17837ac02e77b43a
pypodio2/client.py
pypodio2/client.py
# -*- coding: utf-8 -*- from . import areas class FailedRequest(Exception): def __init__(self, error): self.error = error def __str__(self): return repr(self.error) class Client(object): """ The Podio API client. Callers should use the factory method OAuthClient to create instances...
# -*- coding: utf-8 -*- from . import areas class FailedRequest(Exception): def __init__(self, error): self.error = error def __str__(self): return repr(self.error) class Client(object): """ The Podio API client. Callers should use the factory method OAuthClient to create instances...
Add __dir__ method to Client in order to allow autocompletion in interactive terminals, etc.
Add __dir__ method to Client in order to allow autocompletion in interactive terminals, etc.
Python
mit
podio/podio-py
# -*- coding: utf-8 -*- from . import areas class FailedRequest(Exception): def __init__(self, error): self.error = error def __str__(self): return repr(self.error) class Client(object): """ The Podio API client. Callers should use the factory method OAuthClient to create instances...
Add __dir__ method to Client in order to allow autocompletion in interactive terminals, etc. # -*- coding: utf-8 -*- from . import areas class FailedRequest(Exception): def __init__(self, error): self.error = error def __str__(self): return repr(self.error) class Client(object): """ ...
4bad234471f1142ad4172a3ec423c90cec512b2b
setup.py
setup.py
#!/usr/bin/env python # coding: utf-8 import os import re from setuptools import setup, find_packages def load_required_modules(): with open(os.path.join(os.path.dirname(__file__), "requirements.txt")) as f: return [line.strip() for line in f.read().strip().split(os.linesep) if line.strip()] setup( ...
#!/usr/bin/env python # coding: utf-8 import os import re from setuptools import setup, find_packages def load_required_modules(): with open(os.path.join(os.path.dirname(__file__), "requirements.txt")) as f: return [line.strip() for line in f.readlines() if line.strip()] setup( name='dictmixin', ...
Fix bug which load_required_modules always returns list which length is 1
Fix bug which load_required_modules always returns list which length is 1
Python
mit
tadashi-aikawa/owlmixin
#!/usr/bin/env python # coding: utf-8 import os import re from setuptools import setup, find_packages def load_required_modules(): with open(os.path.join(os.path.dirname(__file__), "requirements.txt")) as f: return [line.strip() for line in f.readlines() if line.strip()] setup( name='dictmixin', ...
Fix bug which load_required_modules always returns list which length is 1 #!/usr/bin/env python # coding: utf-8 import os import re from setuptools import setup, find_packages def load_required_modules(): with open(os.path.join(os.path.dirname(__file__), "requirements.txt")) as f: return [line.strip() f...
8360bebbd4bf2b2e9d51c7aa16bdb9506a91883e
tests/chainer_tests/training_tests/extensions_tests/test_snapshot.py
tests/chainer_tests/training_tests/extensions_tests/test_snapshot.py
import unittest import mock from chainer import testing from chainer.training import extensions @testing.parameterize( {'trigger': ('epoch', 2)}, {'trigger': ('iteration', 10)}, ) class TestSnapshotObject(unittest.TestCase): def test_trigger(self): target = mock.MagicMock() snapshot_obj...
import unittest import mock from chainer import testing from chainer.training import extensions from chainer.training import trigger @testing.parameterize( {'trigger': ('epoch', 2)}, {'trigger': ('iteration', 10)}, {'trigger': trigger.IntervalTrigger(5, 'epoch')}, {'trigger': trigger.IntervalTrigger...
Add unit test to pass Trigger instance.
Add unit test to pass Trigger instance.
Python
mit
okuta/chainer,hvy/chainer,keisuke-umezawa/chainer,ktnyt/chainer,cupy/cupy,kiyukuta/chainer,rezoo/chainer,keisuke-umezawa/chainer,okuta/chainer,ktnyt/chainer,hvy/chainer,tkerola/chainer,niboshi/chainer,cupy/cupy,niboshi/chainer,jnishi/chainer,okuta/chainer,wkentaro/chainer,wkentaro/chainer,jnishi/chainer,cupy/cupy,cupy/...
import unittest import mock from chainer import testing from chainer.training import extensions from chainer.training import trigger @testing.parameterize( {'trigger': ('epoch', 2)}, {'trigger': ('iteration', 10)}, {'trigger': trigger.IntervalTrigger(5, 'epoch')}, {'trigger': trigger.IntervalTrigger...
Add unit test to pass Trigger instance. import unittest import mock from chainer import testing from chainer.training import extensions @testing.parameterize( {'trigger': ('epoch', 2)}, {'trigger': ('iteration', 10)}, ) class TestSnapshotObject(unittest.TestCase): def test_trigger(self): targe...
48ee32acb12519dc644dce5b4f95d285a3176242
flocker/restapi/_logging.py
flocker/restapi/_logging.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ This module defines the Eliot log events emitted by the API implementation. """ __all__ = [ "JSON_REQUEST", "REQUEST", ] from eliot import Field, ActionType LOG_SYSTEM = u"api" METHOD = Field.forTypes( u"method", [unicode, bytes], u"T...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ This module defines the Eliot log events emitted by the API implementation. """ __all__ = [ "JSON_REQUEST", "REQUEST", ] from eliot import Field, ActionType LOG_SYSTEM = u"api" METHOD = Field(u"method", lambda method: method, ...
Address review comment: Just pass through fields we aren't changing.
Address review comment: Just pass through fields we aren't changing.
Python
apache-2.0
Azulinho/flocker,lukemarsden/flocker,mbrukman/flocker,agonzalezro/flocker,achanda/flocker,Azulinho/flocker,1d4Nf6/flocker,runcom/flocker,LaynePeng/flocker,moypray/flocker,lukemarsden/flocker,achanda/flocker,wallnerryan/flocker-profiles,AndyHuu/flocker,Azulinho/flocker,runcom/flocker,1d4Nf6/flocker,adamtheturtle/flocker...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ This module defines the Eliot log events emitted by the API implementation. """ __all__ = [ "JSON_REQUEST", "REQUEST", ] from eliot import Field, ActionType LOG_SYSTEM = u"api" METHOD = Field(u"method", lambda method: method, ...
Address review comment: Just pass through fields we aren't changing. # Copyright Hybrid Logic Ltd. See LICENSE file for details. """ This module defines the Eliot log events emitted by the API implementation. """ __all__ = [ "JSON_REQUEST", "REQUEST", ] from eliot import Field, ActionType LOG_SYSTEM =...
cd300ebffd8974b5c9fe98e8368f26dc029ae41b
tests/schemas.py
tests/schemas.py
from marshmallow import Schema, fields class PetSchema(Schema): id = fields.Int(dump_only=True) name = fields.Str() class SampleSchema(Schema): runs = fields.Nested('RunSchema', many=True, exclude=('sample',)) count = fields.Int() class RunSchema(Schema): sample = fields.Nested(SampleSchema, ...
from marshmallow import Schema, fields class PetSchema(Schema): id = fields.Int(dump_only=True) name = fields.Str() class SampleSchema(Schema): runs = fields.Nested('RunSchema', many=True, exclude=('sample',)) count = fields.Int() class RunSchema(Schema): sample = fields.Nested(SampleSchema, ...
Add schema with Dict field
Add schema with Dict field
Python
mit
marshmallow-code/smore,marshmallow-code/apispec
from marshmallow import Schema, fields class PetSchema(Schema): id = fields.Int(dump_only=True) name = fields.Str() class SampleSchema(Schema): runs = fields.Nested('RunSchema', many=True, exclude=('sample',)) count = fields.Int() class RunSchema(Schema): sample = fields.Nested(SampleSchema, ...
Add schema with Dict field from marshmallow import Schema, fields class PetSchema(Schema): id = fields.Int(dump_only=True) name = fields.Str() class SampleSchema(Schema): runs = fields.Nested('RunSchema', many=True, exclude=('sample',)) count = fields.Int() class RunSchema(Schema): sample = f...
21e15235b2cd767e0da56a2a0d224824fda58c42
Tools/idle/ZoomHeight.py
Tools/idle/ZoomHeight.py
# Sample extension: zoom a window to maximum height import re import sys class ZoomHeight: menudefs = [ ('windows', [ ('_Zoom Height', '<<zoom-height>>'), ]) ] windows_keydefs = { '<<zoom-height>>': ['<Alt-F2>'], } unix_keydefs = { '<<zoom-height>>': ...
# Sample extension: zoom a window to maximum height import re import sys class ZoomHeight: menudefs = [ ('windows', [ ('_Zoom Height', '<<zoom-height>>'), ]) ] windows_keydefs = { '<<zoom-height>>': ['<Alt-F2>'], } unix_keydefs = { '<<zoom-height>>': ...
Move zoom height functionality to separate function.
Move zoom height functionality to separate function.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
# Sample extension: zoom a window to maximum height import re import sys class ZoomHeight: menudefs = [ ('windows', [ ('_Zoom Height', '<<zoom-height>>'), ]) ] windows_keydefs = { '<<zoom-height>>': ['<Alt-F2>'], } unix_keydefs = { '<<zoom-height>>': ...
Move zoom height functionality to separate function. # Sample extension: zoom a window to maximum height import re import sys class ZoomHeight: menudefs = [ ('windows', [ ('_Zoom Height', '<<zoom-height>>'), ]) ] windows_keydefs = { '<<zoom-height>>': ['<Alt-F2>'], ...
7635f6dd4a208982f68617c5aeec36fbc6d69dc9
tests/test_compat.py
tests/test_compat.py
from unittest import TestCase from ddt import ddt, data from aioresponses.compat import ( _vanilla_merge_url_params, _yarl_merge_url_params ) @ddt class CompatTestCase(TestCase): use_default_loop = False def setUp(self): self.url = 'http://example.com/api?foo=bar#fragment' @data( _...
from unittest import TestCase from ddt import ddt, data from aioresponses.compat import ( _vanilla_merge_url_params, _yarl_merge_url_params, URL ) @ddt class CompatTestCase(TestCase): use_default_loop = False def setUp(self): self.url = 'http://example.com/api?foo=bar#fragment' self.yarn_...
Fix tests when yarn is not available
Fix tests when yarn is not available
Python
mit
pnuckowski/aioresponses
from unittest import TestCase from ddt import ddt, data from aioresponses.compat import ( _vanilla_merge_url_params, _yarl_merge_url_params, URL ) @ddt class CompatTestCase(TestCase): use_default_loop = False def setUp(self): self.url = 'http://example.com/api?foo=bar#fragment' self.yarn_...
Fix tests when yarn is not available from unittest import TestCase from ddt import ddt, data from aioresponses.compat import ( _vanilla_merge_url_params, _yarl_merge_url_params ) @ddt class CompatTestCase(TestCase): use_default_loop = False def setUp(self): self.url = 'http://example.com/api?fo...
3dd22e9c88a0b02655481ef3ca0f5376b8aae1b5
spacy/tests/regression/test_issue834.py
spacy/tests/regression/test_issue834.py
# coding: utf-8 from __future__ import unicode_literals from io import StringIO word2vec_str = """, -0.046107 -0.035951 -0.560418 de -0.648927 -0.400976 -0.527124 . 0.113685 0.439990 -0.634510   -1.499184 -0.184280 -0.598371""" def test_issue834(en_vocab): f = StringIO(word2vec_str) vector_length = en_vocab...
# coding: utf-8 from __future__ import unicode_literals from io import StringIO import pytest word2vec_str = """, -0.046107 -0.035951 -0.560418 de -0.648927 -0.400976 -0.527124 . 0.113685 0.439990 -0.634510   -1.499184 -0.184280 -0.598371""" @pytest.mark.xfail def test_issue834(en_vocab): f = StringIO(word2vec_...
Mark vectors test as xfail (temporary)
Mark vectors test as xfail (temporary)
Python
mit
oroszgy/spaCy.hu,oroszgy/spaCy.hu,recognai/spaCy,Gregory-Howard/spaCy,aikramer2/spaCy,spacy-io/spaCy,Gregory-Howard/spaCy,oroszgy/spaCy.hu,raphael0202/spaCy,raphael0202/spaCy,aikramer2/spaCy,spacy-io/spaCy,honnibal/spaCy,raphael0202/spaCy,aikramer2/spaCy,aikramer2/spaCy,banglakit/spaCy,recognai/spaCy,honnibal/spaCy,Gre...
# coding: utf-8 from __future__ import unicode_literals from io import StringIO import pytest word2vec_str = """, -0.046107 -0.035951 -0.560418 de -0.648927 -0.400976 -0.527124 . 0.113685 0.439990 -0.634510   -1.499184 -0.184280 -0.598371""" @pytest.mark.xfail def test_issue834(en_vocab): f = StringIO(word2vec_...
Mark vectors test as xfail (temporary) # coding: utf-8 from __future__ import unicode_literals from io import StringIO word2vec_str = """, -0.046107 -0.035951 -0.560418 de -0.648927 -0.400976 -0.527124 . 0.113685 0.439990 -0.634510   -1.499184 -0.184280 -0.598371""" def test_issue834(en_vocab): f = StringIO(wo...