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
8157af3da0e535074b18c76f0e5391d8cac806e8
Add error field to expected JSON
whats_fresh/whats_fresh_api/tests/views/test_stories.py
whats_fresh/whats_fresh_api/tests/views/test_stories.py
from django.test import TestCase from django.test.client import Client from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class StoriesTestCase(TestCase): fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json'] def s...
from django.test import TestCase from django.test.client import Client from django.core.urlresolvers import reverse from whats_fresh_api.models import * from django.contrib.gis.db import models import json class StoriesTestCase(TestCase): fixtures = ['whats_fresh_api/tests/testdata/test_fixtures.json'] def s...
Python
0.000001
feab9b1067a42a6d5d8586361ab1d02f1844aa7e
Remove unused imports
tests/integration/api/conftest.py
tests/integration/api/conftest.py
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) API-specific fixtures """ import pytest from .helpers import assemble_authorization_header API_TOKEN = 'just-say-PLEASE!' @pytest.fixture(scope='package') # `admin_app` fixture is required because it sets up the...
""" :Copyright: 2006-2021 Jochen Kupperschmidt :License: Revised BSD (see `LICENSE` file for details) API-specific fixtures """ import pytest from tests.conftest import CONFIG_PATH_DATA_KEY from tests.helpers import create_admin_app from .helpers import assemble_authorization_header API_TOKEN = 'just-say-PLEASE!'...
Python
0.000001
f2139cad673ee50f027164bda80d86979d5ce7a0
Add more imports for further functionality
passenger_wsgi.py
passenger_wsgi.py
import os import sys try: from flask import Flask import flask_login from flask_restless import APIManager from flask_sqlalchemy import SQLAlchemy import requests except ImportError: INTERP = "venv/bin/python" if os.path.relpath(sys.executable, os.getcwd()) != INTERP: try: ...
import os import sys try: from flask import Flask, render_template, send_file, Response import requests except ImportError: INTERP = "venv/bin/python" if os.path.relpath(sys.executable, os.getcwd()) != INTERP: try: os.execl(INTERP, INTERP, *sys.argv) except OSError: ...
Python
0
62ec46d6dddf1eb0054861d886ab6493d56670d5
Switch `open()` for `salt.utils.fopen()`
tests/integration/shell/syndic.py
tests/integration/shell/syndic.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` tests.integration.shell.syndic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ''' # Import python libs import os import yaml import signal import shutil # Import Salt Testing libs from salttesting.helpers import ensure_in_syspath ensur...
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` tests.integration.shell.syndic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ''' # Import python libs import os import yaml import signal import shutil # Import Salt Testing libs from salttesting.helpers import ensure_in_syspath ensur...
Python
0
e019a2b5de66dbbc0ed76942824ec3d33bcac6fd
Add integration test for @returns
tests/integration/test_returns.py
tests/integration/test_returns.py
# Standard library imports import collections # Local imports. import uplink # Constants BASE_URL = "https://api.github.com/" # Schemas User = collections.namedtuple("User", "id name") Repo = collections.namedtuple("Repo", "owner name") # Converters @uplink.loads(User) def user_reader(cls, response): return c...
# Standard library imports import collections # Local imports. import uplink # Constants BASE_URL = "https://api.github.com/" # Schemas Repo = collections.namedtuple("Repo", "owner name") # Converters @uplink.loads.from_json(Repo) def repo_loader(cls, json): return cls(**json) @uplink.dumps.to_json(Repo) de...
Python
0
f4e6f2c6eb77876b646da14805ee496b0b25f0bc
Support PortOpt from oslo.cfg
dragonflow/common/common_params.py
dragonflow/common/common_params.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 # d...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Python
0.000001
4ec09eb10aa352175769cc00f189ece719802ea6
remove temperature for now
lled.py
lled.py
#!/usr/bin/env python """Mookfist LimitlessLED Control This tool can be used to control your LimitlessLED based lights. Usage: lled.py fade <start> <end> (--group=<GROUP>)... [options] lled.py fadec <start> <end> (--group=<GROUP>)... [options] lled.py fadeb <startb> <endb> <startc> <endc> (--group=<GROUP>...
#!/usr/bin/env python """Mookfist LimitlessLED Control This tool can be used to control your LimitlessLED based lights. Usage: lled.py fade <start> <end> (--group=<GROUP>)... [options] lled.py fadec <start> <end> (--group=<GROUP>)... [options] lled.py fadeb <startb> <endb> <startc> <endc> (--group=<GROUP>...
Python
0
a324e8de7dc0bcb1676a8ae506d139f05751b233
fix lint for tests
tests/test_relation_identifier.py
tests/test_relation_identifier.py
from __future__ import absolute_import import pytest from catpy.client import ConnectorRelation, CatmaidClient from catpy.applications import RelationIdentifier from tests.common import relation_identifier, connectors_types # noqa def test_from_id(relation_identifier): # noqa assert relation_identifier.from_...
from __future__ import absolute_import import pytest from catpy.client import ConnectorRelation, CatmaidClient from catpy.applications import RelationIdentifier from tests.common import relation_identifier, connectors_types # noqa def test_from_id(relation_identifier): # noqa assert relation_identifier.from_...
Python
0.000001
ad4b9ffb7292a5b810df033088008cd503bc1169
Add pre-fabricated fake PyPI envs at the top.
tests/unit/test_spec_resolving.py
tests/unit/test_spec_resolving.py
import unittest from piptools.datastructures import SpecSet from piptools.package_manager import FakePackageManager def print_specset(specset, round): print('After round #%s:' % (round,)) for spec in specset: print(' - %s' % (spec.description(),)) simple = { 'foo-0.1': ['bar'], 'bar-1.2': [...
import unittest from piptools.datastructures import SpecSet from piptools.package_manager import FakePackageManager def print_specset(specset, round): print('After round #%s:' % (round,)) for spec in specset: print(' - %s' % (spec.description(),)) class TestDependencyResolving(unittest.TestCase): ...
Python
0
bbfa9c3135ebdc5a99257d62556b691f8c87a26c
Update irrigate.py
device/src/irrigate.py
device/src/irrigate.py
#!/usr/bin/env python #In this project, I use a servo to simulate the water tap. #Roating to 90 angle suggest that the water tap is open, and 0 angle means close. #Pin connection: #deep red <--> GND #red <--> VCC #yellow <--> signal(X1) #Update!!!!! #Use real water pump(RS360) to irrigate the plants, need to us...
#!/usr/bin/env python #In this project, I use a servo to simulate the water tap. #Roating to 90 angle suggest that the water tap is open, and 0 angle means close. #Pin connection: #deep red <--> GND #red <--> VCC #yellow <--> signal(X1) from pyb import Servo servo=Servo(1) # X1 def irrigate_start(): servo.angl...
Python
0.000001
173d7ffefe10e8896055bd5b41272c2d0a1f8889
Update version to 0.1.6 for upcoming release
pdblp/_version.py
pdblp/_version.py
__version__ = "0.1.6"
__version__ = "0.1.5"
Python
0
b87ebc9dbbc33928345a83ac8ea0ce71806ac024
simplify play down to wall and standard defense
soccer/gameplay/plays/Defend_Restart_Defensive/BasicDefendRestartDefensive.py
soccer/gameplay/plays/Defend_Restart_Defensive/BasicDefendRestartDefensive.py
import main import robocup import behavior import constants import enum import standard_play import tactics.positions.submissive_goalie as submissive_goalie import tactics.positions.submissive_defender as submissive_defender import evaluation.opponent as eval_opp import tactics.positions.wing_defender as wing_defender...
import main import robocup import behavior import constants import enum import standard_play import tactics.positions.submissive_goalie as submissive_goalie import tactics.positions.submissive_defender as submissive_defender import evaluation.opponent as eval_opp import tactics.positions.wing_defender as wing_defender...
Python
0.000027
abae242bbcdc3eefcd0ab1ff29f660f89d47db1a
Add absolute URL for Surprises
mirigata/surprise/models.py
mirigata/surprise/models.py
from django.core.urlresolvers import reverse from django.db import models class Surprise(models.Model): link = models.URLField(max_length=500) description = models.TextField(max_length=1000) def get_absolute_url(self): return reverse('surprise-detail', kwargs={"pk": self.id})
from django.db import models class Surprise(models.Model): link = models.URLField(max_length=500) description = models.TextField(max_length=1000)
Python
0
c0fdbf78fcc6b74086cc40e8e0deb273dee6d03c
Update BUILD_OSS to 4666.
src/data/version/mozc_version_template.bzl
src/data/version/mozc_version_template.bzl
# Copyright 2010-2021, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and ...
# Copyright 2010-2021, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and ...
Python
0
c5225c00191595b6d1a824ee808465e0c488769b
Add missing arg which didn't make it because of the bad merge conflict resolution.
st2stream/st2stream/controllers/v1/stream.py
st2stream/st2stream/controllers/v1/stream.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Python
0
1df3dc91f71bf2a02b059d414ea5b041a382f1ad
change CSS selectors
shot.py
shot.py
# -*- coding: utf-8 -*- import redis import urllib2 from bs4 import BeautifulSoup from datetime import datetime url = 'http://www.x-kom.pl' FORMAT_DATETIME = '%Y-%m-%d %H:%M:%S.%f' redis_server = redis.Redis(host='localhost', port=6379) def get_number(number): return float(number.strip().split()[0].replace(',',...
# -*- coding: utf-8 -*- import redis import urllib2 from bs4 import BeautifulSoup from datetime import datetime url = 'http://www.x-kom.pl' FORMAT_DATETIME = '%Y-%m-%d %H:%M:%S.%f' redis_server = redis.Redis(host='localhost', port=6379) def get_number(number): return float(number.strip().split()[0].replace(',',...
Python
0.000001
8b944f04ebf9b635029182a3137e9368edafe9d2
Handle exception for bad search strings
pgsearch/utils.py
pgsearch/utils.py
from django.contrib.postgres.search import SearchVector, SearchRank, SearchQuery import shlex import string def parseSearchString(search_string): try: search_strings = shlex.split(search_string) translator = str.maketrans({key: None for key in string.punctuation}) search_strings = [s.trans...
from django.contrib.postgres.search import SearchVector, SearchRank, SearchQuery import shlex import string def parseSearchString(search_string): search_strings = shlex.split(search_string) translator = str.maketrans({key: None for key in string.punctuation}) search_strings = [s.translate(translator) for ...
Python
0.000006
6df0e3efd239f7be073057ede44033dc95064a23
Fix StringIO import
teuthology/task/tests/test_run.py
teuthology/task/tests/test_run.py
import logging import pytest from io import StringIO from teuthology.exceptions import CommandFailedError log = logging.getLogger(__name__) class TestRun(object): """ Tests to see if we can make remote procedure calls to the current cluster """ def test_command_failed_label(self, ctx, config): ...
import logging import pytest from StringIO import StringIO from teuthology.exceptions import CommandFailedError log = logging.getLogger(__name__) class TestRun(object): """ Tests to see if we can make remote procedure calls to the current cluster """ def test_command_failed_label(self, ctx, config...
Python
0.000001
3c1a658195145ff1c0f20b677c50f5932e5ac66a
fix yield statement
dusty/compiler/compose/__init__.py
dusty/compiler/compose/__init__.py
import yaml import pprint from .. import get_assembled_specs from ...source import repo_path from ..port_spec import port_spec_document from ... import constants def write_compose_file(): compose_dict = get_compose_dict() print pprint.pformat(compose_dict) with open("{}/docker-compose.yml".format(constant...
import yaml import pprint from .. import get_assembled_specs from ...source import repo_path from ..port_spec import port_spec_document from ... import constants def write_compose_file(): compose_dict = get_compose_dict() print pprint.pformat(compose_dict) with open("{}/docker-compose.yml".format(constant...
Python
0.000001
cc5c52084fedf172d11534a465e155b8948da9b7
Add support for command arguments
skal.py
skal.py
# Copyright 2012 Loop Lab # # 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, ...
# Copyright 2012 Loop Lab # # 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, ...
Python
0.000113
8e24d3139c11428cda1e07da62ff007be9c77424
Add convenience method.
abilian/testing/__init__.py
abilian/testing/__init__.py
"""Base stuff for testing. """ import os import subprocess import requests assert not 'twill' in subprocess.__file__ from flask.ext.testing import TestCase from abilian.application import Application __all__ = ['TestConfig', 'BaseTestCase'] class TestConfig(object): SQLALCHEMY_DATABASE_URI = "sqlite://" SQ...
"""Base stuff for testing. """ import os import subprocess import requests assert not 'twill' in subprocess.__file__ from flask.ext.testing import TestCase from abilian.application import Application __all__ = ['TestConfig', 'BaseTestCase'] class TestConfig(object): SQLALCHEMY_DATABASE_URI = "sqlite://" SQ...
Python
0
434f5d394cc9f70962abc8c6ba19b596e6647b4c
Reformat and update copyright.
spotseeker_server/test/hours/get.py
spotseeker_server/test/hours/get.py
# Copyright 2021 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from django.test import TestCase from django.conf import settings from django.test.client import Client from spotseeker_server.models import Spot, SpotAvailableHours import simplejson as json from django.test.utils import override_s...
# 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
7292b2d276db056870993a108466fccc18debcae
Update count-different-palindromic-subsequences.py
Python/count-different-palindromic-subsequences.py
Python/count-different-palindromic-subsequences.py
# Time: O(n^2) # Space: O(n^2) # Given a string S, find the number of different non-empty palindromic subsequences in S, # and return that number modulo 10^9 + 7. # # A subsequence of a string S is obtained by deleting 0 or more characters from S. # # A sequence is palindromic if it is equal to the sequence reversed....
# Time: O(n^2) # Space: O(n^2) class Solution(object): def countPalindromicSubsequences(self, S): """ :type S: str :rtype: int """ def dp(i, j, prv, nxt, lookup): if lookup[i][j] is not None: return lookup[i][j] result = 1 ...
Python
0.000001
358de4c3ce20569e217b1caf5c25ce826b536bbc
Reformat datastructuretools
supriya/tools/datastructuretools/__init__.py
supriya/tools/datastructuretools/__init__.py
# -*- encoding: utf-8 -*- r""" Tools for working with generic datastructures. """ from abjad.tools import systemtools systemtools.ImportManager.import_structured_package( __path__[0], globals(), )
# -*- encoding: utf-8 -*- r''' Tools for working with generic datastructures. ''' from abjad.tools import systemtools systemtools.ImportManager.import_structured_package( __path__[0], globals(), )
Python
0.000001
0e2bc29486fc1e09b6d90ccdbe21095f73848d48
remove the event listener check
speakerbot/listenable.py
speakerbot/listenable.py
from dynamic_class import Singleton class NotEventException(Exception): pass class GlobalEventDispatcher(object): """not quite there yet""" __metaclass__ = Singleton def __init__(self): pass def event(method): """Must be called first in a decorator chain, otherwise we lose the correct n...
from dynamic_class import Singleton class NotEventException(Exception): pass class GlobalEventDispatcher(object): """not quite there yet""" __metaclass__ = Singleton def __init__(self): pass def event(method): """Must be called first in a decorator chain, otherwise we lose the correct n...
Python
0.000004
79fd01202255e0b00ca2fe90834dbd4e15dd84bc
Print NVIDIA license notice only when actually downloading the CUDA headers repository.
third_party/cuda/dependencies.bzl
third_party/cuda/dependencies.bzl
"""CUDA headers repository.""" def _download_nvidia_headers(repository_ctx, output, url, sha256, strip_prefix): # Keep the mirror up-to-date manually (see b/154869892) with: # /google/bin/releases/tensorflow-devinfra-team/cli_tools/tf_mirror <url> repository_ctx.download_and_extract( url = [ ...
"""CUDA headers repository.""" def _download_nvidia_headers(repository_ctx, output, url, sha256, strip_prefix): # Keep the mirror up-to-date manually (see b/154869892) with: # /google/bin/releases/tensorflow-devinfra-team/cli_tools/tf_mirror <url> repository_ctx.download_and_extract( url = [ ...
Python
0
9098692bf431b4947da96dc054fe8e1559e27aa5
Update hexagon_nn_headers to v1.10.3.1.3 Changes Includes: * Support soc_id:371 * New method exposed that returns the version of hexagon_nn used in libhexagon_interface.so
third_party/hexagon/workspace.bzl
third_party/hexagon/workspace.bzl
"""Loads the Hexagon NN Header files library, used by TF Lite.""" load("//third_party:repo.bzl", "third_party_http_archive") def repo(): third_party_http_archive( name = "hexagon_nn", sha256 = "281d46b47f7191f03a8a4071c4c8d2af9409bb9d59573dc2e42f04c4fd61f1fd", urls = [ "https:/...
"""Loads the Hexagon NN Header files library, used by TF Lite.""" load("//third_party:repo.bzl", "third_party_http_archive") def repo(): third_party_http_archive( name = "hexagon_nn", sha256 = "4cbf3c18834e24b1f64cc507f9c2f22b4fe576c6ff938d55faced5d8f1bddf62", urls = [ "https:/...
Python
0
2a2224a2babaf20919c0091bcfd4b6109eadcecb
Fix issue with internal user and auditor
polyaxon/api/repos/views.py
polyaxon/api/repos/views.py
import logging import os from rest_framework.generics import RetrieveUpdateDestroyAPIView, get_object_or_404 from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.settings import api_settings from django.conf import settings from django.http import Htt...
import logging import os from rest_framework.generics import RetrieveUpdateDestroyAPIView, get_object_or_404 from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.settings import api_settings from django.conf import settings from django.http import Htt...
Python
0.000004
86391ed76c49578321c026187f159c53c2cf4ed1
Fix slack welcome message display bug and add user handle
orchestra/slack.py
orchestra/slack.py
import base64 from uuid import uuid1 from django.conf import settings import slacker from orchestra.utils.settings import run_if class SlackService(object): """ Wrapper slack service to allow easy swapping and mocking out of API. """ def __init__(self, api_key): self._service = slacker.Slack...
import base64 from uuid import uuid1 from django.conf import settings import slacker from orchestra.utils.settings import run_if class SlackService(object): """ Wrapper slack service to allow easy swapping and mocking out of API. """ def __init__(self, api_key): self._service = slacker.Slack...
Python
0
e7b50269a6d83234b283f769265bf474666b6cd2
Update project model with property has_description
polyaxon/projects/models.py
polyaxon/projects/models.py
import uuid from django.conf import settings from django.core.validators import validate_slug from django.db import models from libs.blacklist import validate_blacklist_name from libs.models import DescribableModel, DiffModel class Project(DiffModel, DescribableModel): """A model that represents a set of experi...
import uuid from django.conf import settings from django.core.validators import validate_slug from django.db import models from libs.blacklist import validate_blacklist_name from libs.models import DescribableModel, DiffModel class Project(DiffModel, DescribableModel): """A model that represents a set of experi...
Python
0
76bf774f3af2fb4fc2518945944b9f64c413712a
Simplify "cursor" function in "misc" module
autoload/breeze/utils/misc.py
autoload/breeze/utils/misc.py
# -*- coding: utf-8 -*- """ breeze.utils.misc ~~~~~~~~~~~~~~~~~ This module defines various utility functions and some tiny wrappers around vim functions. """ import vim import breeze.utils.settings def echom(msg): """Gives a simple feedback to the user via the command line.""" vim.command('echom "[breeze] ...
# -*- coding: utf-8 -*- """ breeze.utils.misc ~~~~~~~~~~~~~~~~~ This module defines various utility functions and some tiny wrappers around vim functions. """ import vim import breeze.utils.settings def echom(msg): """Gives a simple feedback to the user via the command line.""" vim.command('echom "[breeze] ...
Python
0.000291
0b311b67e1cf5831a6e1af317409fc6e854e8ce6
Remove debug artifacts
emission_events/scraper/scraper.py
emission_events/scraper/scraper.py
from datetime import datetime from bs4 import BeautifulSoup class Scraper(object): def __init__(self, html, tracking_number): self.html = html self.soup = BeautifulSoup(html) self.tracking_number = tracking_number def __call__(self): tds = self.soup.table.find_all('td') ...
from datetime import datetime from bs4 import BeautifulSoup class Scraper(object): def __init__(self, html, tracking_number): self.html = html self.soup = BeautifulSoup(html) self.tracking_number = tracking_number def __call__(self): tds = self.soup.table.find_all('td') ...
Python
0.000001
bd6eec33e59e3d46e5da931fbe9e1094bbb7c0bb
Add all primitives to known interactions.
enactiveagents/experiment/basic.py
enactiveagents/experiment/basic.py
""" Module to build experiments (worlds, agents, etc.). """ import model.interaction import model.agent import experiment class BasicExperiment(experiment.Experiment): world_representation = [ "wwwwwwwwwwwwwww", "w.............w", "w.wwwwwww.....w", "w.......wwwww.w", "w.ww...
""" Module to build experiments (worlds, agents, etc.). """ import model.interaction import model.agent import experiment class BasicExperiment(experiment.Experiment): world_representation = [ "wwwwwwwwwwwwwww", "w.............w", "w.wwwwwww.....w", "w.......wwwww.w", "w.ww...
Python
0
8da02c7c4ad382f4e7a2f7a017b32c0cff51547e
set limit of tw id over 5 letters
build_attendee.py
build_attendee.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from pyquery import PyQuery as pq import json if __name__ == "__main__": ## ref: pyquery # https://media.readthedocs.org/pdf/pyquery/latest/pyquery.pdf data = dict() file = ope...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from pyquery import PyQuery as pq import json if __name__ == "__main__": ## ref: pyquery # https://media.readthedocs.org/pdf/pyquery/latest/pyquery.pdf data = dict() file = ope...
Python
0.000011
dc54a12bfd2124e7203270940928e47198ed914e
bump version
bulbs/__init__.py
bulbs/__init__.py
__version__ = "0.6.24"
__version__ = "0.6.23"
Python
0
64383b6d8095f27af775d3c6030b22ee36055b29
Change summoner example function name, add params
examples/summoner.py
examples/summoner.py
import cassiopeia as cass from cassiopeia.core import Summoner def print_summoner(name: str, region: str): summoner = Summoner(name=name, region=region) print("Name:", summoner.name) print("ID:", summoner.id) print("Account ID:", summoner.account.id) print("Level:", summoner.level) print("Revi...
import cassiopeia as cass from cassiopeia.core import Summoner def test_cass(): name = "Kalturi" me = Summoner(name=name) print("Name:", me.name) print("Id:", me.id) print("Account id:", me.account.id) print("Level:", me.level) print("Revision date:", me.revision_date) print("Profile i...
Python
0
69091ea58fcd67c61dae3837eb0b9261825d44b3
Use except as notation
examples/tor_info.py
examples/tor_info.py
#!/usr/bin/env python # Simple usage example of TorInfo. This class does some magic so that # once it's set up, all the attributes it has (or appears to) are # GETINFO ones, in a heirarchy. So where GETINFO specifies # "net/listeners/dns" TorInfo will have a "net" attribute that # contains at least "listeners", etcete...
#!/usr/bin/env python # Simple usage example of TorInfo. This class does some magic so that # once it's set up, all the attributes it has (or appears to) are # GETINFO ones, in a heirarchy. So where GETINFO specifies # "net/listeners/dns" TorInfo will have a "net" attribute that # contains at least "listeners", etcete...
Python
0.000023
b077df615eb4354f416877cc2857fb9848e158eb
Fix get_sort_by_toggle to work with QueryDicts with multiple values
saleor/core/templatetags/shop.py
saleor/core/templatetags/shop.py
from __future__ import unicode_literals try: from itertools import zip_longest except ImportError: from itertools import izip_longest as zip_longest from django.template import Library from django.utils.http import urlencode register = Library() @register.filter def slice(items, group_size=1): args = [...
from __future__ import unicode_literals try: from itertools import zip_longest except ImportError: from itertools import izip_longest as zip_longest from django.template import Library from django.utils.http import urlencode register = Library() @register.filter def slice(items, group_size=1): args = [...
Python
0
dab8e1af4091a18a6251668b9c2475ee6b1e8f66
Fix diffuse.explicit() for constant non-zero extrapolation
phi/physics/diffuse.py
phi/physics/diffuse.py
""" Functions to simulate diffusion processes on `phi.field.Field` objects. """ from phi import math from phi.field import Grid, Field, laplace, solve_linear, jit_compile_linear from phi.field._field import FieldType from phi.field._grid import GridType from phi.math import copy_with def explicit(field: FieldType, ...
""" Functions to simulate diffusion processes on `phi.field.Field` objects. """ from phi import math from phi.field import Grid, Field, laplace, solve_linear, jit_compile_linear from phi.field._field import FieldType from phi.field._grid import GridType from phi.math import copy_with def explicit(field: FieldType, ...
Python
0.000012
3e62a39892c231419ac09310808d95cb42b4f69f
add python solution for valid_parentheses
python/valid_parentheses.py
python/valid_parentheses.py
# validate parentheses of string import sys inputChars = [ x for x in sys.argv[1] ] openParens = ('(', '[', '{') closeParens = (')', ']', '}') parenPairs = { ')': '(', ']': '[', '}': '{' } parenHistory = [] for c in inputChars: if c in openParens: parenHistory.append(c) elif c in closeP...
Python
0.00115
8ebe99ec5e944edaf7e0999222f1f1a54b07e5a4
Fix restart_needed
salt/states/win_servermanager.py
salt/states/win_servermanager.py
# -*- coding: utf-8 -*- ''' Manage Windows features via the ServerManager powershell module ''' # Import salt modules import salt.utils def __virtual__(): ''' Load only if win_servermanager is loaded ''' return 'win_servermanager' if 'win_servermanager.install' in __salt__ else False def installed(...
# -*- coding: utf-8 -*- ''' Manage Windows features via the ServerManager powershell module ''' # Import salt modules import salt.utils def __virtual__(): ''' Load only if win_servermanager is loaded ''' return 'win_servermanager' if 'win_servermanager.install' in __salt__ else False def installed(...
Python
0.000002
60f753e736827f61607e10d160b7e7bab75b77cc
update pyasn version for workers
pipeline/setup.py
pipeline/setup.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0
33240ac6581188e363d2e4e21753a3071f57df86
fix default source
pipenv/project.py
pipenv/project.py
import os import toml from . import _pipfile as pipfile from .utils import format_toml, multi_split from .utils import convert_deps_from_pip, convert_deps_to_pip class Project(object): """docstring for Project""" def __init__(self): super(Project, self).__init__() @property def name(self): ...
import os import toml from . import _pipfile as pipfile from .utils import format_toml, multi_split from .utils import convert_deps_from_pip, convert_deps_to_pip class Project(object): """docstring for Project""" def __init__(self): super(Project, self).__init__() @property def name(self): ...
Python
0.000001
7842919b2af368c640363b4e4e05144049b111ba
Remove BaseMail dependency on User object
ovp_core/emails.py
ovp_core/emails.py
from django.core.mail import EmailMultiAlternatives from django.template import Context, Template from django.template.loader import get_template from django.conf import settings import threading class EmailThread(threading.Thread): def __init__(self, msg): self.msg = msg threading.Thread.__init__(sel...
from django.core.mail import EmailMultiAlternatives from django.template import Context, Template from django.template.loader import get_template from django.conf import settings import threading class EmailThread(threading.Thread): def __init__(self, msg): self.msg = msg threading.Thread.__init__(sel...
Python
0
3c9de69112c8158877e4b0060ef0ab89c083f376
Build 1.14.0.1 package for Windows
packages/custom.py
packages/custom.py
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python from cerbero.packages import package from cerbero.enums import License class GStreamer: url = "http://gstreamer.freedesktop.org" version = '1.14.0.1' vendor = 'GStreamer Project' licenses = [License.LGPL] org = 'org.freedesktop.gstream...
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python from cerbero.packages import package from cerbero.enums import License class GStreamer: url = "http://gstreamer.freedesktop.org" version = '1.14.0' vendor = 'GStreamer Project' licenses = [License.LGPL] org = 'org.freedesktop.gstreamer...
Python
0
2250fdef5528bb59ca2c3218110d637484737659
fix pilutil.imresize test. Patch by Mark Wiebe.
scipy/misc/tests/test_pilutil.py
scipy/misc/tests/test_pilutil.py
import os.path import numpy as np from numpy.testing import assert_, assert_equal, \ dec, decorate_methods, TestCase, run_module_suite try: import PIL.Image except ImportError: _have_PIL = False else: _have_PIL = True import scipy.misc.pilutil as pilutil # Function / method decorator for skip...
import os.path import numpy as np from numpy.testing import assert_, assert_equal, \ dec, decorate_methods, TestCase, run_module_suite try: import PIL.Image except ImportError: _have_PIL = False else: _have_PIL = True import scipy.misc.pilutil as pilutil # Function / method decorator for skip...
Python
0
b3573faeff22f220990ea2c97a7c9eae26429258
add parse for application/json
tornado-sqlalchemy-example/app.py
tornado-sqlalchemy-example/app.py
# -*- coding: utf-8 -*- import os import tornado.web import tornado.options import tornado.ioloop from db import db from model import User from tornado.escape import json_decode, to_unicode class BaseHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db def get_...
import os import tornado.web import tornado.options import tornado.ioloop from db import db from model import User class BaseHandler(tornado.web.RequestHandler): @property def db(self): return self.application.db class IndexHandler(BaseHandler): def get(self): data = self.db.query(User)...
Python
0.000001
3056cf737ae0b6717073a03a6e01addfb1415416
is_project is *not* a uuid
scrapi/processing/osf/hashing.py
scrapi/processing/osf/hashing.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unicodedata import string import hashlib def get_id(doc): return normalize_string(doc['id']['serviceID']) def get_source(doc): return normalize_string(doc['source']) def get_doi(doc): return normalize_string(doc['id']['doi'] + get_...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import unicodedata import string import hashlib def get_id(doc): return normalize_string(doc['id']['serviceID']) def get_source(doc): return normalize_string(doc['source']) def get_doi(doc): return normalize_string(doc['id']['doi'] + get_...
Python
0.999386
60c355182f5e2d6a049f763031ffd15c57539a18
add views as a figshare metric
totalimpact/providers/figshare.py
totalimpact/providers/figshare.py
from totalimpact.providers import provider from totalimpact.providers.provider import Provider, ProviderContentMalformedError import simplejson import logging logger = logging.getLogger('ti.providers.figshare') class Figshare(Provider): example_id = ("doi", "10.6084/m9.figshare.92393") url = "http://figs...
from totalimpact.providers import provider from totalimpact.providers.provider import Provider, ProviderContentMalformedError import simplejson import logging logger = logging.getLogger('ti.providers.figshare') class Figshare(Provider): example_id = ("doi", "10.6084/m9.figshare.92393") url = "http://figs...
Python
0
bf81484b7fd55e6383ae8e0f103e5e69ddea430e
Update utils.py
academictorrents/utils.py
academictorrents/utils.py
import hashlib import os import json import datetime import calendar import time def convert_bytes_to_decimal(headerBytes): size = 0 power = len(headerBytes) - 1 for ch in headerBytes: if isinstance(ch, int): size += ch * 256 ** power else: size += int(ord(ch)) * 25...
import hashlib import os import json import datetime import calendar import time def convert_bytes_to_decimal(headerBytes): size = 0 power = len(headerBytes) - 1 for ch in headerBytes: if isinstance(ch, int): size += ch * 256 ** power else: size += int(ord(ch)) * 25...
Python
0.000001
2b5ac57fd02e5e20f738f9060456542f69eeff95
Bump version to 4.0.0a12
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
4e3cb4354c49101f29d64e4e5c59e347f95d98c9
Fix way to create login_url in dashboard test
tempest/scenario/test_dashboard_basic_ops.py
tempest/scenario/test_dashboard_basic_ops.py
# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
# All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
Python
0.000456
82a1bcd4bd104ca2b45cb5dc93a44e4a16d1cbe3
add more QC options and colorized output for quicker review
scripts/asos/archive_quantity.py
scripts/asos/archive_quantity.py
""" Create a simple prinout of observation quanity in the database """ import datetime now = datetime.datetime.utcnow() import numpy counts = numpy.zeros((120,12)) mslp = numpy.zeros((120,12)) metar = numpy.zeros((120,12)) import iemdb ASOS = iemdb.connect('asos', bypass=True) acursor = ASOS.cursor() import sys stid ...
""" Create a simple prinout of observation quanity in the database """ import datetime now = datetime.datetime.utcnow() import numpy counts = numpy.zeros((120,12)) import iemdb ASOS = iemdb.connect('asos', bypass=True) acursor = ASOS.cursor() import sys stid = sys.argv[1] acursor.execute("""SELECT extract(year from ...
Python
0
546d8fc8b41de424a76beb03c6530a7cf505a6a3
add orca EarthLocation
km3pipe/constants.py
km3pipe/constants.py
# coding=utf-8 # Filename: constants.py # pylint: disable=C0103 # pragma: no cover """ The constants used in KM3Pipe. """ from __future__ import division, absolute_import, print_function # TODO: this module should be refactored soon! import math __author__ = "Tamas Gal" __copyright__ = "Copyright 2016, Tamas Gal an...
# coding=utf-8 # Filename: constants.py # pylint: disable=C0103 # pragma: no cover """ The constants used in KM3Pipe. """ from __future__ import division, absolute_import, print_function # TODO: this module should be refactored soon! import math __author__ = "Tamas Gal" __copyright__ = "Copyright 2016, Tamas Gal an...
Python
0.000037
ce47d219076dc2ff36c58db1d91ba349b9968d61
Update test_bandits.py
bandits/tests/test_bandits.py
bandits/tests/test_bandits.py
from sklearn.utils.testing import assert_equal import numpy as np import pytest @pytest.mark.fast_test def dummy_test(): """ Quick test to build with Circle CI. """ x = 2 + 2 assert_equal(x, 4)
from sklearn.utils.testing import assert_equal import numpy as np import pytest print("Hello tests!")
Python
0.000001
19df1f99c1d6f50c49ac390c772a0f2fe45efabc
improve estimator to use gridded analysis when neighbor query fails
scripts/coop/estimate_missing.py
scripts/coop/estimate_missing.py
""" Crude data estimator! """ import sys import numpy as np import network import psycopg2.extras import netCDF4 import datetime from pyiem import iemre from pyiem.datatypes import temperature # Database Connection COOP = psycopg2.connect(database='coop', host='iemdb') ccursor = COOP.cursor(cursor_factory=psycopg2.ex...
""" Crude data estimator! """ import sys import iemdb import numpy import network import psycopg2.extras # Database Connection COOP = iemdb.connect('coop', bypass=True) ccursor = COOP.cursor(cursor_factory=psycopg2.extras.DictCursor) ccursor2 = COOP.cursor() state = sys.argv[1] nt = network.Table("%sCLIMATE" % (stat...
Python
0
cbb5290e42f738025fb11f4745a35bda71968f1f
Add support for Lovelace dashboards (#342)
pychromecast/controllers/homeassistant.py
pychromecast/controllers/homeassistant.py
""" Controller to interface with Home Assistant """ from ..config import APP_HOME_ASSISTANT from . import BaseController APP_NAMESPACE = "urn:x-cast:com.nabucasa.hast" class HomeAssistantController(BaseController): """ Controller to interact with Home Assistant. """ def __init__( self, hass...
""" Controller to interface with Home Assistant """ from ..config import APP_HOME_ASSISTANT from . import BaseController APP_NAMESPACE = "urn:x-cast:com.nabucasa.hast" class HomeAssistantController(BaseController): """ Controller to interact with Home Assistant. """ def __init__( self, hass...
Python
0
1e247dace112ce6def2bedf2f3ab864835ed7e06
enforce that source.yaml files have to specify a version attribute
src/rosdistro/source_file.py
src/rosdistro/source_file.py
# Software License Agreement (BSD License) # # Copyright (c) 2013, Open Source Robotics Foundation, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code mus...
# Software License Agreement (BSD License) # # Copyright (c) 2013, Open Source Robotics Foundation, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code mus...
Python
0.000001
92a269d95006f991aa65456d413776a6d6d0a93c
remove unused import
pyramid_oauth2_provider/authentication.py
pyramid_oauth2_provider/authentication.py
# # Copyright (c) Elliot Peele <elliot@bentlogic.net> # # This program is distributed under the terms of the MIT License as found # in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/licenses/mit-license.php. # # This program is distributed in the hope that it...
# # Copyright (c) Elliot Peele <elliot@bentlogic.net> # # This program is distributed under the terms of the MIT License as found # in a file called LICENSE. If it is not present, the license # is always available at http://www.opensource.org/licenses/mit-license.php. # # This program is distributed in the hope that it...
Python
0.000001
2652919c8d2e6fad8f7b3d47f5e82528b4b5214e
Write the last point for plot completeness
plots/monotone.py
plots/monotone.py
# MONOTONE # Produce a monotonically decreasing output plot from noisy data # Input: columns: t x # Output: columns: t_i x_i , sampled such that x_i <= x_j # for j > i. from string import * import sys # Set PYTHONPATH=$PWD from plottools import * if len(sys.argv) != 3: abort("usage:...
# MONOTONE # Produce a monotonically decreasing output plot from noisy data # Input: columns: t x # Output: columns: t_i x_i , sampled such that x_i <= x_j # for j > i. from string import * import sys # Set PYTHONPATH=$PWD from plottools import * if len(sys.argv) != 3: abort("usage:...
Python
0.999273
58ee8882fdbdef01f36859f0ed40afc346518690
Add test for double backward
tests/chainer_tests/functions_tests/array_tests/test_flip.py
tests/chainer_tests/functions_tests/array_tests/test_flip.py
import unittest import numpy import chainer from chainer import cuda from chainer import functions from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.utils import type_check @testing.parameterize(*testing.product_dict( [ {'shape': (1,), 'axis': 0...
import unittest import numpy import chainer from chainer import cuda from chainer import functions from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.utils import type_check @testing.parameterize(*testing.product_dict( [ {'shape': (1,), 'axis': 0...
Python
0.000007
6482c485982fe5039574eab797b46d5f1b93bacc
Refactor populate script
finance/management/commands/populate.py
finance/management/commands/populate.py
import random from django.contrib.auth.models import User from django.core.management.base import BaseCommand import factory from accounts.factories import UserFactory from books.factories import TransactionFactory class Command(BaseCommand): help = "Popoulates databse with dummy data" def handle(self, *a...
import random from django.contrib.auth.models import User from django.core.management.base import BaseCommand from django.db import IntegrityError import factory from accounts.factories import UserFactory from books.factories import TransactionFactory class Command(BaseCommand): help = "Popoulates databse with...
Python
0
87405b65ca4f6848a3e7ec0a63369658d09cd0d5
print debug messages to stderr, not stdout
fasttsne/__init__.py
fasttsne/__init__.py
import scipy.linalg as la import numpy as np import time import sys from fasttsne import _TSNE as TSNE def timed_reducer(f): def f2(data, d, mode, **kwargs): t = time.time() print >> sys.stderr, "Reducing to %dd using %s..." % (d, f.__name__) if mode == 1: from sklearn.preproce...
import scipy.linalg as la import numpy as np import time from fasttsne import _TSNE as TSNE def timed_reducer(f): def f2(data, d, mode, **kwargs): t = time.time() print "Reducing to %dd using %s..." % (d, f.__name__) if mode == 1: from sklearn.preprocessing import Normalizer ...
Python
0.998474
300f0b0101587aacaad9791ba3617dae75ed96ad
Fix apple_trailers plugin
flexget/plugins/input/apple_trailers.py
flexget/plugins/input/apple_trailers.py
from __future__ import unicode_literals, division, absolute_import import logging import urlparse import re from flexget.entry import Entry from flexget.plugin import priority, register_plugin, get_plugin_by_name, DependencyError from flexget.utils.cached_input import cached from flexget.utils.requests import RequestE...
from __future__ import unicode_literals, division, absolute_import import logging import re from urllib2 import HTTPError from flexget.entry import Entry from flexget.plugin import priority, register_plugin, get_plugin_by_name, DependencyError from flexget.utils.cached_input import cached from flexget.utils.tools impo...
Python
0
17037f53d3b3a54456892a986e1a199d381b5074
Use absolute_import in markdown.py, to fix import problem.
pokedex/db/markdown.py
pokedex/db/markdown.py
# encoding: utf8 u"""Implements the markup used for description and effect text in the database. The language used is a variation of Markdown and Markdown Extra. There are docs for each at http://daringfireball.net/projects/markdown/ and http://michelf.com/projects/php-markdown/extra/ respectively. Pokédex links are...
# encoding: utf8 u"""Implements the markup used for description and effect text in the database. The language used is a variation of Markdown and Markdown Extra. There are docs for each at http://daringfireball.net/projects/markdown/ and http://michelf.com/projects/php-markdown/extra/ respectively. Pokédex links are...
Python
0
306c735f863d3fe6a0922a433a7cdd1d21bdd772
fix unit test
flumotion/test/test_feedcomponent010.py
flumotion/test/test_feedcomponent010.py
# -*- Mode: Python; test-case-name: flumotion.test.test_feedcomponent010 -*- # vi:si:et:sw=4:sts=4:ts=4 # # Flumotion - a streaming media server # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). # All rights reserved. # This file may be distributed and/or modified under the terms of # the GNU Genera...
# -*- Mode: Python; test-case-name: flumotion.test.test_feedcomponent010 -*- # vi:si:et:sw=4:sts=4:ts=4 # # Flumotion - a streaming media server # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). # All rights reserved. # This file may be distributed and/or modified under the terms of # the GNU Genera...
Python
0.000001
1afce678dec65bf3c6445322ff7961c7aca05f56
add more error checking for couchbase python client removal
api/code/src/main/python/stratuslab/installator/CouchbaseClient.py
api/code/src/main/python/stratuslab/installator/CouchbaseClient.py
# # Copyright (c) 2013, Centre National de la Recherche Scientifique # # 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 ap...
# # Copyright (c) 2013, Centre National de la Recherche Scientifique # # 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 ap...
Python
0
4475cd927dda1d8ab685507895e0fc4bde6e3b4a
switch window index error
pages/base_page.py
pages/base_page.py
from .page import Page class BasePage(Page): def get_cookie_index_page(self, url, cookie): self.get_relative_path(url) self.maximize_window() self.selenium.add_cookie(cookie) self.selenium.refresh() def switch_to_second_window(self): handles = self.selenium....
from .page import Page class BasePage(Page): def get_cookie_index_page(self, url, cookie): self.get_relative_path(url) self.maximize_window() self.selenium.add_cookie(cookie) self.selenium.refresh() def switch_to_second_window(self): handles = self.selenium....
Python
0.000001
439a09ce69b9ba66e2dc7c21b952ffc438fbe0f4
Add Abuse enum to outcomes. (#13833)
src/sentry/utils/outcomes.py
src/sentry/utils/outcomes.py
""" sentry.utils.outcomes.py ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from datetime import datetime from django.conf import settings from enum import IntEnum import random imp...
""" sentry.utils.outcomes.py ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import from datetime import datetime from django.conf import settings from enum import IntEnum import random imp...
Python
0
e69efded329ebbcf5ccf74ef137dc1a80bd4b4a6
add 2.1.2, re-run cython if needed (#13102)
var/spack/repos/builtin/packages/py-line-profiler/package.py
var/spack/repos/builtin/packages/py-line-profiler/package.py
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os from spack import * class PyLineProfiler(PythonPackage): """Line-by-line profiler.""" homepage = "ht...
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyLineProfiler(PythonPackage): """Line-by-line profiler.""" homepage = "https://githu...
Python
0
381adeeec0fd1d65372d7003183d4b1ec8f2cfbf
Increase V8JS Stack Limit (#584)
dmoj/executors/V8JS.py
dmoj/executors/V8JS.py
from dmoj.executors.script_executor import ScriptExecutor class Executor(ScriptExecutor): ext = 'js' name = 'V8JS' command = 'v8dmoj' test_program = 'print(gets());' address_grace = 786432 nproc = -1 @classmethod def get_version_flags(cls, command): return [('-e', 'print(versi...
from dmoj.executors.script_executor import ScriptExecutor class Executor(ScriptExecutor): ext = 'js' name = 'V8JS' command = 'v8dmoj' test_program = 'print(gets());' address_grace = 786432 nproc = -1 @classmethod def get_version_flags(cls, command): return [('-e', 'print(versi...
Python
0
7fba4a676622e93416f32ee69bfa295647979c7a
fix path on test file
taxcalc/tests/test_calculate.py
taxcalc/tests/test_calculate.py
import os import sys cur_path = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(cur_path, "../../")) sys.path.append(os.path.join(cur_path, "../")) import numpy as np import pandas as pd from numba import jit, vectorize, guvectorize from taxcalc import * def test_make_Calculator(): tax_dta...
import os import sys cur_path = os.path.abspath(os.path.dirname(__file__)) sys.path.append(os.path.join(cur_path, "../../")) sys.path.append(os.path.join(cur_path, "../")) import numpy as np import pandas as pd from numba import jit, vectorize, guvectorize from taxcalc import * def test_make_Calculator(): tax_dta...
Python
0.000001
f4a460646f87b63781ad32b8ef6a0b9c0d8a6290
fix issue #357, which makes real problem more obvious (media file does not exist
moviepy/video/io/VideoFileClip.py
moviepy/video/io/VideoFileClip.py
import os from moviepy.video.VideoClip import VideoClip from moviepy.audio.io.AudioFileClip import AudioFileClip from moviepy.Clip import Clip from moviepy.video.io.ffmpeg_reader import FFMPEG_VideoReader class VideoFileClip(VideoClip): """ A video clip originating from a movie file. For instance: :: ...
import os from moviepy.video.VideoClip import VideoClip from moviepy.audio.io.AudioFileClip import AudioFileClip from moviepy.Clip import Clip from moviepy.video.io.ffmpeg_reader import FFMPEG_VideoReader class VideoFileClip(VideoClip): """ A video clip originating from a movie file. For instance: :: ...
Python
0
faf9638bc69dc79c7fdc9294cc309c40ca57d518
Fix process names in test_nailyd_alive
fuelweb_test/integration/test_nailyd.py
fuelweb_test/integration/test_nailyd.py
import logging import xmlrpclib from fuelweb_test.integration.base import Base from fuelweb_test.helpers import SSHClient class TestNailyd(Base): def __init__(self, *args, **kwargs): super(TestNailyd, self).__init__(*args, **kwargs) self.remote = SSHClient() def setUp(self): logging...
import logging import xmlrpclib from fuelweb_test.integration.base import Base from fuelweb_test.helpers import SSHClient class TestNailyd(Base): def __init__(self, *args, **kwargs): super(TestNailyd, self).__init__(*args, **kwargs) self.remote = SSHClient() def setUp(self): logging...
Python
0.000024
13a64059b71fccb8315f552d8e96f130c513a540
Remove old code.
charity_server.py
charity_server.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 30 01:14:12 2017 @author: colm """ from flask import Flask, jsonify from parse_likecharity import refresh_charities from datetime import datetime app = Flask(__name__) refresh_rate = 24 * 60 * 60 #Seconds start_time = datetime.now() initialized =...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 30 01:14:12 2017 @author: colm """ from flask import Flask, jsonify from parse_likecharity import refresh_charities import threading from datetime import datetime app = Flask(__name__) refresh_rate = 24 * 60 * 60 #Seconds start_time = datetime.no...
Python
0.000045
c5c0b3f8b6d61a1534e74e4ceba8b6a7eedb106d
support multiple registration to the same event
dbus-tools/dbus-register.py
dbus-tools/dbus-register.py
############################################################################### # Copyright 2012 Intel Corporation. # # 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...
############################################################################### # Copyright 2012 Intel Corporation. # # 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...
Python
0
ddf4cbfc263b71ba3eee54b53d33e7ed31e5a8e5
remove args logging
swampdragon/models.py
swampdragon/models.py
from .pubsub_providers.base_provider import PUBACTIONS from .model_tools import get_property from .pubsub_providers.model_publisher import publish_model from .serializers.serializer_importer import get_serializer from django.db.models.signals import pre_delete, m2m_changed from django.dispatch.dispatcher import receive...
from .pubsub_providers.base_provider import PUBACTIONS from .model_tools import get_property from .pubsub_providers.model_publisher import publish_model from .serializers.serializer_importer import get_serializer from django.db.models.signals import pre_delete, m2m_changed from django.dispatch.dispatcher import receive...
Python
0.000003
21bbf9ec71c2d63f5c826dfdc3641927692cb202
test test
test.py
test.py
from flask import Flask import pytest def test_app(): app = Flask(__name__) app.testing = True @app.route("/") def hello(): return "Hello World!" # app.run() # this actually works here... with app.test_client() as client: response = client.get("/") assert response.stat...
from flask import Flask import pytest def test_app(): app = Flask(__name__) app.testing = True @app.route("/") def hello(): return "Hello World!" # app.run() # this actually works here... client = app.test_client() response = client.get("/") assert response.status_code == 200 ...
Python
0.000037
727078f0d7105138310f0870f8ab3a751e0f72da
Fix linting issues in test runner
test.py
test.py
""" Run all tests in this project. """ import unittest if __name__ == "__main__": loader = unittest.TestLoader() tests = loader.discover(".", pattern="test_*.py") runner = unittest.TextTestRunner() runner.run(tests)
# Run all tests in this project import os import sys import unittest if __name__=="__main__": loader = unittest.TestLoader() tests = loader.discover(".", pattern="test_*.py") runner = unittest.TextTestRunner() runner.run(tests)
Python
0.000001
26fc8789445c22f85467387bec7eeb6eccedc2c5
Stop before starting when restarting
synapse/app/synctl.py
synapse/app/synctl.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2014 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2014 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
Python
0.00005
56476902b36ec8b9d7bfcaa3b8442eb51745d044
Set DISPLAY variable on prelaunched processes so the search UI pops up in the right place.
src/prelaunchd.py
src/prelaunchd.py
# Copyright 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
# Copyright 2011 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
Python
0
6c02b743ad3859e05eeb980298e54acf3fbd9788
Add __len__ to FlagField (#3981)
allennlp/data/fields/flag_field.py
allennlp/data/fields/flag_field.py
from typing import Any, Dict, List from overrides import overrides from allennlp.data.fields.field import Field class FlagField(Field[Any]): """ A class representing a flag, which must be constant across all instances in a batch. This will be passed to a `forward` method as a single value of whatever ty...
from typing import Any, Dict, List from overrides import overrides from allennlp.data.fields.field import Field class FlagField(Field[Any]): """ A class representing a flag, which must be constant across all instances in a batch. This will be passed to a `forward` method as a single value of whatever ty...
Python
0.000013
4c66010cf0cd4f763b362b6e84eb67d7ef1278b8
Make "near" group optional in regex
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Brewer # Copyright (c) 2015 Jack Brewer # # License: MIT """This module exports the Stylint plugin class.""" from SublimeLinter.lint import NodeLinter, util class Stylint(NodeLinter): """Provides an inte...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Brewer # Copyright (c) 2015 Jack Brewer # # License: MIT """This module exports the Stylint plugin class.""" from SublimeLinter.lint import NodeLinter, util class Stylint(NodeLinter): """Provides an inte...
Python
0.999796
ba2db7713d4fbb929c26bf9ce848b0f7b420809d
fix typo
bootmachine/settings_tests.py
bootmachine/settings_tests.py
import os """ CONFIGURATION MANAGEMENT """ # salt LOCAL_STATES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "configuration", "states/") LOCAL_PILLARS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "configuration", "...
import os """ CONFIGURATION MANAGEMENT """ # salt LOCAL_SALTSTATES_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "configuration", "states/") LOCAL_PILLARS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), "configuration...
Python
0.999991
6d4eb6ebfb03f974c2f6fb04992fc25e5a53ece9
Change docstring
src/psd2svg/rasterizer/batik_rasterizer.py
src/psd2svg/rasterizer/batik_rasterizer.py
# -*- coding: utf-8 -*- """ Batik-based rasterizer module. Download the latest batik rasterizer to use the module. Note Ubuntu 16.04LTS package is broken and does not work. Prerequisite: wget http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&\ filename=xmlgraphics/batik/binaries/batik-bin-1.9.tar...
# -*- coding: utf-8 -*- """ Batik-based rasterizer module. Download the latest batik rasterizer to use the module. Note Ubuntu 16.04LTS package is broken and does not work. Prerequisite: wget http://www.apache.org/dyn/mirrors/mirrors.cgi?action=download&\ filename=xmlgraphics/batik/binaries/batik-bin-1.9.tar...
Python
0.000002
b8ac65a810a08e11a2f429db08e8b0d4d00651d6
Add ALLOW_HOSTS in production settings
src/biocloud/settings/production.py
src/biocloud/settings/production.py
# In production set the environment variable like this: # DJANGO_SETTINGS_MODULE=my_proj.settings.production from .base import * # NOQA import logging.config # For security and performance reasons, DEBUG is turned off DEBUG = False # Must mention ALLOWED_HOSTS in production! ALLOWED_HOSTS = ['172.16.0....
# In production set the environment variable like this: # DJANGO_SETTINGS_MODULE=my_proj.settings.production from .base import * # NOQA import logging.config # For security and performance reasons, DEBUG is turned off DEBUG = False # Must mention ALLOWED_HOSTS in production! # ALLOWED_HOSTS = [] # Ca...
Python
0
73f49b5603802ccce3a9c4db0ee0b2eaa4bf0e7f
Update startup script (lyli.py)
lyli.py
lyli.py
#!flask/bin/python import logging import werkzeug.serving from app import app import config # we are behind a proxy. log the ip of the end-user, not the proxy. # this will also work without the proxy werkzeug.serving.WSGIRequestHandler.address_string = lambda self: self.headers.get('x-real-ip', self.client_address[0...
#!flask/bin/python import logging from os import fork import werkzeug.serving from app import app pid = fork() if pid > 0: print('PID: %d' % pid) exit(0) elif pid < 0: print('Could not fork: %d' % pid) exit(1) # we are behind a proxy. log the ip of the end-user, not the proxy. # this will also work ...
Python
0
531ada2164f4c184d298110e518415233419bd9f
Update poisson_2d_square_0.py
demo/poisson_2d_square_0.py
demo/poisson_2d_square_0.py
# # Solve -laplace(u) = f in (-1, 1)^2 with T(u) = 0 [1] # from sympy import symbols, integrate from lega.shen_basis import mass_matrix, stiffness_matrix, load_vector from lega.legendre_basis import ForwardLegendreTransformation as FLT import scipy.linalg as la import numpy as np def get_rhs(u): ''' Verif...
# # Solve -laplace(u) = f in (-1, 1)^2 with T(u) = 0 [1] # from sympy import symbols, integrate from lega.shen_basis import mass_matrix, stiffness_matrix, load_vector from lega.legendre_basis import ForwardLegendreTransformation as FLT import scipy.linalg as la import numpy as np def get_rhs(u): ''' Verif...
Python
0.000003
8a74b2f49314f780864f39d04ddaea4695633c21
Add support for feed deltas
src/crawler/lib/headers_handling.py
src/crawler/lib/headers_handling.py
from datetime import timedelta, timezone import dateutil import logging import re from bootstrap import conf from lib.utils import to_hash, utc_now logger = logging.getLogger(__name__) MAX_AGE_RE = re.compile('max-age=([0-9]+)') RFC_1123_FORMAT = '%a, %d %b %Y %X %Z' def rfc_1123_utc(time_obj=None, delta=None): ...
from datetime import timedelta, timezone import dateutil import logging import re from bootstrap import conf from lib.utils import to_hash, utc_now logger = logging.getLogger(__name__) MAX_AGE_RE = re.compile('max-age=([0-9]+)') RFC_1123_FORMAT = '%a, %d %b %Y %X %Z' def rfc_1123_utc(time_obj=None, delta=None): ...
Python
0
1b996bf797b5e1a0203054f11001771ede309b23
remove dead code
scrapi/harvesters/smithsonian.py
scrapi/harvesters/smithsonian.py
''' Harvester for the Smithsonian Digital Repository for the SHARE project Example API call: http://repository.si.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals import re from scrapi.base import helpers from scrapi.base import OAIHarvester class SiHarvester(OAIHa...
''' Harvester for the Smithsonian Digital Repository for the SHARE project Example API call: http://repository.si.edu/oai/request?verb=ListRecords&metadataPrefix=oai_dc ''' from __future__ import unicode_literals import re from scrapi.base import helpers from scrapi.base import OAIHarvester class SiHarvester(OAIHa...
Python
0.999454
1b7e68c3bdfc2f43f754cc39e1f2f80bfa5bee80
Add validate_log_translations flake8 check
designate/hacking/checks.py
designate/hacking/checks.py
# Copyright 2014 Hewlett-Packard Development Company, L.P. # # Author: Kiall Mac Innes <kiall@hp.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/L...
# Copyright 2014 Hewlett-Packard Development Company, L.P. # # Author: Kiall Mac Innes <kiall@hp.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/L...
Python
0.000002
ec9bd84c7487ef0d3fead1641c5132f2f269b5bc
Use absolute path for the result of glob.
lbuild/repository.py
lbuild/repository.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (c) 2015, Fabian Greif # All Rights Reserved. # # The file is part of the lbuild project and is released under the # 2-clause BSD license. See the file `LICENSE.txt` for the full license # governing this code. import os import glob from .exception import Bl...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (c) 2015, Fabian Greif # All Rights Reserved. # # The file is part of the lbuild project and is released under the # 2-clause BSD license. See the file `LICENSE.txt` for the full license # governing this code. import os import glob from .exception import Bl...
Python
0
54115d8ecd90da614a24bb910939001b37acd246
Test pairwise combinations
transmutagen/tests/test_origen.py
transmutagen/tests/test_origen.py
import os from itertools import combinations import numpy as np from ..tape9utils import origen_to_name DATA_DIR = os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir, os.path.pardir, 'docker', 'data')) def load_data(datafile): with open(datafile) as f: return eval(f.read(), {'arra...
import os import numpy as np DATA_DIR = os.path.abspath(os.path.join(__file__, os.path.pardir, os.path.pardir, os.path.pardir, 'docker', 'data')) def load_data(datafile): with open(datafile) as f: return eval(f.read(), {'array': np.array}) def test_data(): for datafile in os.listdir(DATA_DIR): ...
Python
0.000009
c809f4f286bbec3b4cb1ebbff96c23256dd176e8
Change PowerVM version to an int
nova_powervm/virt/powervm/host.py
nova_powervm/virt/powervm/host.py
# Copyright 2014 IBM Corp. # # 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 a...
# Copyright 2014 IBM Corp. # # 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 a...
Python
0.000001
aa262ba141290ba04beb2ec4866b1bad1ea85db2
Fix applying nan mask to specified mask.
turbustat/cube_tools/sim_cubes.py
turbustat/cube_tools/sim_cubes.py
''' Wrapper on spectral_cube for simulated datasets ''' import numpy as np import spectral_cube as SpectralCube try: from signal_id import Noise except ImportError: prefix = "/srv/astro/erickoch/" # Adjust if you're not me! execfile(prefix + "Dropbox/code_development/signal-id/noise.py") class SimCub...
''' Wrapper on spectral_cube for simulated datasets ''' import numpy as np import spectral_cube as SpectralCube try: from signal_id import Noise except ImportError: prefix = "/srv/astro/erickoch/" # Adjust if you're not me! execfile(prefix + "Dropbox/code_development/signal-id/noise.py") class SimCub...
Python
0
89560fd773d833a049824bfa8a7ccf4ce301bed4
remove utils.push_dir
build/fbcode_builder/utils.py
build/fbcode_builder/utils.py
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals 'Miscellaneous utility functions.' import itertools import logging import os import shutil import subprocess import sys from contextlib import cont...
#!/usr/bin/env python from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals 'Miscellaneous utility functions.' import itertools import logging import os import shutil import subprocess import sys from contextlib import cont...
Python
0
287757680b96957ba3e7f9db179896f85790ea69
use cleditor instead of cleditor.min.
addons/web/__openerp__.py
addons/web/__openerp__.py
{ "name" : "web", "category": "Hidden", "description": """ OpenERP Web core module. This module provides the core of the OpenERP web client. """, "depends" : [], 'auto_install': True, 'post_load' : 'wsgi_postload', 'js' : [ "static/lib/datejs/globaliza...
{ "name" : "web", "category": "Hidden", "description": """ OpenERP Web core module. This module provides the core of the OpenERP web client. """, "depends" : [], 'auto_install': True, 'post_load' : 'wsgi_postload', 'js' : [ "static/lib/datejs/globaliza...
Python
0
78ff5c0968e4867b550b4cb6dab70885e7119d11
Use revert instead of reset, bloom-patch remove
bloom/commands/patch/remove_cmd.py
bloom/commands/patch/remove_cmd.py
from __future__ import print_function import sys import argparse from bloom.commands.patch.common import get_patch_config from bloom.commands.patch.common import set_patch_config from bloom.git import branch_exists from bloom.git import checkout from bloom.git import get_commit_hash from bloom.git import get_current...
from __future__ import print_function import sys from argparse import ArgumentParser from bloom.util import add_global_arguments from bloom.util import execute_command from bloom.util import handle_global_arguments from bloom.logging import log_prefix from bloom.logging import error from bloom.logging import debug fr...
Python
0
4e418e6168425173c3e6ed44299864d52da286ee
fix var reference in gutenberg_filter
scripts/gutenberg_filter.py
scripts/gutenberg_filter.py
import os import re class GutenbergIndexFilter(object): # Extensions excluded from rsync of both ftp and cached/generated content EXCLUDED_EXT = ['.zip', '.wav', '.mp3', '.ogg', '.iso', '.ISO', '.rar', '.mpeg', '.m4b'] # Additional extensions excluded from cached/generated files CACHE_EXCLUDED_EXT = ['...
import os import re class GutenbergIndexFilter(object): # Extensions excluded from rsync of both ftp and cached/generated content EXCLUDED_EXT = ['.zip', '.wav', '.mp3', '.ogg', '.iso', '.ISO', '.rar', '.mpeg', '.m4b'] # Additional extensions excluded from cached/generated files CACHE_EXCLUDED_EXT = ['...
Python
0
8a5e49876eae4f2d9bc8ced2fa2e2be0d24ddd68
rollback to 1.7.0 release
scripts/imgtool/__init__.py
scripts/imgtool/__init__.py
# Copyright 2017-2020 Linaro Limited # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
# Copyright 2017-2020 Linaro Limited # # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
Python
0