commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
c0297fd4837a83c177a89656c5ef591d7b5430d2 | add download remote file function | mp3Downloader.py | mp3Downloader.py | import urllib2
import subprocess
import os
import tempfile
import shutil
"""
http://feeds.gimletmedia.com/~r/hearstartup/~5/sqn8_rZ3xTM/GLT6849433183.mp3
"""
TEMP_DIR = './tmp'
OUTPUT_DIR = './output'
def cleanup():
shutil.rmtree(TEMP_DIR)
def create_ancillary_folders():
if not os.path.exists(OUTPUT_DIR):... | import urllib2
import subprocess
import os
import tempfile
import shutil
"""
http://feeds.gimletmedia.com/~r/hearstartup/~5/sqn8_rZ3xTM/GLT6849433183.mp3
"""
TEMP_DIR = './tmp'
OUTPUT_DIR = './output'
def cleanup():
shutil.rmtree(TEMP_DIR)
def create_ancillary_folders():
if not os.path.exists(OUTPUT_DIR):... | Python | 0.000001 |
a529eb18e9d114672350853a48a16d6036ca0c76 | split the former RulesView into three parts | ELiDE/rulesview.py | ELiDE/rulesview.py | # This file is part of LiSE, a framework for life simulation games.
# Copyright (C) 2013-2014 Zachary Spector, ZacharySpector@gmail.com
"""Widget to enable browsing rules and the functions that make them."""
from functools import partial
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.logger import... | # This file is part of LiSE, a framework for life simulation games.
# Copyright (C) 2013-2014 Zachary Spector, ZacharySpector@gmail.com
"""Widget to enable browsing rules and the functions that make them."""
from functools import partial
from kivy.clock import Clock
from kivy.logger import Logger
from kivy.adapters imp... | Python | 0 |
c4d809a3b8ccb24d684c489925dd6c9634dbdf55 | Remove use of DesiredCapabilities object, use Options object instead (#981) | splinter/driver/webdriver/firefox.py | splinter/driver/webdriver/firefox.py | # -*- coding: utf-8 -*-
# Copyright 2012 splinter 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 selenium.webdriver import Firefox
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from splinter.driver.webdri... | # -*- coding: utf-8 -*-
# Copyright 2012 splinter 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 selenium.webdriver import DesiredCapabilities, Firefox
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from s... | Python | 0 |
546b55248457055c4803d7ea65c21b92276309bd | Reformat and update copyright. | spotseeker_server/views/add_image.py | spotseeker_server/views/add_image.py | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
""" Changes
=================================================================
sbutler1@illinois.edu: adapt to a simplier RESTDispatch framework.
"""
from spotseeker_server.views.rest_dispatch import RESTDispatch, RESTExcep... | # Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
""" Copyright 2012, 2013 UW Information Technology, University of Washington
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtai... | Python | 0 |
913163a1acddc1d846eb269c04ae3dc60ecbc2bd | Update LongitudinalController.py | workspace/src/labs/src/lab5/LongitudinalController.py | workspace/src/labs/src/lab5/LongitudinalController.py | #!/usr/bin/env python
import rospy
import time
from barc.msg import ECU, Encoder
from numpy import pi
# from encoder
v_meas = 0.0
t0 = time.time()
r_tire = 0.05 # radius of the tire
servo_pwm = 1580.0
motor_pwm = 1500.0
motor_pwm_offset = 1500.0
# reference speed
v_ref = 0.5 # give reference ... | #!/usr/bin/env python
import rospy
import time
from barc.msg import ECU, Encoder
from numpy import pi
# from encoder
v_meas = 0.0
t0 = time.time()
ang_km1 = 0.0
ang_km2 = 0.0
n_FL = 0.0
n_FR = 0.0
n_BL = 0.0
n_BR = 0.0
r_tire = 0.05 # radius of the tire
servo_pwm... | Python | 0 |
b6363044cac862dd5bef54bc210c4beceaa90bdd | refactor fixtures and add 2 more tests for old collections | test/test_collection.py | test/test_collection.py | import pytest
import json
from girder.models.collection import Collection
from pytest_girder.assertions import assertStatusOk
@pytest.fixture
def collections(db):
yield [
Collection().createCollection('private collection', public=False),
Collection().createCollection('public collection', public=T... | import pytest
import json
from girder.models.collection import Collection
from pytest_girder.assertions import assertStatusOk
@pytest.fixture
def collections(db):
yield [
Collection().createCollection('private collection', public=False),
Collection().createCollection('public collection', public=T... | Python | 0 |
9ac7be20f3b25ca768f7260900928b2c7224f470 | Improve correlator test | test/test_correlator.py | test/test_correlator.py |
# http://www.apache.org/licenses/LICENSE-2.0
import unittest
import time
import numpy as np
import auspex.config as config
config.auspex_dummy_mode = True
from auspex.experiment import Experiment
from auspex.stream import DataStream, DataAxis, DataStreamDescriptor, OutputConnector
from auspex.filters.debug impor... |
# http://www.apache.org/licenses/LICENSE-2.0
import unittest
import time
import numpy as np
import auspex.config as config
config.auspex_dummy_mode = True
from auspex.experiment import Experiment
from auspex.stream import DataStream, DataAxis, DataStreamDescriptor, OutputConnector
from auspex.filters.debug impor... | Python | 0.000001 |
99241ab49a0a76472bb6f107a078248782af9626 | fix string_types in _compat | myhdl/_compat.py | myhdl/_compat.py | import sys
PY2 = sys.version_info[0] == 2
if not PY2:
string_types = (str,)
integer_types = (int,)
long = int
import builtins
else:
string_types = (str, unicode)
integer_types = (int, long)
long = long
import __builtin__ as builtins
| import sys
PY2 = sys.version_info[0] == 2
if not PY2:
string_types = (str, unicode)
integer_types = (int,)
long = int
import builtins
else:
string_types = (str,)
integer_types = (int, long)
long = long
import __builtin__ as builtins
| Python | 0.999999 |
aa9ce7092801e7ed8f3f86df0d1067279d13784d | Add armv7 support to create_ios_framework script (#4942) | sky/tools/create_ios_framework.py | sky/tools/create_ios_framework.py | #!/usr/bin/env python
# Copyright 2016 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.
import argparse
import subprocess
import shutil
import sys
import os
def main():
parser = argparse.ArgumentParser(description='Crea... | #!/usr/bin/env python
# Copyright 2016 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.
import argparse
import subprocess
import shutil
import sys
import os
def main():
parser = argparse.ArgumentParser(description='Crea... | Python | 0 |
97fa2f41bb00d2ceb0726b9cffdaa7c4ea97bc45 | Remove trailing whitespace from test/test_xml_parser.py | test/test_xml_parser.py | test/test_xml_parser.py | import unittest
from apel.db.loader.xml_parser import XMLParser, get_primary_ns
class XMLParserTest(unittest.TestCase):
'''
Test case for XMLParser
'''
data1 = '''<?xml version="1.0"?>
<ns:node xmlns:ns="http://fake.namespace.org" xmlns:ons="http://fake.othernamespace.org">
<ns:title>Some title</... | import unittest
from apel.db.loader.xml_parser import XMLParser, get_primary_ns
class XMLParserTest(unittest.TestCase):
'''
Test case for XMLParser
'''
data1 = '''<?xml version="1.0"?>
<ns:node xmlns:ns="http://fake.namespace.org" xmlns:ons="http://fake.othernamespace.org">
<ns:title>Some tit... | Python | 0.999959 |
37d20fe09aa19dde2ac50816958d9b1372bc76eb | indent (tabs!) | integration-test/1251-early-track-roads.py | integration-test/1251-early-track-roads.py | from . import FixtureTest
class EarlyUnclassifiedRoads(FixtureTest):
def test_early_track_road_z11_grade1_paved(self):
# asphalt, grade1, track (default zoom 11, no demotion)
self.load_fixtures([
'https://www.openstreetmap.org/way/329375413',
])
self.assert_has_featu... | from . import FixtureTest
class EarlyUnclassifiedRoads(FixtureTest):
def test_early_track_road_z11_grade1_paved(self):
# asphalt, grade1, track (default zoom 11, no demotion)
self.load_fixtures([
'https://www.openstreetmap.org/way/329375413',
])
self.assert_has_featu... | Python | 0 |
2e761252093b41d33cf57599ba8f05ec01e90a6a | delete noneffective codes | fate_flow/flowpy/client/base.py | fate_flow/flowpy/client/base.py | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | #
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Python | 0.000003 |
3662beb1afc72aaf00b1f9fe3ae0577cf2a4f138 | update docu | robo/solver/base_solver.py | robo/solver/base_solver.py | '''
Created on Aug 21, 2015
@author: Aaron Klein
'''
import os
import csv
import time
import errno
import logging
logger = logging.getLogger(__name__)
class BaseSolver(object):
def __init__(self, acquisition_func=None, model=None,
maximize_func=None, task=None, save_dir=None):
"""
... | '''
Created on Aug 21, 2015
@author: Aaron Klein
'''
import os
import csv
import time
import errno
import logging
logger = logging.getLogger(__name__)
class BaseSolver(object):
'''
classdocs
'''
def __init__(self, acquisition_func=None, model=None,
maximize_func=None, task=None, s... | Python | 0.000001 |
a9cfd2bc842631431e20b6c13d3d98535b643b3b | Fix mispelling | ixdjango/management/commands/copystatic.py | ixdjango/management/commands/copystatic.py | """
Copy static files to nginx location
.. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au>
"""
import logging
import os
from shutil import copy2, copystat
from django.conf import settings
from django.core.management.base import NoArgsCommand
LOGGER = logging.getLogger(__name__)
def co... | """
Copy static files to nginx location
.. moduleauthor:: Infoxchange Development Team <development@infoxchange.net.au>
"""
import logging
import os
from shutil import copy2, copystat
from django.conf import settings
from django.core.management.base import NoArgsCommand
LOGGER = logging.getLogger(__name__)
def co... | Python | 0.999687 |
7888b2b14a26deead0b4f1559b755fcf17cbb6f8 | correct style link | cte-collation-poc/fullbook.py | cte-collation-poc/fullbook.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import argparse
import requests
from lxml import etree
ARCHIVEJS = 'http://archive.cnx.org/contents/{}.json'
ARCHIVEHTML = 'http://archive.cnx.org/contents/{}.html'
NS = {'x': 'http://www.w3.org/1999/xhtml'}
HTMLWRAPPER = """<html xmlns="http://w... | #!/usr/bin/env python
from __future__ import print_function
import sys
import argparse
import requests
from lxml import etree
ARCHIVEJS = 'http://archive.cnx.org/contents/{}.json'
ARCHIVEHTML = 'http://archive.cnx.org/contents/{}.html'
NS = {'x': 'http://www.w3.org/1999/xhtml'}
HTMLWRAPPER = """<html xmlns="http://w... | Python | 0.000001 |
df85906e8e2a872ca99002b26af6ea5d495b23ca | fix wrong document string | data_migrator/emitters/__init__.py | data_migrator/emitters/__init__.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
This module contains all classes for models, managers and fields
* :class:`BaseEmitter`
* :class:`MySQLEmitter`
* ...
"""
from .mysql import MySQLEmitter
from .csv import CSVEmitter
| #!/usr/bin/python
# -*- coding: UTF-8 -*-
from .mysql import MySQLEmitter
from .csv import CSVEmitter
"""
This module contains all classes for models, managers and fields
* :class:`BaseEmitter`
* :class:`MySQLEmitter`
* ...
"""
| Python | 0.999949 |
0a05e6479ee907c3702cc895c5a180cd816a5433 | Build interdependencies. | d1_common_python/src/setup.py | d1_common_python/src/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`setup`
====================
:Synopsis: Create egg.
:Author: DataONE (Dahl)
"""
from setuptools import setup, find_packages
import d1_common
setup(
name='DataONE_Common',
version=d1_common.__version__,
author='DataONE Project',
author_email='developers@d... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`setup`
====================
:Synopsis: Create egg.
:Author: DataONE (Dahl)
"""
from setuptools import setup, find_packages
setup(
name='Python DataONE Common',
#version=d1_client.__version__,
description='Contains functionality common to projects that int... | Python | 0.00002 |
9664f6e6bf64e10fe0ce6fbfc3bbf20d4775cdb6 | Update MotorsControlFile.py | ProBot_BeagleBone/MotorsControlFile.py | ProBot_BeagleBone/MotorsControlFile.py | #!/usr/bin/python
# Python Standart Library Imports
import SabertoothFile
import PWMFile
import ProBotConstantsFile
# Initialization of classes from local files
Sabertooth = SabertoothFile.SabertoothClass()
PWM = PWMFile.PWMClass()
Pconst = ProBotConstantsFile.Constants()
class MotorsControlClass():
def Mo... | #!/usr/bin/python
import SabertoothFile
import PWMFile
import ProBotConstantsFile
# Initialization of classes from local files
Sabertooth = SabertoothFile.SabertoothClass()
PWM = PWMFile.PWMClass()
Pconst = ProBotConstantsFile.Constants()
class MotorsControlClass():
def MotorsControl(self,rightMotor, leftM... | Python | 0 |
76a39d6ab95f3b036b93a4a4680f7a5e37e981ec | Fix ElasticNet distance unit test | foolbox/tests/test_distances.py | foolbox/tests/test_distances.py | import pytest
import numpy as np
from foolbox import distances
from pytest import approx
def test_abstract_distance():
with pytest.raises(TypeError):
distances.Distance()
def test_base_distance():
class TestDistance(distances.Distance):
def _calculate(self):
return 22, 2
d... | import pytest
import numpy as np
from foolbox import distances
from pytest import approx
def test_abstract_distance():
with pytest.raises(TypeError):
distances.Distance()
def test_base_distance():
class TestDistance(distances.Distance):
def _calculate(self):
return 22, 2
d... | Python | 0.000001 |
19b0391aad11748cfca4b22616159a7b2893ff9b | Change api to return money objects | bluebottle/utils/serializers.py | bluebottle/utils/serializers.py | from HTMLParser import HTMLParser
import re
from moneyed import Money
from rest_framework import serializers
from .validators import validate_postal_code
from .models import Address, Language
class MoneySerializer(serializers.DecimalField):
def __init__(self, max_digits=12, decimal_places=2, **kwargs):
... | from HTMLParser import HTMLParser
import re
from moneyed import Money
from rest_framework import serializers
from .validators import validate_postal_code
from .models import Address, Language
class MoneySerializer(serializers.DecimalField):
def __init__(self, max_digits=12, decimal_places=2, **kwargs):
... | Python | 0.000001 |
d0d80c459bcac9b86fff146726e9e0e9ec788652 | fix some broken doctests | sympy/assumptions/assume.py | sympy/assumptions/assume.py | # doctests are disabled because of issue #1521
from sympy.core import Basic, Symbol
from sympy.core.relational import Relational
class AssumptionsContext(set):
"""Set representing assumptions.
This is used to represent global assumptions, but you can also use this
class to create your own local assumption... | # doctests are disabled because of issue #1521
from sympy.core import Basic, Symbol
from sympy.core.relational import Relational
class AssumptionsContext(set):
"""Set representing assumptions.
This is used to represent global assumptions, but you can also use this
class to create your own local assumption... | Python | 0.000041 |
c1a71ff5f5a777bb9ea28b6109334067f186eb5a | add Q.infinity(Add(args)) <==> any(map(Q.infinity, args)) | sympy/assumptions/newask.py | sympy/assumptions/newask.py | from __future__ import print_function, division
from sympy.core import Basic, Mul, Add, Pow
from sympy.assumptions.assume import global_assumptions, AppliedPredicate
from sympy.logic.inference import satisfiable
from sympy.logic.boolalg import And, Implies, Equivalent, Or
from sympy.assumptions.ask import Q
from symp... | from __future__ import print_function, division
from sympy.core import Basic, Mul, Add, Pow
from sympy.assumptions.assume import global_assumptions, AppliedPredicate
from sympy.logic.inference import satisfiable
from sympy.logic.boolalg import And, Implies, Equivalent, Or
from sympy.assumptions.ask import Q
from symp... | Python | 0.000029 |
50b19958b531cd94b537f3d911ce9b0c0b7f1ea2 | add ordereddictionary to store information about file .rooms loaded | trunk/editor/structdata/project.py | trunk/editor/structdata/project.py | #!/usr/bin/env python
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.data = OrderedDict()
self.data['world'] = None
... | #!/usr/bin/env python
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.informations = None
self.images = {}
self.items... | Python | 0 |
01e9fa344259faa6eeb7f0480975547d375e132f | add function to change and image. The function remove the image from the dictionary and add an image with the new key and new path to file | trunk/editor/structdata/project.py | trunk/editor/structdata/project.py | #!/usr/bin/env python
from misc.odict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.data = OrderedDict()
self.data['world'] = None
self.data['images'] = {}
self.data['items'] = OrderedDict()... | #!/usr/bin/env python
from misc.odict import OrderedDict
from subject import Subject
class Project(Subject):
def __init__(self):
super(Project, self).__init__()
self.data = OrderedDict()
self.data['world'] = None
self.data['images'] = {}
self.data['items'] = OrderedDict()... | Python | 0.000002 |
b04693387be08c1ead880d0e7472026ed76dad80 | Fix django.conf.urls.defaults imports | openstack_auth/urls.py | openstack_auth/urls.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | Python | 0.003868 |
78705f598e7e3325e871bd17ff353a31c71bc399 | Extend all admin form to Container Admin Form (json field) | opps/articles/forms.py | opps/articles/forms.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from opps.core.widgets import OppsEditor
from opps.containers.forms import ContainerAdminForm
from .models import Post, Album, Link
class PostAdminForm(ContainerAdminForm):
multiupload_link = '/fileupload/image/'
class Meta:
model = Post
widgets ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from .models import Post, Album, Link
from opps.core.widgets import OppsEditor
from opps.db.models.fields.jsonf import JSONFormField
from opps.fields.widgets import JSONField
from opps.fields.models import Field, FieldOption
class PostAdminForm... | Python | 0 |
67a7a3f5bc05265690a831dea7c4310af66870a8 | add channel obj on set_context_data * long_slug * level | opps/articles/utils.py | opps/articles/utils.py | # -*- coding: utf-8 -*-
from django.utils import timezone
from opps.articles.models import ArticleBox, Article
def set_context_data(self, SUPER, **kwargs):
context = super(SUPER, self).get_context_data(**kwargs)
article = Article.objects.filter(
site=self.site,
channel_long_slug__in=self.cha... | # -*- coding: utf-8 -*-
from django.utils import timezone
from opps.articles.models import ArticleBox, Article
def set_context_data(self, SUPER, **kwargs):
context = super(SUPER, self).get_context_data(**kwargs)
article = Article.objects.filter(
site=self.site,
channel_long_slug__in=self.cha... | Python | 0.000001 |
5ad21e185cf1984eb0a068387fdd1d73a4a56d15 | Create get context data, set template var opps_channel and opps_channel_conf issue #47 | opps/articles/views.py | opps/articles/views.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.sites.models import get_current_site
from django.core.paginator import Paginator, InvalidPage
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.shortcuts import get_object_or_404
from django.ut... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.sites.models import get_current_site
from django.core.paginator import Paginator, InvalidPage
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.shortcuts import get_object_or_404
from django.ut... | Python | 0 |
9a83ec4c80bec0cec45904a8998cd82a99a9b1b2 | Save `resources` as extra data in its entirety | social_core/backends/atlassian.py | social_core/backends/atlassian.py | from social_core.backends.oauth import BaseOAuth2
class AtlassianOAuth2(BaseOAuth2):
name = 'atlassian'
AUTHORIZATION_URL = 'https://accounts.atlassian.com/authorize'
ACCESS_TOKEN_METHOD = 'POST'
ACCESS_TOKEN_URL = 'https://api.atlassian.com/oauth/token'
DEFAULT_SCOPE = ['read:jira-user', 'offline... | from social_core.backends.oauth import BaseOAuth2
class AtlassianOAuth2(BaseOAuth2):
name = 'atlassian'
AUTHORIZATION_URL = 'https://accounts.atlassian.com/authorize'
ACCESS_TOKEN_METHOD = 'POST'
ACCESS_TOKEN_URL = 'https://api.atlassian.com/oauth/token'
DEFAULT_SCOPE = ['read:jira-user', 'offline... | Python | 0.000001 |
ad1fe8f7f636d8bf5bb92599b37ac8aa7849596e | Add small test | tests/grab_transport.py | tests/grab_transport.py | import pickle
import os
import sys
from test_server import Response
from tests.util import BaseGrabTestCase, only_grab_transport, temp_dir
from grab import Grab
from grab.error import GrabMisuseError
FAKE_TRANSPORT_CODE = """
from grab.transport.curl import CurlTransport
class FakeTransport(CurlTransport):
pass... | import pickle
import os
import sys
from test_server import Response
from tests.util import BaseGrabTestCase, only_grab_transport, temp_dir
from grab import Grab
from grab.error import GrabMisuseError
FAKE_TRANSPORT_CODE = """
from grab.transport.curl import CurlTransport
class FakeTransport(CurlTransport):
pass... | Python | 0.00005 |
e66178cc0521426036d4c9166bf76e9379bc62ef | disable Run tests temporarily | cloudrun/tests.py | cloudrun/tests.py | import pytest
import uuid
from .cloudrun import Cloudrun
from .run import Run
token = uuid.uuid4().hex
id = uuid.uuid4().hex
def test_cloudrun_init():
assert type(Cloudrun(token)) is Cloudrun
assert Cloudrun(token).token == token
#def test_run_init():
# assert type(Run(token,id)) is Run
# assert Run(to... | import pytest
import uuid
from .cloudrun import Cloudrun
from .run import Run
token = uuid.uuid4().hex
id = uuid.uuid4().hex
def test_cloudrun_init():
assert type(Cloudrun(token)) is Cloudrun
assert Cloudrun(token).token == token
def test_run_init():
assert type(Run(token,id)) is Run
assert Run(token... | Python | 0.000001 |
5af29cfa071360265b1c31538f89e806ae4eabc4 | Fix #142: Testrunner and SOUTH_TESTS_MIGRATE broken on 1.1. | south/management/commands/test.py | south/management/commands/test.py | from django.core import management
from django.core.management.commands import test
from django.core.management.commands import syncdb
from django.conf import settings
from syncdb import Command as SyncDbCommand
class MigrateAndSyncCommand(SyncDbCommand):
option_list = SyncDbCommand.option_list
for opt in op... | from django.core import management
from django.core.management.commands import test
from django.core.management.commands import syncdb
from django.conf import settings
class Command(test.Command):
def handle(self, *args, **kwargs):
if not hasattr(settings, "SOUTH_TESTS_MIGRATE") or not settings.SOUTH_... | Python | 0.000001 |
39874a0ddb65582a04ea32fa2b05bacc968f56f3 | Update max-chunks-to-make-sorted-ii.py | Python/max-chunks-to-make-sorted-ii.py | Python/max-chunks-to-make-sorted-ii.py | # Time: O(nlogn)
# Space: O(n)
# This question is the same as "Max Chunks to Make Sorted"
# except the integers of the given array are not necessarily distinct,
# the input array could be up to length 2000, and the elements could be up to 10**8.
#
# Given an array arr of integers (not necessarily distinct),
# we spli... | # Time: O(nlogn)
# Space: O(n)
class Solution(object):
def maxChunksToSorted(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
def compare(i1, i2):
return arr[i1]-arr[i2] if arr[i1] != arr[i2] else i1-i2
idxs = [i for i in xrange(len(arr))]
... | Python | 0.000001 |
5c20418b8e5f6dc033d1a7c515d30d5e9b026db5 | Fix sampleproject view | sampleproject/bot/views.py | sampleproject/bot/views.py | from django.shortcuts import render
from django.conf import settings
from django_telegrambot.apps import DjangoTelegramBot
# Create your views here.
def index(request):
bot_list = DjangoTelegramBot.bots
context = {'bot_list': bot_list, 'update_mode':settings.DJANGO_TELEGRAMBOT['MODE']}
return render(reques... | from django.shortcuts import render
from django.conf import settings
from django_telegrambot.apps import DjangoTelegramBot
# Create your views here.
def index(request):
bot_list = DjangoTelegramBot.bots
context = {'bot_list': bot_list, 'update_mode':settings.TELEGRAM_BOT_MODE}
return render(request, 'bot/i... | Python | 0.000001 |
f0f31ea0a86620b77073b5da0dca386b337b98da | update prop2part tests | tests/prop2part_test.py | tests/prop2part_test.py | #!/usr/bin/env python
"""
Tests for abstract.prop2partition
"""
from tulip.abstract import prop2part
import tulip.polytope as pc
import numpy as np
def prop2part_test():
state_space = pc.Polytope.from_box(np.array([[0., 2.],[0., 2.]]))
cont_props = []
A = []
b = []
A.append(np.array([[1.... | #!/usr/bin/env python
"""
Tests for abstract.prop2partition
"""
from tulip.abstract import prop2part
import tulip.polytope as pc
import numpy as np
def prop2part_test():
state_space = pc.Polytope.from_box(np.array([[0., 2.],[0., 2.]]))
cont_props = []
A = []
b = []
A.append(np.array([[1.... | Python | 0 |
81bbe22cd92ea834f059b963cf0d0127f2d45a19 | Add SUSPENDED to new "error" status group. | core/constants.py | core/constants.py |
""" Norc-specific constants.
Any constants required for the core execution of Norc
should be defined here if possible.
"""
# The maximum number of tasks an Executor is allowed to run at once.
CONCURRENCY_LIMIT = 4
# How often a scheduler can poll the database for new schedules.
SCHEDULER_PERIOD = 5
# How many new... |
""" Norc-specific constants.
Any constants required for the core execution of Norc
should be defined here if possible.
"""
# The maximum number of tasks an Executor is allowed to run at once.
CONCURRENCY_LIMIT = 4
# How often a scheduler can poll the database for new schedules.
SCHEDULER_PERIOD = 5
# How many new... | Python | 0 |
77cb3f0037dad2444560d8231e6ffb4f072e19f5 | Remove Continue click after New | tests/steps/creation.py | tests/steps/creation.py | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from behave import step
from dogtail.rawinput import typeText
from dogtail.predicate import GenericPredicate
from time import sleep
from utils import get_showing_node_name
@step('Create new box "{name}" from "{item}" menuitem')
def create_machine_from_me... | # -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from behave import step
from dogtail.rawinput import typeText
from dogtail.predicate import GenericPredicate
from time import sleep
from utils import get_showing_node_name
@step('Create new box "{name}" from "{item}" menuitem')
def create_machine_from_me... | Python | 0 |
d32b2494c1a72d040a651bbb2f0abb7a94c1d2db | remove stray line | tests/test-datatypes.py | tests/test-datatypes.py | """Test datatypes."""
from statscraper.datatypes import Datatype
from statscraper import Dimension, DimensionValue
def test_allowed_values():
"""Datatypes shuold have allowed values."""
dt = Datatype("region")
assert("Ale kommun" in dt.allowed_values)
def test_b():
"""Dimension values should be tran... | """Test datatypes."""
from statscraper.datatypes import Datatype
from statscraper import Dimension, DimensionValue
def test_allowed_values():
"""Datatypes shuold have allowed values."""
dt = Datatype("region")
assert("Ale kommun" in dt.allowed_values)
def test_b():
"""Dimension values should be tran... | Python | 0.002086 |
e8cffceecf79b42790ccab1c61a2da06ae6529cd | comment no longer relevant. dealt with 2FA already | corehq/apps/sso/backends.py | corehq/apps/sso/backends.py | from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from corehq.apps.sso.models import IdentityProvider, AuthenticatedEmailDomain
from corehq.apps.sso.utils.user_helpers import get_email_domain_from_username
class SsoBackend(ModelBackend):
"""
Authenticates again... | from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from corehq.apps.sso.models import IdentityProvider, AuthenticatedEmailDomain
from corehq.apps.sso.utils.user_helpers import get_email_domain_from_username
class SsoBackend(ModelBackend):
"""
Authenticates again... | Python | 0 |
52c3981b8880085d060f874eb8feace6ac125411 | Replace exact equality assert with isclose in bands cli | tests/test_cli_bands.py | tests/test_cli_bands.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Dominik Gresch <greschd@gmx.ch>
import os
import pytest
import tempfile
import numpy as np
import bandstructure_utils as bs
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
from parameters import SAMPLES_DIR
def test_cli_ban... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Dominik Gresch <greschd@gmx.ch>
import os
import pytest
import tempfile
import bandstructure_utils as bs
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
from parameters import SAMPLES_DIR
def test_cli_bands():
samples_d... | Python | 0.000116 |
8b4b5eb2506feed164b69efa66b4cdae159182c3 | Fix pre-commit issues in the cli_parse tests. | tests/test_cli_parse.py | tests/test_cli_parse.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""Tests for the 'parse' CLI command."""
import tempfile
import pytest
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
@pytest.ma... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2015-2018, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
import pytest
import tempfile
from click.testing import CliRunner
import tbmodels
from tbmodels._cli import cli
@pytest.mark.parametrize('pos_kind', ['wannier', 'ne... | Python | 0 |
78434bafbcc60ba7207d63481d3179474ae939ed | change to using scontrol for getting job state by default | pipeline/pipeline/batch.py | pipeline/pipeline/batch.py | import os, re
import subprocess
import time
def write_slurm_script(filename, cmd, **batch_options):
with open(filename, 'w') as fout:
fout.write('#!/bin/bash\n')
for opts in batch_options.items():
fout.write('#SBATCH --{0}={1}\n'.format(*opts))
fout.write('\n')
... | import os, re
import subprocess
import time
def write_slurm_script(filename, cmd, **batch_options):
with open(filename, 'w') as fout:
fout.write('#!/bin/bash\n')
for opts in batch_options.items():
fout.write('#SBATCH --{0}={1}\n'.format(*opts))
fout.write('\n')
... | Python | 0 |
047a1a6072905e650d8a8c6dee3078a14b9df759 | Use Path instead of PosixPath | tests/test_corrector.py | tests/test_corrector.py | # -*- coding: utf-8 -*-
import pytest
from pathlib import Path
from thefuck import corrector, const
from tests.utils import Rule, Command, CorrectedCommand
from thefuck.corrector import get_corrected_commands, organize_commands
class TestGetRules(object):
@pytest.fixture
def glob(self, mocker):
resul... | # -*- coding: utf-8 -*-
import pytest
from pathlib import PosixPath
from thefuck import corrector, const
from tests.utils import Rule, Command, CorrectedCommand
from thefuck.corrector import get_corrected_commands, organize_commands
class TestGetRules(object):
@pytest.fixture
def glob(self, mocker):
... | Python | 0.000001 |
4180085e3bf6d0dd1f28233d4ac62198ebeb9814 | Fix wrong assert | tests/test_histogram.py | tests/test_histogram.py | # vim: set fileencoding=utf-8 :
import unittest
import pyvips
from .helpers import PyvipsTester, JPEG_FILE
class TestHistogram(PyvipsTester):
def test_hist_cum(self):
im = pyvips.Image.identity()
sum = im.avg() * 256
cum = im.hist_cum()
p = cum(255, 0)
self.assertEqual(... | # vim: set fileencoding=utf-8 :
import unittest
import pyvips
from .helpers import PyvipsTester, JPEG_FILE
class TestHistogram(PyvipsTester):
def test_hist_cum(self):
im = pyvips.Image.identity()
sum = im.avg() * 256
cum = im.hist_cum()
p = cum(255, 0)
self.assertEqual(... | Python | 0.0022 |
eacf0414f3fed58c31f280e9ad02df7e610d422d | add exception handle for KeyControlInterrupt | pagrant/basecommand.py | pagrant/basecommand.py | #!/usr/bin/python
#coding:utf8
__author__ = ['markshao']
import sys
from pagrant.vendors.myoptparser import optparse
from pagrant import cmdoptions
from pagrant.cmdparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pagrant.util import get_prog, format_exc
from pagrant.exceptions import PagrantError... | #!/usr/bin/python
#coding:utf8
__author__ = ['markshao']
import sys
from pagrant.vendors.myoptparser import optparse
from pagrant import cmdoptions
from pagrant.cmdparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pagrant.util import get_prog, format_exc
from pagrant.exceptions import PagrantError... | Python | 0.000001 |
8e5ffc7ed1db1d17e55cf538fc9858705ecc9dd2 | Bump version to 1.20.4 | platformio_api/__init__.py | platformio_api/__init__.py | # Copyright 2014-present Ivan Kravets <me@ikravets.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | # Copyright 2014-present Ivan Kravets <me@ikravets.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Python | 0 |
5d6fd6f627b6fe073d95499a58575532618ef484 | Add many=True to test_recursive | tests/test_relations.py | tests/test_relations.py | from rest_framework import serializers
from rest_framework.test import APISimpleTestCase
from drf_extra_fields.relations import (
PresentablePrimaryKeyRelatedField,
PresentableSlugRelatedField,
)
from .utils import MockObject, MockQueryset
class PresentationSerializer(serializers.Serializer):
def to_repr... | from rest_framework import serializers
from rest_framework.test import APISimpleTestCase
from drf_extra_fields.relations import (
PresentablePrimaryKeyRelatedField,
PresentableSlugRelatedField,
)
from .utils import MockObject, MockQueryset
class PresentationSerializer(serializers.Serializer):
def to_repr... | Python | 0.998278 |
14a2ad18e70b6bc35e8d64c56b37520ebdb9fa3c | Add tests for full resource name | tests/test_resources.py | tests/test_resources.py | # Copyright 2019 The resource-policy-evaluation-library Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | # Copyright 2019 The resource-policy-evaluation-library Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | Python | 0 |
b144eb21003fc3f2e13e3d88b93a947a458cae24 | test designed to fail confirmed - reverted | tests/test_simulator.py | tests/test_simulator.py | # test_simulator.py written by Duncan Murray 28/4/2015
import unittest
import os
import sys
root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + 'vais')
ref_folder = root_folder + os.sep + "data"
sys.path.append(root_folder)
import planet as planet
import battle as ... | # test_simulator.py written by Duncan Murray 28/4/2015
import unittest
import os
import sys
root_folder = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + os.sep + ".." + os.sep + 'vais')
ref_folder = root_folder + os.sep + "data"
sys.path.append(root_folder)
import planet as planet
import battle as ... | Python | 0 |
d81c6e4ce44b0ee63fa116cb69efce17b8bb2c3f | test getting message via POP | test/test_pop_connection.py | test/test_pop_connection.py | """Tests for POP connection handling."""
import os
import pathlib
import unittest
from maildaemon.config import load_config
from maildaemon.pop_connection import POPConnection
_HERE = pathlib.Path(__file__).parent
_TEST_CONFIG_PATH = _HERE.joinpath('maildaemon_test_config.json')
@unittest.skipUnless(os.environ.get... | """Tests for POP connection handling."""
import os
import pathlib
import unittest
from maildaemon.config import load_config
from maildaemon.pop_connection import POPConnection
_HERE = pathlib.Path(__file__).parent
_TEST_CONFIG_PATH = _HERE.joinpath('maildaemon_test_config.json')
@unittest.skipUnless(os.environ.get... | Python | 0 |
39a1c6c8c3795775dc8811e8e195feaa4e973cd8 | remove comments | tests/test_validator.py | tests/test_validator.py | # from unittest.mock import patch
import json
import unittest
from dacsspace.validator import Validator
class TestValidator(unittest.TestCase):
def test_validator(self):
json_file = "/Users/aberish/Documents/GitHub/DACSspace/fixtures/resource.json"
with open(json_file, 'r') as f:
js... | # from unittest.mock import patch
import json
import unittest
from dacsspace.validator import Validator
class TestValidator(unittest.TestCase):
def test_validator(self):
json_file = "/Users/aberish/Documents/GitHub/DACSspace/fixtures/resource.json"
with open(json_file, 'r') as f:
js... | Python | 0 |
c2b55844bff3de39ac9a0a4bd8860306da731662 | fix for testing 401 after redirection | testsuite/test_views.py | testsuite/test_views.py | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013, 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your opt... | Python | 0 |
77199b8c6b06054c7741433ec2fadd654a636677 | add hour var | tilejetlogs/tilelogs.py | tilejetlogs/tilelogs.py | def buildTileRequestDocument(tileorigin, tilesource, x, y, z, status, datetime, ip):
r = {
'ip': ip,
'origin': tileorigin if tileorigin else "",
'source': tilesource,
'location': z+'/'+x+'/'+y,
'z': z,
'status': status,
'year': datetime.strftime('%Y'),
... | def buildTileRequestDocument(tileorigin, tilesource, x, y, z, status, datetime, ip):
r = {
'ip': ip,
'origin': tileorigin if tileorigin else "",
'source': tilesource,
'location': z+'/'+x+'/'+y,
'z': z,
'status': status,
'year': datetime.strftime('%Y'),
... | Python | 0.000016 |
b9faf604095e799b3c3cd1e6a98bb9a87c64340b | add unit tests for rds clone | test/unit/test_disco_rds.py | test/unit/test_disco_rds.py | """
Tests of disco_rds
"""
import unittest
from mock import MagicMock, patch
from disco_aws_automation.disco_rds import DiscoRDS
from disco_aws_automation.exceptions import RDSEnvironmentError
from test.helpers.patch_disco_aws import get_mock_config
TEST_ENV_NAME = 'unittestenv'
TEST_VPC_ID = 'vpc-56e10e3d' # the h... | """
Tests of disco_rds
"""
import unittest
from mock import MagicMock, patch
from disco_aws_automation.disco_rds import DiscoRDS
TEST_ENV_NAME = 'unittestenv'
TEST_VPC_ID = 'vpc-56e10e3d' # the hard coded VPC Id that moto will always return
def _get_vpc_mock():
"""Nastily copied from test_disco_elb"""
vpc_... | Python | 0 |
d8556707aa3ab0bc89878e0b5daaaeb7b54616ae | Disable images | zephyr/lib/bugdown.py | zephyr/lib/bugdown.py | import re
import markdown
class Bugdown(markdown.Extension):
def extendMarkdown(self, md, md_globals):
del md.inlinePatterns['image_link']
del md.inlinePatterns['image_reference']
# We need to re-initialize the markdown engine every 30 messages
# due to some sort of performance leak in the markdow... | import re
import markdown
# We need to re-initialize the markdown engine every 30 messages
# due to some sort of performance leak in the markdown library.
MAX_MD_ENGINE_USES = 30
_md_engine = None
_use_count = 0
# A link starts after whitespace, and cannot contain spaces,
# end parentheses, or end brackets (which wo... | Python | 0 |
e4d32def2ef91518198e6a500908ea3839c43257 | Fix typo | cairis/data/DimensionDAO.py | cairis/data/DimensionDAO.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | Python | 0.999999 |
4c1d0877fabf3f95c488e58d2460a9ca2330b3eb | Support --host for devserver | zeus/cli/devserver.py | zeus/cli/devserver.py | import click
import os
import socket
import sys
from subprocess import list2cmdline
from honcho.manager import Manager
from .base import cli
DEFAULT_HOST_NAME = socket.gethostname().split(".", 1)[0].lower()
@cli.command()
@click.option("--environment", default="development", help="The environment name.")
@click.op... | import click
import os
import socket
import sys
from subprocess import list2cmdline
from honcho.manager import Manager
from .base import cli
DEFAULT_HOST_NAME = socket.gethostname().split(".", 1)[0].lower()
@cli.command()
@click.option("--environment", default="development", help="The environment name.")
@click.op... | Python | 0 |
1748d039feb40ddb1ceef0cf2f7b49270d0aae6e | Change to support Python3 | carmen/resolvers/profile.py | carmen/resolvers/profile.py | """Resolvers based on Twitter user profile data."""
import re
import warnings
from ..names import *
from ..resolver import AbstractResolver, register
STATE_RE = re.compile(r'.+,\s*(\w+)')
NORMALIZATION_RE = re.compile(r'\s+|\W')
def normalize(location_name, preserve_commas=False):
"""Normalize *location_name... | """Resolvers based on Twitter user profile data."""
import re
import warnings
from ..names import *
from ..resolver import AbstractResolver, register
STATE_RE = re.compile(r'.+,\s*(\w+)')
NORMALIZATION_RE = re.compile(r'\s+|\W')
def normalize(location_name, preserve_commas=False):
"""Normalize *location_name... | Python | 0 |
d9b7be65aae78a76454cae4f1f75029f1fa5084b | rename mapper to mapfxn to avoid confusion with mrjob.MRJob.mapper() | specializers/ftdock/cloud_dock.py | specializers/ftdock/cloud_dock.py | from mrjob.protocol import PickleProtocol as protocol
from asp.jit import mapreduce_support as mr
import cPickle as pickle
class FtdockMRJob(mr.AspMRJob):
DEFAULT_INPUT_PROTOCOL = 'pickle'
DEFAULT_PROTOCOL = 'pickle'
def configure_options(self):
super(mr.AspMRJob, self).configure_options()
... | from mrjob.protocol import PickleProtocol as protocol
from asp.jit import mapreduce_support as mr
import cPickle as pickle
class FtdockMRJob(mr.AspMRJob):
DEFAULT_INPUT_PROTOCOL = 'pickle'
DEFAULT_PROTOCOL = 'pickle'
def configure_options(self):
super(mr.AspMRJob, self).configure_options()
... | Python | 0 |
c8a280d6466623b8d76fa01c12ebf295151d35d6 | remove primary key constraint | wim-adaptor/vtn-api/database/sqlalchemy_declaritive.py | wim-adaptor/vtn-api/database/sqlalchemy_declaritive.py | import os
import sys
from sqlalchemy import create_engine, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Connectivity(Base):
__tablename__ = 'connectivity'
# define the columns for the table
s... | import os
import sys
from sqlalchemy import create_engine, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Connectivity(Base):
__tablename__ = 'connectivity'
# define the columns for the table
s... | Python | 0.000384 |
f984db30c4d4cab1377d21a73ec0b802590f8a51 | Update sqlalchemy migrate scripts for postgres | trove/db/sqlalchemy/migrate_repo/versions/014_update_instance_flavor_id.py | trove/db/sqlalchemy/migrate_repo/versions/014_update_instance_flavor_id.py | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Python | 0.000001 |
dbe1ac7fda9188e59479ff4716141651d627f76c | Fix cheroot.test.test_errors doc spelling | cheroot/test/test_errors.py | cheroot/test/test_errors.py | """Test suite for ``cheroot.errors``."""
import pytest
from cheroot import errors
from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS
@pytest.mark.parametrize(
'err_names,err_nums',
(
(('', 'some-nonsense-name'), []),
(
(
'EPROTOTYPE', 'EAGAIN', 'EWOULDBLOCK',
... | """Test suite for ``cheroot.errors``."""
import pytest
from cheroot import errors
from .._compat import IS_LINUX, IS_MACOS, IS_WINDOWS
@pytest.mark.parametrize(
'err_names,err_nums',
(
(('', 'some-nonsense-name'), []),
(
(
'EPROTOTYPE', 'EAGAIN', 'EWOULDBLOCK',
... | Python | 0.000442 |
423a15d7c8841b40bddbd129b2abfb1135f0b7c0 | fix date parsing in logsearch | scripts/logfetch/search.py | scripts/logfetch/search.py | import os
import re
import sys
import fnmatch
import logfetch_base
from termcolor import colored
def find_cached_logs(args):
matching_logs = []
log_fn_match = get_matcher(args)
for filename in os.listdir(args.dest):
if fnmatch.fnmatch(filename, log_fn_match) and in_date_range(args, filename):
... | import os
import re
import sys
import fnmatch
import logfetch_base
from termcolor import colored
def find_cached_logs(args):
matching_logs = []
log_fn_match = get_matcher(args)
for filename in os.listdir(args.dest):
if fnmatch.fnmatch(filename, log_fn_match) and in_date_range(args, filename):
... | Python | 0.000005 |
fc1d468d6602022405d4959ea8d12c825a1916f0 | Add AuthToken model | passwordless/models.py | passwordless/models.py | from datetime import timedelta
import uuid
from django.db import models
from django.utils import timezone
# Create your models here.
class User(models.Model):
"""
User model
This User model eschews passwords, relying instead on emailed OTP tokens.
"""
username = models.CharField(max_length=30,... | from django.db import models
# Create your models here.
class User(models.Model):
"""
User model
This User model eschews passwords, relying instead on emailed OTP tokens.
"""
username = models.CharField(max_length=30, unique=True)
email = models.EmailField(null=True)
is_active = models.B... | Python | 0 |
d9e9e4e9cce22c608ed39b0db1d5edc7ae277332 | Correct metaclass implementation | patchboard/resource.py | patchboard/resource.py | # resource.py
#
# Copyright 2014 BitVault.
from __future__ import print_function
import json
from exception import PatchboardError
class ResourceType(type):
"""A metaclass for resource classes."""
# Must override to supply default arguments
def __new__(cls, name, patchboard, definition, schema, mapp... | # resource.py
#
# Copyright 2014 BitVault.
from __future__ import print_function
import json
from exception import PatchboardError
class ResourceType(type):
"""A metaclass for resource classes."""
# Must override to supply default arguments
def __new__(cls, name, patchboard, definition, schema, mapp... | Python | 0.000002 |
5114bf3960b944c193c37ef8ecbcac50ae098d02 | Add InvalidLengthError class | pathvalidate/_error.py | pathvalidate/_error.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
class NullNameError(ValueError):
"""
Raised when a name is empty.
"""
class InvalidCharError(ValueError):
"""
Raised when includes in... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
class NullNameError(ValueError):
"""
Raised when a name is empty.
"""
class InvalidCharError(ValueError):
"""
Raised when includes in... | Python | 0 |
b479491e914c271a41ba92c958c6e3d42ccdb799 | add get_followers to twitter api | polbotcheck/twitter_api.py | polbotcheck/twitter_api.py | import tweepy
import json
from keys import myauth
import pprint
import time
import db
auth = tweepy.OAuthHandler(myauth['consumer_key'], myauth['consumer_secret'])
auth.set_access_token(myauth['access_token'], myauth['access_token_secret'] )
api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=Tru... | import tweepy
import json
from keys import myauth
import pprint
import time
import db
auth = tweepy.OAuthHandler(myauth['consumer_key'], myauth['consumer_secret'])
auth.set_access_token(myauth['access_token'], myauth['access_token_secret'] )
api = tweepy.API(auth,wait_on_rate_limit=True, wait_on_rate_limit_notify=Tru... | Python | 0 |
41df2254187bd895e1884563ac0cc3a4353ced5b | use string types instead of unicode in web.querystring | circuits/web/querystring.py | circuits/web/querystring.py | # -*- coding: utf-8 -*-
try:
from urlparse import parse_qsl
except ImportError:
from urllib.parse import parse_qsl # NOQA
from circuits.six import iteritems, string_types
def parse(data):
obj = QueryStringParser(data)
return obj.result
class QueryStringToken(object):
ARRAY = "ARRAY"
OB... | # -*- coding: utf-8 -*-
try:
from urlparse import parse_qsl
except ImportError:
from urllib.parse import parse_qsl # NOQA
from circuits.six import iteritems, text_type
def parse(data):
obj = QueryStringParser(data)
return obj.result
class QueryStringToken(object):
ARRAY = "ARRAY"
OBJEC... | Python | 0.000005 |
042edce052d5307fff8dfbce8c08b72fb72af7f1 | Remove some noise | ckanext/groupadmin/authz.py | ckanext/groupadmin/authz.py | '''This module monkey patches functions in ckan/authz.py and replaces the
default roles with custom roles and decorates
has_user_permission_for_group_org_org to allow a GroupAdmin to admin groups.
GroupAdmins can manage all organizations/groups, but have no other sysadmin
powers.
'''
from ckan import authz, model
from ... | '''This module monkey patches functions in ckan/authz.py and replaces the
default roles with custom roles and decorates
has_user_permission_for_group_org_org to allow a GroupAdmin to admin groups.
GroupAdmins can manage all organizations/groups, but have no other sysadmin
powers.
'''
from ckan import authz, model
from ... | Python | 0.000199 |
afb400e16c1335531f259218a8b9937de48644e9 | Update stream health health api url | polyaxon/checks/streams.py | polyaxon/checks/streams.py | from checks.base import Check
from checks.results import Result
from libs.api import get_settings_ws_api_url
from libs.http import safe_request
class StreamsCheck(Check):
@classmethod
def run(cls):
response = safe_request('{}/_health'.format(get_settings_ws_api_url()), 'GET')
status_code = re... | from checks.base import Check
from checks.results import Result
from libs.api import get_settings_ws_api_url
from libs.http import safe_request
class StreamsCheck(Check):
@classmethod
def run(cls):
response = safe_request(get_settings_ws_api_url(), 'GET')
status_code = response.status_code
... | Python | 0.000001 |
35f9f3b3a1ca9174194975e5281682c2712b653f | add get_absolute_url to article categories too | project/articles/models.py | project/articles/models.py | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
from markitup.fields import MarkupField
from autoslug import AutoSlugField
from sorl.thumbnail import ImageField
class Category(models.Model):
class Meta:
verbose_name = _('Category')
... | from django.db import models
from django.utils.translation import ugettext as _
from django.utils.timezone import now
from markitup.fields import MarkupField
from autoslug import AutoSlugField
from sorl.thumbnail import ImageField
class Category(models.Model):
class Meta:
verbose_name = _('Category')
... | Python | 0 |
0623212baaccb938e19891a50cca58b33b339f9c | Improve version handling | oddt/__init__.py | oddt/__init__.py | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks,
ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | """Open Drug Discovery Toolkit
==============================
Universal and easy to use resource for various drug discovery tasks,
ie docking, virutal screening, rescoring.
Attributes
----------
toolkit : module,
Toolkits backend module, currenlty OpenBabel [ob] and RDKit [rdk].
This settin... | Python | 0.000002 |
f4d41f9a75f464dcf2dca2953536ed28c6221b33 | numPages should be an int | server/central_psparser.py | server/central_psparser.py | import logging
import json
import re
class PSParser():
def __init__(self):
self.logger = logging.getLogger("PSParser")
self.logger.info("Loaded PostScript Parser")
def __getPSFromJID(self, jid):
jobFile = open(jid, 'r')
job = json.load(jobFile)
jobFile.close()
... | import logging
import json
import re
class PSParser():
def __init__(self):
self.logger = logging.getLogger("PSParser")
self.logger.info("Loaded PostScript Parser")
def __getPSFromJID(self, jid):
jobFile = open(jid, 'r')
job = json.load(jobFile)
jobFile.close()
... | Python | 0.999947 |
edb04d8e0ae03c9244b7d934fd713efbb94d5a58 | Add api url to album and link | opps/api/urls.py | opps/api/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url, include
from tastypie.api import Api
from opps.containers.api import Container
from opps.articles.api import Post, Album, Link
from .conf import settings
_api = Api(api_name=settings.OPPS_API_NAME)
_api.register(Container())
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url, include
from tastypie.api import Api
from opps.containers.api import Container
from opps.articles.api import Post
from .conf import settings
_api = Api(api_name=settings.OPPS_API_NAME)
_api.register(Container())
_api.register... | Python | 0 |
3df0f14a9e2625081a1b1f51aef997d18b4a9b50 | Remove Logging | pabiana/brain.py | pabiana/brain.py | import importlib
import logging
import multiprocessing as mp
import os
import signal
from os import path
import pip
from . import _default_clock, load_interfaces, repo
def main(*args):
args = list(args)
stop_pip = False
if '-X' in args:
stop_pip = True
args.remove('-X')
if '-C' in args:
args.append('clock... | import importlib
import logging
import multiprocessing as mp
import os
import signal
from os import path
import pip
from . import _default_clock, load_interfaces, repo
def main(*args):
args = list(args)
stop_pip = False
if '-X' in args:
stop_pip = True
args.remove('-X')
if '-C' in args:
args.append('clock... | Python | 0.000002 |
e82d477194393ff3142f6c25c5db4c7b7f2a98a5 | Call ConsoleViewer init | simpleai/search/viewers.py | simpleai/search/viewers.py | # coding: utf-8
from os import path
from threading import Thread
from time import sleep
class DummyViewer(object):
def start(self):
pass
def new_iteration(self, fringe):
pass
def chosen_node(self, node, is_goal):
pass
def expanded(self, node, successors):
pass
clas... | # coding: utf-8
from os import path
from threading import Thread
from time import sleep
class DummyViewer(object):
def start(self):
pass
def new_iteration(self, fringe):
pass
def chosen_node(self, node, is_goal):
pass
def expanded(self, node, successors):
pass
clas... | Python | 0 |
e165d16660cb10a7008be2b7566a6db471dafde0 | Fixing a typo that handles generating new mailbox names. | django_mailbox/management/commands/processincomingmessage.py | django_mailbox/management/commands/processincomingmessage.py | import email
import logging
import rfc822
import sys
from django.core.management.base import BaseCommand
from django_mailbox.models import Mailbox
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
class Command(BaseCommand):
def handle(self, *args, **options):
message = email.... | import email
import logging
import rfc822
import sys
from django.core.management.base import BaseCommand
from django_mailbox.models import Mailbox
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
class Command(BaseCommand):
def handle(self, *args, **options):
message = email.... | Python | 0.999963 |
cb117d449c3e5d611951a5d1a9efbafd34525238 | fix finding files | chandra_suli/make_lightcurve.py | chandra_suli/make_lightcurve.py | #!/usr/bin/env python
"""
Generate lightcurves for each candidate given a list of candidates
"""
import argparse
import os
import sys
import numpy as np
import astropy.io.fits as pyfits
import matplotlib.pyplot as plt
import seaborn as sbs
from chandra_suli import find_files
from chandra_suli import logging_system
f... | #!/usr/bin/env python
"""
Generate lightcurves for each candidate given a list of candidates
"""
import argparse
import os
import sys
import numpy as np
import astropy.io.fits as pyfits
import matplotlib.pyplot as plt
import seaborn as sbs
from chandra_suli import find_files
from chandra_suli import logging_system
f... | Python | 0.000366 |
cfa8b88e3d86e560415260eb596dd3bbdab52736 | Fix test of auto_backup_download | auto_backup_download/tests/test_auto_backup_download.py | auto_backup_download/tests/test_auto_backup_download.py | # -*- coding: utf-8 -*-
# Copyright 2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
from odoo.exceptions import Warning
class TestAutoBackupDownload(common.TransactionCase):
def test_01_create_not_existing(self):
... | # -*- coding: utf-8 -*-
# Copyright 2017 Onestein (<http://www.onestein.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests import common
from odoo.exceptions import Warning
class TestAutoBackupDownload(common.TransactionCase):
def test_01_create_not_existing(self):
... | Python | 0.000003 |
79ec3f3ebabd1625830952ecdec1b0761c2b5324 | Rewrite serialization of Attempt submit response | web/attempts/rest.py | web/attempts/rest.py | import json
from django.db import transaction
from rest_framework import validators, decorators, status
from rest_framework.authentication import TokenAuthentication
from rest_framework.response import Response
from rest_framework.serializers import ModelSerializer, Field
from rest_framework.viewsets import ModelViewSe... | from django.db import transaction
from rest_framework import validators, decorators, status
from rest_framework.authentication import TokenAuthentication
from rest_framework.response import Response
from rest_framework.serializers import ModelSerializer, Field
from rest_framework.viewsets import ModelViewSet
from .mode... | Python | 0 |
c3996af1f7b201355d1cbcd6ef4c8fe420c8b67e | Fix lint | solutions/uri/1028/1028.py | solutions/uri/1028/1028.py | def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
n = int(input())
for line in range(n):
a, b = map(int, input().split())
print(gcd(a, b))
| import sys
def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
n = int(input())
for line in range(n):
a, b = map(int, input().split())
print(gcd(a, b))
| Python | 0.000032 |
5fd1f7cbe9534a47c4dc837773f22f6f177fdcf5 | Update affineHacker: fixed imports and typo | books/CrackingCodesWithPython/Chapter15/affineHacker.py | books/CrackingCodesWithPython/Chapter15/affineHacker.py | # Affine Cipher Hacker
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
from books.CrackingCodesWithPython.pyperclip import copy
from books.CrackingCodesWithPython.Chapter14.affineCipher import decryptMessage, SYMBOLS, getKeyParts
from books.CrackingCodesWithPython.Chapter13.cryptomath import gcd
from books.Cr... | # Affine Cipher Hacker
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import pyperclip, affineCipher, detectEnglish, cryptomath
SILENT_MODE = False
def main():
# You might want to copy & paste this text from the source code at
# https://www.nostarch.com/crackingcodes/.
myMessage = """5QG9ol3La6... | Python | 0 |
b6727f6bd9f3d8ffe59b17f157180a8fa5e61467 | Fix typo. | py/vttest/fakezk_config.py | py/vttest/fakezk_config.py | # Copyright 2013 Google Inc. All Rights Reserved.
"""Generate a config file for fakezk topology."""
__author__ = 'enisoc@google.com (Anthony Yeh)'
import base64
import codecs
import json
class FakeZkConfig(object):
"""Create fakezk config for use as static topology for vtgate."""
def __init__(self, mysql_port... | # Copyright 2013 Google Inc. All Rights Reserved.
"""Generate a config file for fakezk topology."""
__author__ = 'enisoc@google.com (Anthony Yeh)'
import base64
import codecs
import json
class FakeZkConfig(object):
"""Create fakezk config for use as static topology for vtgate."""
def __init__(self, mysql_port... | Python | 0.001604 |
d607de07ae3aaa2a245b8eb90cb42ca3e29f6e33 | add lambda sample | 05.Function.py | 05.Function.py | #-*- encoding: utf-8 -*-
# Error
#def func():
def func():
pass
def func(num, num1=1, num2=2):
print(num, num1, num2)
func(1, 3, 4) # 1 3 4
func(5) # 5 1 2
# Error
#func()
def func(**args):
for k, v in args.items():
print('key: ' + k, 'value: ' + v)
for k in args.keys():
print('key... | #-*- encoding: utf-8 -*-
# Error
#def func():
def func():
pass
def func(num, num1=1, num2=2):
print(num, num1, num2)
func(1, 3, 4) # 1 3 4
func(5) # 5 1 2
# Error
#func()
def func(**args):
for k, v in args.items():
print('key: ' + k, 'value: ' + v)
for k in args.keys():
print('key... | Python | 0.000001 |
b439017a21ac01ee7fda275753effaf5d103a120 | Change IP. | pybossa/signer/__init__.py | pybossa/signer/__init__.py | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2015 SciFabric LTD.
#
# PyBossa 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 op... | # -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa 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... | Python | 0 |
54d39aaf8c31a5827ae7338fefe7a1d6a19d52cf | Add missing docstring. | pyslvs_ui/info/__init__.py | pyslvs_ui/info/__init__.py | # -*- coding: utf-8 -*-
"""'info' module contains Pyslvs program information."""
__all__ = [
'KERNELS',
'SYS_INFO',
'ARGUMENTS',
'HAS_SLVS',
'Kernel',
'check_update',
'PyslvsAbout',
'html',
'logger',
'XStream',
'size_format',
]
__author__ = "Yuan Chang"
__copyright__ = "Cop... | # -*- coding: utf-8 -*-
"""'info' module contains Pyslvs program information."""
__all__ = [
'KERNELS',
'SYS_INFO',
'ARGUMENTS',
'HAS_SLVS',
'Kernel',
'check_update',
'PyslvsAbout',
'html',
'logger',
'XStream',
'size_format',
]
__author__ = "Yuan Chang"
__copyright__ = "Cop... | Python | 0.000005 |
7b19611d30dfc9091823ae3d960ab2790dfe9cfc | Apply a blur filter automatically for each detected face | python/blur_human_faces.py | python/blur_human_faces.py | import requests
import json
imgUrl = 'https://pixlab.io/images/m3.jpg' # Target picture we want to blur any face on
# Detect all human faces in a given image via /facedetect first and blur all of them later via /mogrify.
# https://pixlab.io/cmd?id=facedetect and https://pixlab.io/cmd?id=mogrify for additional informa... | import requests
import json
imgUrl = 'https://pixlab.io/images/m3.jpg' # Target picture we want to blur any face on
# Detect all human faces in a given image via /facedetect first and blur all of them later via /mogrify.
# https://pixlab.io/cmd?id=facedetect and https://pixlab.io/cmd?id=mogrify for additional informa... | Python | 0 |
8a950dbfb1281216ed270bf6363c7a71d857133f | Make datetime and time +00:00 handling behavior consistent. Fix #3. | webhooks/encoders.py | webhooks/encoders.py | """
Serialize data to/from JSON
Inspired by https://github.com/django/django/blob/master/django/core/serializers/json.py
"""
# Avoid shadowing the standard library json module
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import decimal
import json
class WebHooksJSON... | """
Serialize data to/from JSON
Inspired by https://github.com/django/django/blob/master/django/core/serializers/json.py
"""
# Avoid shadowing the standard library json module
from __future__ import absolute_import
from __future__ import unicode_literals
import datetime
import decimal
import json
class WebHooksJSON... | Python | 0.000001 |
8120b641ccb66b088fa70c028e5be542bf561dfd | Update lex_attrs.py (#5608) | spacy/lang/hy/lex_attrs.py | spacy/lang/hy/lex_attrs.py | # coding: utf8
from __future__ import unicode_literals
from ...attrs import LIKE_NUM
_num_words = [
"զրո",
"մեկ",
"երկու",
"երեք",
"չորս",
"հինգ",
"վեց",
"յոթ",
"ութ",
"ինը",
"տասը",
"տասնմեկ",
"տասներկու",
"տասներեք",
"տասնչորս",
"տասնհինգ",
"տա... | # coding: utf8
from __future__ import unicode_literals
from ...attrs import LIKE_NUM
_num_words = [
"զրօ",
"մէկ",
"երկու",
"երեք",
"չորս",
"հինգ",
"վեց",
"յոթ",
"ութ",
"ինը",
"տասը",
"տասնմեկ",
"տասներկու",
"տասներեք",
"տասնչորս",
"տասնհինգ",
"տա... | Python | 0 |
cd8024c762bf5bae8caf210b9224548bee55ee04 | Bump version to 6.1.5a3 | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Python | 0 |
12c22ebdf3c7e84f5f9c6b32329f343c8317f11b | Correct comments | python/dbtools/__init__.py | python/dbtools/__init__.py | '''
This library provides database access routines.
It's based on the re-usable parts of tailoredstats.
Owain Kenway
'''
'''
Generally abstract away DB queries, such that all complexity is replaced with:
dbtools.dbquery(db, query)
'''
def dbquery(db, query, mysqlhost="mysql.external.... | '''
This library provides database access routines.
It's based on the re-usable parts of tailoredstats.
Owain Kenway
'''
'''
Generally abstract away DB queries, such that all complexity is replaced with:
dbtools.dbquery(db, query)
'''
def dbquery(db, query, mysqlhost="mysql.external.... | Python | 0.000023 |
8d459d86d33992129726ef177ed24fe8a00e9b75 | Bump version to 4.0.0rc1 | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Python | 0 |
5f917746e86c733d37c56e15a97f7aecb73fa75f | fix bug comparing string with int. int(games) | python/guess_the_player.py | python/guess_the_player.py | # importing modules
import os
import csv
import time
import random
import tweepy
import player
# secrets
consumer_key = os.getenv('c_key')
consumer_secret = os.getenv('c_secret')
access_token = os.getenv('a_token')
access_token_secret = os.getenv('a_secret')
# authentication
auth = tweepy.OAuthHandler(consumer_key, c... | # importing modules
import os
import csv
import time
import random
import tweepy
import player
# secrets
consumer_key = os.getenv('c_key')
consumer_secret = os.getenv('c_secret')
access_token = os.getenv('a_token')
access_token_secret = os.getenv('a_secret')
# authentication
auth = tweepy.OAuthHandler(consumer_key, c... | Python | 0 |
a172a17c815e8fcbe0f8473c6bac1ea1d9714817 | Bump version to 4.4.0a4 | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Python | 0 |
54921c5dbdc68893fe45649d07d067818c36889b | Bump version to 4.0.0b3 | platformio/__init__.py | platformio/__init__.py | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | # Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Python | 0 |
302a102a3c72224d2039df35fe4b292e9dd540d3 | fix typo in docstring | client/libs/logdog/bootstrap.py | client/libs/logdog/bootstrap.py | # Copyright 2016 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import collections
import os
from . import stream, streamname
class NotBootstrappedError(RuntimeError):
"""Raised when the current environmen... | # Copyright 2016 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import collections
import os
from . import stream, streamname
class NotBootstrappedError(RuntimeError):
"""Raised when the current environmen... | Python | 0.020727 |
74ecf023ef13fdba6378d6b50b3eaeb06b9e0c97 | Rename env vars & modify query | rebuild_dependant_repos.py | rebuild_dependant_repos.py | import os, sys, re
import requests
from github import Github
CIRCLECI_BASEURL = "https://circleci.com/api/v2"
CIRCLECI_ACCESS_TOKEN = os.environ["AVATAO_CIRCLECI_TOKEN"]
GITHUB_ACCESS_TOKEN = os.environ["AVATAO_GITHUB_TOKEN"]
g = Github(GITHUB_ACCESS_TOKEN)
if len(sys.argv) < 2:
raise AttributeError("The image na... | import os, sys, re, logging
import requests
from github import Github
logging.basicConfig(level=logging.DEBUG)
CIRCLECI_BASEURL = "https://circleci.com/api/v2"
CIRCLECI_ACCESS_TOKEN = os.environ["TAO_CIRCLECI_TOKEN"]
GITHUB_ACCESS_TOKEN = os.environ["TAO_GITHUB_TOKEN"]
g = Github(GITHUB_ACCESS_TOKEN)
if len(sys.argv... | Python | 0 |
b43b34418d244acee363485d42a23694ed9d654f | Add fields to work serializer for GET methods | works/serializers.py | works/serializers.py | from rest_framework import serializers
from . import models
from clients import serializers as client_serializers
from users import serializers as user_serializers
class WorkTypeSerializer(serializers.ModelSerializer):
name = serializers.CharField(read_only=True)
class Meta:
model = models.WorkType... | from rest_framework import serializers
from . import models
from clients import serializers as client_serializers
from users import serializers as user_serializers
class WorkTypeSerializer(serializers.ModelSerializer):
name = serializers.CharField(read_only=True)
class Meta:
model = models.WorkType... | Python | 0 |
a6fbb077eb3067cedc501cc8b0a9e99594cef9ed | Use memoize for compliance cache | recruit_app/hr/managers.py | recruit_app/hr/managers.py | # -*- coding: utf-8 -*-
from recruit_app.user.models import EveCharacter
from recruit_app.extensions import cache_extension
from flask import current_app
import requests
from bs4 import BeautifulSoup
class HrManager:
def __init__(self):
pass
@staticmethod
@cache_extension.memoize(timeout=3600)
... | # -*- coding: utf-8 -*-
from recruit_app.user.models import EveCharacter
from recruit_app.extensions import cache_extension
from flask import current_app
import requests
from bs4 import BeautifulSoup
class HrManager:
def __init__(self):
pass
@staticmethod
@cache_extension.cached(timeout=3600, key_... | Python | 0 |
0ba2b371e08c40e7c4d56efee6f4a828f1e7aeb0 | Update functions.py | ref/functions/functions.py | ref/functions/functions.py | #functions.py
#Written by Jesse Gallarzo
#Add code here
#def functionOne():
#def functionTwo():
#def functionThree():
def main():
#Add code here
print('Test')
main()
| #functions.py
#Written by Jesse Gallarzo
#Add code here
#def function One:
def main():
#Add code here
print('Test')
main()
| Python | 0.000001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.