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
646a073aa1e2e63f06a8cfd56e467bd2f67bceff
use one timezone
SunCycle.py
SunCycle.py
import sublime from datetime import datetime from timezone import LocalTimezone from sun import Sun def logToConsole(str): print(__name__ + ': ' + str) class Settings(): def __init__(self, onChange=None): self.loaded = False self.onChange = onChange self.load() def getTimeZone(sel...
import sublime from datetime import datetime from timezone import LocalTimezone from sun import Sun class Settings(): def __init__(self, onChange=None): self.loaded = False self.onChange = onChange self.load() def load(self): settings = sublime.load_settings(__name__ + '.sublim...
Python
0.977404
e710200d6b589fb149e0dcadf84513c0bfd9382c
Fix some default field values
discovery/domain/apis.py
discovery/domain/apis.py
# -*- coding: utf-8 -*- """ discovery.domain.apis.py ~~~~~~~~~~~~~~~~~~~~~~~~ 'apis' resource and schema settings. :copyright: (c) 2015 by Nicola Iarocci and CIR2000. :license: BSD, see LICENSE for more details. """ _schema = { 'name': { 'type': 'string', 'required': True, ...
# -*- coding: utf-8 -*- """ discovery.domain.apis.py ~~~~~~~~~~~~~~~~~~~~~~~~ 'apis' resource and schema settings. :copyright: (c) 2015 by Nicola Iarocci and CIR2000. :license: BSD, see LICENSE for more details. """ _schema = { 'name': { 'type': 'string', 'required': True, ...
Python
0.000018
d3847357c446c4a1ac50735b983b20cf57f9c7c6
Fix args and return of CounterController functions
malcolm/controllers/countercontroller.py
malcolm/controllers/countercontroller.py
from malcolm.core.controller import Controller from malcolm.core.attribute import Attribute from malcolm.core.numbermeta import NumberMeta from malcolm.core.method import takes, returns import numpy as np class CounterController(Controller): def create_attributes(self): self.counter = Attribute(NumberMet...
from malcolm.core.controller import Controller from malcolm.core.attribute import Attribute from malcolm.core.numbermeta import NumberMeta from malcolm.core.method import takes import numpy as np class CounterController(Controller): def create_attributes(self): self.counter = Attribute(NumberMeta("counte...
Python
0
270af43ffbe8974698d17ff6d5cae20fbf410f73
Add url enter delete element on riak
admin/urls.py
admin/urls.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from .views import CubeHandler, ConnectionHandler, DeleteHandler from .views import ElementHandler, DashboardHandler, APIElementCubeHandler INCLUDE_URLS = [ (r"/admin/delete/(?P<bucket>[\w-]+)/(?P<slug>[\w-]+)", DeleteHandler), (r"/admin/connection/?(?P<slug>[\w-]...
#!/usr/bin/env python # -*- coding: utf-8 -*- from .views import CubeHandler, ConnectionHandler from .views import ElementHandler, DashboardHandler, APIElementCubeHandler INCLUDE_URLS = [ (r"/admin/connection/?(?P<slug>[\w-]+)?", ConnectionHandler), (r"/admin/cube/?(?P<slug>[\w-]+)?", CubeHandler), (r"/ad...
Python
0
c4fadf89161e99514037e8af7953fca0ab13b28e
Fix import.
pymatgen/symmetry/tests/test_groups.py
pymatgen/symmetry/tests/test_groups.py
#!/usr/bin/env python """ TODO: Modify unittest doc. """ from __future__ import division __author__ = "Shyue Ping Ong" __copyright__ = "Copyright 2012, The Materials Virtual Lab" __version__ = "0.1" __maintainer__ = "Shyue Ping Ong" __email__ = "ongsp@ucsd.edu" __date__ = "4/10/14" import unittest import numpy as n...
#!/usr/bin/env python """ TODO: Modify unittest doc. """ from __future__ import division __author__ = "Shyue Ping Ong" __copyright__ = "Copyright 2012, The Materials Virtual Lab" __version__ = "0.1" __maintainer__ = "Shyue Ping Ong" __email__ = "ongsp@ucsd.edu" __date__ = "4/10/14" import unittest import numpy as n...
Python
0.999591
48e589b200894121f32bd96b39f29ad5c0120991
add test_delete_task_id_not_integer
tests/test_agent/test_http_api_tasks.py
tests/test_agent/test_http_api_tasks.py
# No shebang line, this module is meant to be imported # # Copyright 2014 Oliver Palmer # # 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 # # Unle...
# No shebang line, this module is meant to be imported # # Copyright 2014 Oliver Palmer # # 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 # # Unle...
Python
0.000587
c59c91200331c8981aa8bc95eccff1e418f5b332
Fix tests
tests/test_archives/test_serializers.py
tests/test_archives/test_serializers.py
import pytest from api.archives.serializers import ( ArchivedBuildJobSerializer, ArchivedExperimentSerializer, ArchivedExperimentGroupSerializer, ArchivedJobSerializer, ArchivedProjectSerializer, ) from api.build_jobs.serializers import BookmarkedBuildJobSerializer from api.experiment_groups.serial...
import pytest from api.archives.serializers import ( ArchivedBuildJobSerializer, ArchivedExperimentSerializer, ArchivedExperimentGroupSerializer, ArchivedJobSerializer, ArchivedProjectSerializer, ) from api.build_jobs.serializers import BookmarkedBuildJobSerializer from api.experiment_groups.serial...
Python
0.000003
7bdf0ba2ffa74d5a768274573171b11441179713
Add processLine() function
TwircBot.py
TwircBot.py
import socket import sys class TwircBot(object): """ Basic Bot class that reads in a config file, connects to chat rooms, and logs the results. """ def __init__(self, config_file_name): """Parse the configuration file to retrieve the config parameters """ self.irc = socket.socket...
import socket import sys class TwircBot(object): """ Basic Bot class that reads in a config file, connects to chat rooms, and logs the results. """ def __init__(self, config_file_name): """Parse the configuration file to retrieve the config parameters """ self.host='irc.twitch.tv...
Python
0.000015
4d04a9f96c994e4718a036f9c984231bf350918a
Optimize single term search
TxtIndex.py
TxtIndex.py
from TxtReader import TxtReader from StopWords import StopWords import re import string class TxtIndex: def __init__(self, fh): self.stop_words = StopWords() self.__fh = fh self.__reader = TxtReader(fh) self.build_index() def build_index(self): self.keyword2pointers = {...
from TxtReader import TxtReader from StopWords import StopWords import re import string class TxtIndex: def __init__(self, fh): self.stop_words = StopWords() self.__fh = fh self.__reader = TxtReader(fh) self.build_index() def build_index(self): self.keyword2pointers = {...
Python
0.000653
ddcd57017fa9451e85fccf92ec716ae18f91467c
Set default model argument
examples/memnn/train_memnn.py
examples/memnn/train_memnn.py
#!/usr/bin/env python import argparse import collections import chainer from chainer.training import extensions import babi import memnn def train(train_data_path, test_data_path, args): vocab = collections.defaultdict(lambda: len(vocab)) vocab['<unk>'] = 0 train_data = babi.read_data(vocab, train_dat...
#!/usr/bin/env python import argparse import collections import chainer from chainer.training import extensions import babi import memnn def train(train_data_path, test_data_path, args): vocab = collections.defaultdict(lambda: len(vocab)) vocab['<unk>'] = 0 train_data = babi.read_data(vocab, train_dat...
Python
0.000001
60504711a3685a0842d66cc5b9beac1c3f5fbf71
Fix duplicate COPY lines in Dockerfile
cage/container/handler.py
cage/container/handler.py
import os import re import urllib.request from docker import Client # TODO: Check if Docker daemon is running. Start it if it's not. class DockerNotInstalledError(Exception): pass class ContainerHandler: def __init__(self, cage_path, app_path): self.__path = cage_path self.__app_path = app_...
import os import re import urllib.request from docker import Client # TODO: Check if Docker daemon is running. Start it if it's not. class DockerNotInstalledError(Exception): pass class ContainerHandler: def __init__(self, cage_path, app_path): self.__path = cage_path self.__app_path = app_...
Python
0.000107
cdc99912ef99718d587aa21dd1b55b230ff8745b
Thinking AboutWithStatements: DONE
python2/koans/about_with_statements.py
python2/koans/about_with_statements.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Based on AboutSandwichCode in the Ruby Koans # from runner.koan import * import re # For regular expression string comparisons class AboutWithStatements(Koan): def count_lines(self, file_name): try: f = open(file_name) try: ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Based on AboutSandwichCode in the Ruby Koans # from runner.koan import * import re # For regular expression string comparisons class AboutWithStatements(Koan): def count_lines(self, file_name): try: f = open(file_name) try: ...
Python
0.998796
4e12aea0a5479bad8289cbf6c9f460931d51f701
Add autocommit to 1 to avoid select cache ¿WTF?
database.py
database.py
import MySQLdb class database(object): def __init__(self): config = {} execfile("config.py",config) self.db = MySQLdb.connect(config["host"],config["user"],config["password"],config["database"]) self.db.autocommit(True) def insert(self,txt): dbc = self.db.cursor() try: dbc.execute("i...
import MySQLdb class database(object): def __init__(self): config = {} execfile("config.py",config) self.db = MySQLdb.connect(config["host"],config["user"],config["password"],config["database"]) def insert(self,txt): dbc = self.db.cursor() try: dbc.execute("insert into " + txt) dbc...
Python
0
e5d2ed715d83be506ec452ecdd0a22748a84a007
Fix test_pull_doc (missing request id when creating messages)
bokeh/server/protocol/messages/tests/test_pull_doc.py
bokeh/server/protocol/messages/tests/test_pull_doc.py
from __future__ import absolute_import, print_function import unittest import bokeh.document as document from bokeh.plot_object import PlotObject from bokeh.properties import Int, Instance from bokeh.server.protocol import Protocol class AnotherModel(PlotObject): bar = Int(1) class SomeModel(PlotObject): fo...
from __future__ import absolute_import, print_function import unittest import bokeh.document as document from bokeh.plot_object import PlotObject from bokeh.properties import Int, Instance from bokeh.server.protocol import Protocol class AnotherModel(PlotObject): bar = Int(1) class SomeModel(PlotObject): fo...
Python
0
a74fbbd6c822b1384d9cd5f1501c8a01fb2ed9fe
Update deauthorization callback
django4facebook/views.py
django4facebook/views.py
from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseBadRequest from django.views.decorators.csrf import csrf_exempt import facebook from .conf import settings @csrf_exempt def deauthorize_callback(request): """ When user deauthorize this application from facebook the...
from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseBadRequest def deauthorize_callback(request): """ When user deauthorize this application from facebook then we deactivate the user from our system """ if not request.facebook: return HttpResponseB...
Python
0
19a3ead211cc4c00b219329ac63177420cdb71e6
Make all functions available from raysect.core.math.function.
raysect/core/math/function/__init__.py
raysect/core/math/function/__init__.py
# cython: language_level=3 # Copyright (c) 2014-2018, Dr Alex Meakins, Raysect Project # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the ab...
# cython: language_level=3 # Copyright (c) 2014-2018, Dr Alex Meakins, Raysect Project # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the ab...
Python
0
f25e0fe435f334e19fc84a9c9458a1bea4a051f9
Allow to reverse the order of the CSV for a proper reading
money/parser/__init__.py
money/parser/__init__.py
import csv from money.models import Movement def parse_csv(raw_csv, parser, header_lines=0, reverse_order=False): reader = csv.reader(raw_csv, delimiter=',', quotechar='"') rows = [] for row in reader: if reader.line_num > header_lines and row: rows.append(parser.parse_row(row)) ...
import csv from money.models import Movement def parse_csv(raw_csv, parser, header_lines=0): reader = csv.reader(raw_csv, delimiter=',', quotechar='"') rows = [] for row in reader: if reader.line_num > header_lines and row: rows.append(parser.parse_row(row)) return rows def import_movements(data, bank_ac...
Python
0.000186
fa067545657d3b1bb80a4047f175353c4856dd7c
Implement extension normalizer for NamedAccess
thinglang/parser/values/named_access.py
thinglang/parser/values/named_access.py
from thinglang.compiler.buffer import CompilationBuffer from thinglang.compiler.opcodes import OpcodePopDereferenced, OpcodeDereference from thinglang.lexer.tokens.access import LexicalAccess from thinglang.lexer.values.identifier import Identifier from thinglang.lexer.values.numeric import NumericValue from thinglang....
from thinglang.compiler.buffer import CompilationBuffer from thinglang.compiler.opcodes import OpcodePopDereferenced, OpcodeDereference from thinglang.lexer.tokens.access import LexicalAccess from thinglang.lexer.values.identifier import Identifier from thinglang.lexer.values.numeric import NumericValue from thinglang....
Python
0
a259a5f2c42b58c236f3ec1fa28ea9fa5218fc29
Exclude EMC plugin since it cannot be run non-interactively
testcases/cloud_admin/run_sos_report.py
testcases/cloud_admin/run_sos_report.py
#!/usr/bin/python import os import time from eucaops import Eucaops from eutester.eutestcase import EutesterTestCase from eutester.machine import Machine class SOSreport(EutesterTestCase): def __init__(self): self.setuptestcase() self.setup_parser() self.start_time = int(time.time()) ...
#!/usr/bin/python import os import time from eucaops import Eucaops from eutester.eutestcase import EutesterTestCase from eutester.machine import Machine class SOSreport(EutesterTestCase): def __init__(self): self.setuptestcase() self.setup_parser() self.start_time = int(time.time()) ...
Python
0.000002
a48e50da90765b65f754a6c6eaefce7cb7e22521
Modify unicode text for Crew model
ITDB/ITDB_Main/models.py
ITDB/ITDB_Main/models.py
from django.db import models import datetime # Create your models here. class Theater(models.Model): name = models.CharField(max_length=100) street_address = models.CharField(max_length=40, blank=True) city = models.CharField(max_length=40) state_or_province = models.CharField(max_length=50, blank=True...
from django.db import models import datetime # Create your models here. class Theater(models.Model): name = models.CharField(max_length=100) street_address = models.CharField(max_length=40, blank=True) city = models.CharField(max_length=40) state_or_province = models.CharField(max_length=50, blank=True...
Python
0.000013
27fe88a325251c4b12a4b5f020c1d6c5e83b4b59
Change var to be more consistent
untz_manager/encoder.py
untz_manager/encoder.py
"""Encoding related operations""" import logging import subprocess import sys import taglib LOGGER = logging.getLogger(__name__) def _get_vorbis_comments(audio_file, pattern): macros = (('%g', 'GENRE'), ('%n', 'TRACKNUMBER'), ('%t', 'TITLE'), ('%d', 'DATE')) params...
"""Encoding related operations""" import logging import subprocess import sys import taglib LOGGER = logging.getLogger(__name__) def _get_vorbis_comments(audio_file, pattern): macros = (('%g', 'GENRE'), ('%n', 'TRACKNUMBER'), ('%t', 'TITLE'), ('%d', 'DATE')) params...
Python
0
234609000de3da9449dacb363e58bf60c0e3a4d8
Change DATABASES default db to PostgreSQL
site/litlong/settings.py
site/litlong/settings.py
""" Django settings for litlong project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) im...
""" Django settings for litlong project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) im...
Python
0
d6452848521bba37fa01fd7b82fe27d725edd2cf
The real PER_PAGE limit is 100.
uservoice/collection.py
uservoice/collection.py
PER_PAGE = 100 class Collection: def __init__(self, client, query, limit=2**60): self.client = client self.query = query self.limit = limit self.per_page = min(self.limit, PER_PAGE) self.pages = {} self.response_data = None def __len__(self): if not self....
PER_PAGE = 500 class Collection: def __init__(self, client, query, limit=2**60): self.client = client self.query = query self.limit = limit self.per_page = min(self.limit, PER_PAGE) self.pages = {} self.response_data = None def __len__(self): if not self....
Python
0.999177
438bc2afc5802bed737fb88c38dcf1eabe4b568d
Correct test
myria/test/test_plans.py
myria/test/test_plans.py
import unittest import myria.plans from myria.schema import MyriaSchema QUALIFIED_NAME = {'userName': 'public', 'programName': 'adhoc', 'relationName': 'relation'} SCHEMA = MyriaSchema({'columnNames': ['column'], 'columnTypes': ['INT_TYPE']}) WORK = [(0, 'http:...
import unittest import myria.plans from myria.schema import MyriaSchema QUALIFIED_NAME = {'userName': 'public', 'programName': 'adhoc', 'relationName': 'relation'} SCHEMA = MyriaSchema({'columnNames': ['column'], 'columnTypes': ['INT_TYPE']}) WORK = [(0, 'http:...
Python
0.001917
b13edc289905dd4d2c331eddffa490305f9ef827
fix a typo
bugzilla/agents.py
bugzilla/agents.py
import urllib from bugzilla.models import * from bugzilla.utils import * class InvalidAPI_ROOT(Exception): def __str__(self): return "Invalid API url specified. " + \ "Please set BZ_API_ROOT in your environment " + \ "or pass it to the agent constructor" class BugzillaAgen...
import urllib from bugzilla.models import * from bugzilla.utils import * class InvalidAPI_ROOT(Exception): def __str__(self): return "Invalid API url specified. " + \ "Please set BZ_API_ROOT in your environment " + \ "or pass it to the agent constructor" class BugzillaAgen...
Python
1
c4ef7fe24477d9160214c1cd2938aa8f5135d84b
Add other needed method stubs
utils/database_setup.py
utils/database_setup.py
import pandas import argparse def get_excel(filepath): """ Returns a Pandas datafile that contains the contents of a Microsoft Excel Spreadsheet Params: filepath - A string containing the path to the file Returns: A Pandas datafile """ return pandas.read_excel(filepath) d...
import pandas def load_excel(filepath): """ Returns a Pandas datafile that contains the contents of a Microsoft Excel Spreadsheet Params: filepath - A string containing the path to the file Returns: A Pandas datafile """ return pandas.read_excel(filepath) def get_column_n...
Python
0.000001
e838370958c90ce1123aa1a5ab0823169257cfa9
Make configuration per model instead of per project.
adminfilters/admin.py
adminfilters/admin.py
from django.contrib.admin.views.main import ChangeList from django.contrib.admin.options import ModelAdmin from django.contrib.admin.filterspecs import FilterSpec class GenericFilterSpec(FilterSpec): def __init__(self, data, request, title): self.data = data self.request = request self._ti...
from django.contrib.admin.views.main import ChangeList from django.contrib.admin.options import ModelAdmin from django.contrib.admin.filterspecs import FilterSpec from django.conf import settings GENERIC_FILTERS_ON_TOP = getattr(settings, "GENERIC_FILTERS_ON_TOP", False) class GenericFilterSpec(FilterSpec): def ...
Python
0
81f6bbbd52acc1aa8eba6d5f14d21988f86549e2
Fix formatting of exceptions
alltheitems/obtaining.py
alltheitems/obtaining.py
import bottle import more_itertools import alltheitems.util METHODS = {} def method(name): def wrapper(f): METHODS[name] = f return f return wrapper @method('craftingShaped') def crafting_shaped(i, item_info, method, **kwargs): return bottle.template(""" <p>{{item_info['name']}}...
import bottle import more_itertools import alltheitems.util METHODS = {} def method(name): def wrapper(f): METHODS[name] = f return f return wrapper @method('craftingShaped') def crafting_shaped(i, item_info, method, **kwargs): return bottle.template(""" <p>{{item_info['name']}}...
Python
0.000017
8860810f9643b5647402ac2ff774245d18c08924
fix comment
scripts/colab_install.py
scripts/colab_install.py
""" Original code by @philopon https://gist.github.com/philopon/a75a33919d9ae41dbed5bc6a39f5ede2 """ import sys import os import requests import subprocess import shutil from logging import getLogger, StreamHandler, INFO logger = getLogger(__name__) logger.addHandler(StreamHandler()) logger.setLevel(INFO) def inst...
""" Original code by @philopon https://gist.github.com/philopon/a75a33919d9ae41dbed5bc6a39f5ede2 """ import sys import os import requests import subprocess import shutil from logging import getLogger, StreamHandler, INFO logger = getLogger(__name__) logger.addHandler(StreamHandler()) logger.setLevel(INFO) def inst...
Python
0
aff03ceb63ddc37227c4302c4bd43549c71591b5
Change the name for get_final_E to read_final_E
vasp_tool/patch_vasp.py
vasp_tool/patch_vasp.py
##################################################################### # The patcher for factory ase.calculator.vasp.Vasp class # # will change the behavior of the POSCAR writer to use vasp5 format # ##################################################################### from ase.calculators.vasp.create_input ...
##################################################################### # The patcher for factory ase.calculator.vasp.Vasp class # # will change the behavior of the POSCAR writer to use vasp5 format # ##################################################################### from ase.calculators.vasp.create_input ...
Python
0.999997
bb12ec846e6c7f1a4ce458645595c2c30ffb46bc
Rename fixture
tests/mock_vws/test_invalid_given_id.py
tests/mock_vws/test_invalid_given_id.py
""" Tests for passing invalid endpoints which require a target ID to be given. """ import uuid from urllib.parse import urljoin import pytest import requests from _pytest.fixtures import SubRequest from requests import codes from requests_mock import GET from common.constants import ResultCodes from tests.conftest i...
""" Tests for passing invalid endpoints which require a target ID to be given. """ import uuid from urllib.parse import urljoin import pytest import requests from _pytest.fixtures import SubRequest from requests import codes from requests_mock import GET from common.constants import ResultCodes from tests.conftest i...
Python
0.000001
cce88a16cc367ef8df9533b848e6fae29ac8a4d1
update build setup
build_win_setup.py
build_win_setup.py
""" @file @brief Builds a setup for the teachings: ensae_teaching_cs """ try: import pymyinstall except ImportError: import sys sys.path.append("../pymyinstall/src") import pymyinstall try: import pyquickhelper except ImportError: import sys sys.path.append("../pyquickhelper/src") impor...
""" @file @brief Builds a setup for the teachings: ensae_teaching_cs """ try: import pymyinstall except ImportError: import sys sys.path.append("../pymyinstall/src") import pymyinstall try: import pyquickhelper except ImportError: import sys sys.path.append("../pyquickhelper/src") impor...
Python
0.000001
ec295698b683dd5f04df1fff49f9d1e2afdf0a86
fix bugs in writing out failures
tests/selenium/remotecontrol/test_ol.py
tests/selenium/remotecontrol/test_ol.py
from selenium import selenium import time import sys from ConfigParser import ConfigParser if len(sys.argv) > 2: filename = sys.argv[2] else: filename = "config.cfg" c = ConfigParser() c.read(filename) targets = {} sections = c.sections() for s in sections: targets[s] = dict(c.items(s)) targets[s][...
from selenium import selenium import time import sys from ConfigParser import ConfigParser if len(sys.argv) > 2: filename = sys.argv[2] else: filename = "config.cfg" c = ConfigParser() c.read(filename) targets = {} sections = c.sections() for s in sections: targets[s] = dict(c.items(s)) targets[s][...
Python
0.007053
be92cf747a718bc004bd2024dbdcb527205d9b44
remove an extra import
scripts/lib/flattened.py
scripts/lib/flattened.py
def flatten(l): # from http://stackoverflow.com/a/2158532/2347774 for el in l: if isinstance(el, list) and not isinstance(el, str): yield from flatten(el) else: yield el
import collections def flatten(l): # from http://stackoverflow.com/a/2158532/2347774 for el in l: if isinstance(el, list) and not isinstance(el, str): yield from flatten(el) else: yield el
Python
0.000006
56ade9d8c571c3836148ecbd1c306fa3c7796279
use parser.error() instead of raise ValueError
Lib/fontmake/__main__.py
Lib/fontmake/__main__.py
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
Python
0.000007
bf163f45d1e7a28db34396b20209778668103f0a
remove password option for redis
Run/main.py
Run/main.py
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: main.py Description : 运行主函数 Author : JHao date: 2017/4/1 ------------------------------------------------- Change Activity: 2017/4/1: ----------------------------------------...
# -*- coding: utf-8 -*- """ ------------------------------------------------- File Name: main.py Description : 运行主函数 Author : JHao date: 2017/4/1 ------------------------------------------------- Change Activity: 2017/4/1: ----------------------------------------...
Python
0.000003
a1dd1c0a8b91cb75ef773ed9566fc93b232bc2b7
Fix a broken test_dbm_gnu as introducted by r67380.
Lib/test/test_dbm_gnu.py
Lib/test/test_dbm_gnu.py
import dbm.gnu as gdbm import unittest import os from test.support import verbose, TESTFN, run_unittest, unlink filename = TESTFN class TestGdbm(unittest.TestCase): def setUp(self): self.g = None def tearDown(self): if self.g is not None: self.g.close() unlink(filename) ...
import dbm.gnu as gdbm import unittest import os from test.support import verbose, TESTFN, run_unittest, unlink filename = TESTFN class TestGdbm(unittest.TestCase): def setUp(self): self.g = None def tearDown(self): if self.g is not None: self.g.close() unlink(filename) ...
Python
0.000002
01923b0c16732277e64bcf10b101eb339bd8c0e5
Add tests for fnmatch.filter and translate.
Lib/test/test_fnmatch.py
Lib/test/test_fnmatch.py
"""Test cases for the fnmatch module.""" from test import support import unittest from fnmatch import (fnmatch, fnmatchcase, _MAXCACHE, _cache, _cacheb, purge, translate, filter) class FnmatchTestCase(unittest.TestCase): def tearDown(self): purge() def check_match(self, fil...
"""Test cases for the fnmatch module.""" from test import support import unittest from fnmatch import fnmatch, fnmatchcase, _MAXCACHE, _cache, _cacheb, purge class FnmatchTestCase(unittest.TestCase): def tearDown(self): purge() def check_match(self, filename, pattern, should_match=1, fn=fnmatch): ...
Python
0
a157ee8bc8c740ba7482f8e4e9116213fb18c935
fix of type in merging
src/gl_lr.py
src/gl_lr.py
from __future__ import division __author__ = 'Vladimir Iglovikov' ''' I will try to use logistic regression from Graphlab to predict ''' import graphlab as gl import os print 'reading train' train = gl.SFrame(os.path.join('..', 'data', 'trainSearch_1')) print print 'train shape' print train.shape print 'reading...
from __future__ import division __author__ = 'Vladimir Iglovikov' ''' I will try to use logistic regression from Graphlab to predict ''' import graphlab as gl import os print 'reading train' train = gl.SFrame(os.path.join('..', 'data', 'trainSearch_1')) print print 'train shape' print train.shape print 'reading...
Python
0.000001
b0614a15cedd53ba752beca9107698636ee0f8cf
replace wtf-deprecated stuff
app.py
app.py
from flask import Flask, render_template, request from flask_bootstrap import Bootstrap from flask.ext.sqlalchemy import SQLAlchemy from sqlalchemy.orm.properties import ColumnProperty from flask_wtf import Form from wtforms import StringField, SubmitField, validators from wtforms.validators import ValidationError imp...
from flask import Flask, render_template, request from flask_bootstrap import Bootstrap from flask.ext.sqlalchemy import SQLAlchemy from sqlalchemy.orm.properties import ColumnProperty from flask_wtf import Form from wtforms import TextField, SubmitField, validators from wtforms.validators import ValidationError impor...
Python
0.000152
b914f700687f6fbf6ccc0aac08d92ffaac76f89a
bump retry timeout, 20s is too low during meltdowns
flumine/streams/basestream.py
flumine/streams/basestream.py
import threading import queue import logging import betfairlightweight from betfairlightweight import StreamListener from tenacity import wait_exponential logger = logging.getLogger(__name__) class BaseStream(threading.Thread): LISTENER = StreamListener MAX_LATENCY = 0.5 RETRY_WAIT = wait_exponential(mu...
import threading import queue import logging import betfairlightweight from betfairlightweight import StreamListener from tenacity import wait_exponential logger = logging.getLogger(__name__) class BaseStream(threading.Thread): LISTENER = StreamListener MAX_LATENCY = 0.5 RETRY_WAIT = wait_exponential(mu...
Python
0
c3529def6c32bdf7d9f948374ff3aba634d5b8f7
UPDATE 4th-Trial
app.py
app.py
#!/usr/bin/env python import urllib import json import os from flask import Flask from flask import request from flask import make_response # Flask app should start in global layout app = Flask(__name__) @app.route('/webhook', methods=['POST']) def webhook(): req = request.get_json(silent=True, force=True) ...
#!/usr/bin/env python import urllib import json import os from flask import Flask from flask import request from flask import make_response # Flask app should start in global layout app = Flask(__name__) @app.route('/webhook', methods=['POST']) def webhook(): req = request.get_json(silent=True, force=True) ...
Python
0
277e3ef7544a64ddb2fa9f31b66597036a38e65b
Remove widget and test paths.
app.py
app.py
#!/usr/bin/env python import argparse from flask import Flask, render_template import app_config from render_utils import make_context, urlencode_filter import static app = Flask(app_config.PROJECT_NAME) app.jinja_env.filters['urlencode'] = urlencode_filter # Example application views @app.route('/') def index(): ...
#!/usr/bin/env python import argparse from flask import Flask, render_template import app_config from render_utils import make_context, urlencode_filter import static app = Flask(app_config.PROJECT_NAME) app.jinja_env.filters['urlencode'] = urlencode_filter # Example application views @app.route('/') def index(): ...
Python
0
a0883d386f6c35f8cb70c6d21ad1cc37dccb90b6
Update host
app.py
app.py
from flask import Flask # from image_classification import ImageClassifier app = Flask(__name__) PORT = 33507 HOST = '0.0.0.0' @app.route('/') def home(): return 'Hello classification world!' if __name__ == '__main__': app.run(host=HOST, port=PORT)
from flask import Flask # from image_classification import ImageClassifier app = Flask(__name__) PORT = 33507 @app.route('/') def home(): return 'Hello classification world!' if __name__ == '__main__': app.run(port=PORT)
Python
0
355629e1e2e2423a4ea1ad859506e380e6ddbc89
define special route for twitter
app.py
app.py
# ingredients: tinydb joblib.Memory from flask import Flask from ml import store_feedback from ml import learn from proxy import proxy import sys import trace import logging as log # should be set at the project level log.basicConfig(filename="./log", level=log.INFO) # create a Trace object, telling it what to igno...
# ingredients: tinydb joblib.Memory from flask import Flask from ml import store_feedback from ml import learn from proxy import proxy import sys import trace import logging as log # should be set at the project level log.basicConfig(filename="./log", level=log.INFO) # create a Trace object, telling it what to igno...
Python
0.000184
027033d55efc1be05b6dc2ffdc422fdfe2b2db1b
Add csrf_token to cookies if there isn't one
app.py
app.py
import os import datetime from flask import (Flask, render_template, redirect, request, abort, url_for, make_response) from flask_sqlalchemy import SQLAlchemy from flask_bcrypt import Bcrypt from flask_wtf.csrf import CSRFProtect, generate_csrf app = Flask(__name__) CSRFProtect().init_app(app) # C...
import os import datetime from flask import (Flask, render_template, redirect, request, abort, url_for, make_response) from flask_sqlalchemy import SQLAlchemy from flask_bcrypt import Bcrypt from flask_wtf.csrf import CSRFProtect, generate_csrf app = Flask(__name__) CSRFProtect().init_app(app) # C...
Python
0
58dfa1e8df073cafc23871e76d317172758b05a6
change app.py
app.py
app.py
from bottle import route, run from bottle import static_file, request from bottle import template, get, error import os # static routes @get('/<filename:re:.*\.css>') def stylesheets(filename): return static_file(filename, root='static/css') @get('/<filename:re:.*\.js>') def javascripts(filename): return static_fil...
from bottle import route, run from bottle import static_file, request from bottle import template, get, error import os # static routes @get('/<filename:re:.*\.css>') def stylesheets(filename): return static_file(filename, root='static/css') @get('/<filename:re:.*\.js>') def javascripts(filename): return static_fil...
Python
0.000003
d6d67b8a831959d79a94e927bae3373bcbd4ef0a
print request args
app.py
app.py
import json from flask import Flask, request, jsonify app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" @app.route("/paid", methods=['POST']) def paid(): print(json.dumps(request.args)) return jsonify(request.args) if __name__ == "__main__": app.run()
from flask import Flask, request, jsonify app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" @app.route("/paid", methods=['POST']) def paid(): # print(request.args.get('invoice')) return jsonify(request.args) if __name__ == "__main__": app.run()
Python
0.000003
1599c85d2ff27ed46580679ed119cb487c230a8d
add port, host, noconfig parameters
app.py
app.py
#!/usr/bin/env python2.7 import sys from ConfigParser import SafeConfigParser from bottle import route, post, run, request, view, response, static_file from sh import cmus_remote from optparse import OptionParser parser = OptionParser() parser.add_option("-n", "--noconfig", action="store_true", dest="noconfig", ...
#!/usr/bin/env python2.7 import sys from ConfigParser import SafeConfigParser from bottle import route, post, run, request, view, response, static_file from sh import cmus_remote def read_config(config_file): r = {} parser = SafeConfigParser() n = parser.read(config_file) if not len(n): raise(Exceptio...
Python
0.000011
c274325f89ef9a8fa25128b85b6d25dc634fe4a2
Fix flood control exception
bot.py
bot.py
import os import sys import logging from time import sleep from flask import request import telegram from telegram.error import NetworkError, Unauthorized, RetryAfter from leonard import Leonard from libs import shrt WEBHOOK_HOSTNAME = os.environ.get('WEBHOOK_HOSTNAME', 'https://leonardbot.herokuapp.com') debug = ...
import os import sys import logging from time import sleep from flask import request import telegram from telegram.error import NetworkError, Unauthorized from leonard import Leonard from libs import shrt WEBHOOK_HOSTNAME = os.environ.get('WEBHOOK_HOSTNAME', 'https://leonardbot.herokuapp.com') debug = False if 'BO...
Python
0.000005
1a522469da3a9ca96b43bace7fdd2d4047c52e32
Update handled exception
bot.py
bot.py
import json from json import JSONDecodeError import requests import boto3 import validatesns from flask import Flask, request, abort from flow import Flow from raven.contrib.flask import Sentry from config import ORG_ID, CHANNEL_MAP, SENTRY_DSN, BOTNAME, BOTPW app = Flask(__name__) try: flow = Flow(BOTNAME)...
import json import requests import boto3 import validatesns from flask import Flask, request, abort from flow import Flow from raven.contrib.flask import Sentry from config import ORG_ID, CHANNEL_MAP, SENTRY_DSN, BOTNAME, BOTPW app = Flask(__name__) try: flow = Flow(BOTNAME) except flow.FlowError as e: ...
Python
0.000001
0153ff44dc484cb0d74a33e202a5decb8b714b81
Bot responds to tweets
bot.py
bot.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from wolf import Wolf import json import requests import sys import time import tweepy import wolframalpha from keys import * # authenticate with twitter & wolfram alpha auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SEC...
#!/usr/bin/env python # -*- coding: utf-8 -*- import tweepy, time, sys from keys import * auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) auth.set_access_token(ACCESS_KEY, ACCESS_SECRET) api = tweepy.API(auth) infile = open('response.txt','r') f = infile.readlines() infile.close() cursor = tweepy.Cursor(a...
Python
0.999976
1eb70787368fb6b1f825818b5c8d290ba9d73cd2
add error handler
bot.py
bot.py
import re import json import asyncio from urllib.parse import urljoin import telepot import telepot.async import aiohttp class ComposerBot(telepot.async.Bot): def __init__(self, *args, config=None, **kwargs): super(ComposerBot, self).__init__(*args, **kwargs) self.config = config self.mp...
import re import json import asyncio from urllib.parse import urljoin import telepot import telepot.async import aiohttp class ComposerBot(telepot.async.Bot): def __init__(self, *args, config=None, **kwargs): super(ComposerBot, self).__init__(*args, **kwargs) self.config = config self.mp...
Python
0.000001
d52c4340a62802bcd0fcbd68516c5ac66fb10436
Update function name used in the streamtester
ftfy/streamtester/__init__.py
ftfy/streamtester/__init__.py
""" This file defines a general method for evaluating ftfy using data that arrives in a stream. A concrete implementation of it is found in `twitter_tester.py`. """ from __future__ import print_function, unicode_literals from ftfy.fixes import fix_encoding from ftfy.chardata import possible_encoding class StreamTeste...
""" This file defines a general method for evaluating ftfy using data that arrives in a stream. A concrete implementation of it is found in `twitter_tester.py`. """ from __future__ import print_function, unicode_literals from ftfy.fixes import fix_text_encoding from ftfy.chardata import possible_encoding class Stream...
Python
0
cd9b16dd5bd9ae41fb8cf7a3f8a2b02dfeb227bf
set db for me
gamechat/gamechat/settings.py
gamechat/gamechat/settings.py
""" Django settings for gamechat project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) i...
""" Django settings for gamechat project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) i...
Python
0
7a786fd031c3faa057256abc5d9cb47618041696
Configure max build age on the monitoring side
checks.d/veneur.py
checks.d/veneur.py
import datetime from urlparse import urljoin import requests # project from checks import AgentCheck class Veneur(AgentCheck): VERSION_METRIC_NAME = 'veneur.deployed_version' BUILDAGE_METRIC_NAME = 'veneur.build_age' def check(self, instance): success = 0 host = instance['host'] ...
import datetime from urlparse import urljoin import requests # project from checks import AgentCheck class Veneur(AgentCheck): VERSION_METRIC_NAME = 'veneur.deployed_version' BUILDAGE_METRIC_NAME = 'veneur.build_age' MAX_AGE_CHECK_NAME = 'veneur.build_age.fresh' # Check that the build is no more th...
Python
0
ef6e0b681c1c7812e9d11fcd2fffd36468c00513
Create custom field : SearchButtonField (#77)
cineapp/widgets.py
cineapp/widgets.py
# -*- coding: utf-8 -*- from wtforms import fields, widgets # Define wtforms widget and field class CKTextAreaWidget(widgets.TextArea): def __call__(self, field, **kwargs): kwargs.setdefault('class_', 'ckeditor') html_string = super(CKTextAreaWidget, self).__call__(field, **kwargs) html_st...
# -*- coding: utf-8 -*- from wtforms import fields, widgets # Define wtforms widget and field class CKTextAreaWidget(widgets.TextArea): def __call__(self, field, **kwargs): kwargs.setdefault('class_', 'ckeditor') html_string = super(CKTextAreaWidget, self).__call__(field, **kwargs) html_st...
Python
0
b54a3fa45cca86fddcd6130e67a306d93a079fff
update Config File parsing to new API
Samples/Python/sample.py
Samples/Python/sample.py
import Ogre import OgreRTShader class SGResolver(Ogre.MaterialManager_Listener): def __init__(self, shadergen): Ogre.MaterialManager_Listener.__init__(self) self.shadergen = shadergen def handleSchemeNotFound(self, idx, name, mat, lod_idx, rend): if name != OgreRTShader.cvar.ShaderGene...
import Ogre import OgreRTShader class SGResolver(Ogre.MaterialManager_Listener): def __init__(self, shadergen): Ogre.MaterialManager_Listener.__init__(self) self.shadergen = shadergen def handleSchemeNotFound(self, idx, name, mat, lod_idx, rend): if name != OgreRTShader.cvar.ShaderGene...
Python
0
01ec4fd2e294bcb524c6724d6727da7b1a882f0d
Exit code 2 for normal not running remote status
guild/commands/remote_impl.py
guild/commands/remote_impl.py
# Copyright 2017-2018 TensorHub, 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 writ...
# Copyright 2017-2018 TensorHub, 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 writ...
Python
0
859d5ce6553b7651f05f27adec28e8c4330ca9bb
Add id of node generating the supervisor event
handler/supervisor_to_serf.py
handler/supervisor_to_serf.py
#!/usr/bin/env python import json import sys from utils import serf_event def write_stdout(s): sys.stdout.write(s) sys.stdout.flush() def write_stderr(s): sys.stderr.write(s) sys.stderr.flush() def main(): while True: write_stdout('READY\n') # transition from ACKNOWLEDGED to READY ...
#!/usr/bin/env python import json import sys from utils import serf_event def write_stdout(s): sys.stdout.write(s) sys.stdout.flush() def write_stderr(s): sys.stderr.write(s) sys.stderr.flush() def main(): while True: write_stdout('READY\n') # transition from ACKNOWLEDGED to READY ...
Python
0.000001
20bc11aab936e96109c6d5407b22b0c40e256a54
total score should never be negative
pranger/front/views.py
pranger/front/views.py
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals from collections import defaultdict from django.views.generic.base import TemplateView from django.views.generic.detail import DetailView from django.views.generic.list import ListView from braces.views import ...
# -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals from collections import defaultdict from django.views.generic.base import TemplateView from django.views.generic.detail import DetailView from django.views.generic.list import ListView from braces.views import ...
Python
0.999999
2b0acfcd5a1fd5529ed8abf0af32fd986f3f4534
Add Uses and Provides classes to metadata module
wmtmetadata/metadata.py
wmtmetadata/metadata.py
"""Create the metadata files describing a WMT component.""" import os import re import fnmatch import warnings import json import yaml from wmtmetadata.utils import commonpath from wmtmetadata import metadata_dir indent = 2 class MetadataBase(object): def __init__(self, component): self.filename = Non...
"""Create the metadata files describing a WMT component.""" import os import warnings import json from wmtmetadata.utils import commonpath indent = 2 class MetadataBase(object): def __init__(self, component): self.filename = None self.data = None self.api = component['api'] sel...
Python
0
e3916e6403b8933d9d8896b7289321c45b9990d2
Refactor if clause to check for string in list
wqflask/wqflask/docs.py
wqflask/wqflask/docs.py
import codecs from flask import g from wqflask.database import database_connection class Docs: def __init__(self, entry, start_vars={}): results = None with database_connection() as conn, conn.cursor() as cursor: cursor.execute("SELECT Docs.title, CAST(Docs.content AS BINARY) " ...
import codecs from flask import g from wqflask.database import database_connection class Docs: def __init__(self, entry, start_vars={}): results = None with database_connection() as conn, conn.cursor() as cursor: cursor.execute("SELECT Docs.title, CAST(Docs.content AS BINARY) " ...
Python
0
cee5e2aae5144fd1280240e069895049fe34de96
Update osmfilter.py
osm-atlas-get/osmfilter.py
osm-atlas-get/osmfilter.py
#!/usr/bin/env python # -*- coding: utf-8 -*- #interface for osmconvert+osmfilter import tempfile import os def get_args(): p = argparse.ArgumentParser(description='Filter pbf file using osmfilter') p.add_argument('--filter', help='filter string', type=str) p.add_argument('--debug', '-d', help='debug mod...
#!/usr/bin/env python # -*- coding: utf-8 -*- #interface for osmconvert+osmfilter def get_args(): p = argparse.ArgumentParser(description='Filter pbf file using osmfilter') p.add_argument('--filter', help='filter string', type=str) p.add_argument('--debug', '-d', help='debug mode', action='store_true') ...
Python
0.000001
e24f7cbbc1495ccefeeb4c17d78b3afcc93208e1
Remove the @skip decorator for the whole class:
test/forward/TestForwardDeclaration.py
test/forward/TestForwardDeclaration.py
"""Test that forward declaration of a data structure gets resolved correctly.""" import os, time import unittest2 import lldb from lldbtest import * class ForwardDeclarationTestCase(TestBase): mydir = "forward" @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsy...
"""Test that forward declaration of a data structure gets resolved correctly.""" import os, time import unittest2 import lldb from lldbtest import * @unittest2.skip("rdar://problem/8641483 ./dotest.py -v -t -w forward seg faults") class ForwardDeclarationTestCase(TestBase): mydir = "forward" @unittest2.skip...
Python
0.001719
665943c0736cd83662bc8bebe072045f163b28c9
Revise func docstrring
alg_insertion_sort.py
alg_insertion_sort.py
from __future__ import absolute_import from __future__ import print_function from __future__ import division def insertion_sort(nums): """Insertion sort algortihm. Time complexity: O(n^2). Space complexity: O(1). """ # Starting at pos i >= 1, swap (num[j-1], num[j]), for j=i,i-1,...,1, # if o...
from __future__ import absolute_import from __future__ import print_function from __future__ import division def insertion_sort(nums): """Insertion Sort algortihm. Time complexity: O(n^2). Space complexity: O(1). """ # Starting at pos i >= 1, swap (num[j-1], num[j]), for j=i,i-1,...,1, # if o...
Python
0.000013
1b47086e3ef45b6e668ed330ac017badc0afae96
Add opbeat contrib
defprogramming/settings.py
defprogramming/settings.py
# Django settings for defprogramming project. import os BASE_DIR = os.path.abspath(os.path.dirname(__file__)) ADMINS = () MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db/development.sqlite3'), } } TIME_ZONE = 'America/Chic...
# Django settings for defprogramming project. import os BASE_DIR = os.path.abspath(os.path.dirname(__file__)) ADMINS = () MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db/development.sqlite3'), } } TIME_ZONE = 'America/Chic...
Python
0
22029728795a850d1b57824c6a91ddd5378f9760
fix some typos
robj/__init__.py
robj/__init__.py
# # Copyright (c) 2010 rPath, Inc. # # 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 will be useful, b...
# # Copyright (c) 2010 rPath, Inc. # # 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 will be useful, b...
Python
0.999999
1b6b7de39dcb80ff083bd21c6665c0dcaa5200fa
Update last_api_activity in Tooltron add_card_event view.
robocrm/views.py
robocrm/views.py
from django.http import HttpResponse from django.core.exceptions import PermissionDenied, ObjectDoesNotExist from django.contrib.auth import authenticate, login from api.models import APIRequest from django.views.decorators.http import require_POST from projects.models import Project from django.utils import timezone f...
from django.http import HttpResponse from django.core.exceptions import PermissionDenied, ObjectDoesNotExist from django.contrib.auth import authenticate, login from api.models import APIRequest from django.views.decorators.http import require_POST from projects.models import Project from .models import * def roboauth...
Python
0
1d1f5003a6493cbd8556b4f16d5a591d1cc2ace2
Update VersionOneAgent3.py
PlatformAgents/com/cognizant/devops/platformagents/agents/alm/versionone/VersionOneAgent3.py
PlatformAgents/com/cognizant/devops/platformagents/agents/alm/versionone/VersionOneAgent3.py
#------------------------------------------------------------------------------- # -*- coding: utf-8 -*- # Copyright 2017 Cognizant Technology Solutions # # 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 ...
#------------------------------------------------------------------------------- # -*- coding: utf-8 -*- # Copyright 2017 Cognizant Technology Solutions # # 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 ...
Python
0
bd548cc863754533b8a5d6cff21455c91061fbce
Changing the action keys to lowercase
rofi/shutdown.py
rofi/shutdown.py
#!/usr/bin/env python3 import glob import logging import os import sys from rofi import Rofi CURRENT_SCRIPT_NAME = os.path.splitext(os.path.basename(__file__))[0] LOG_FORMAT = ('[%(asctime)s PID %(process)s ' '%(filename)s:%(lineno)s - %(funcName)s()] ' '%(levelname)s -> \n' ...
#!/usr/bin/env python3 import glob import logging import os import sys from rofi import Rofi CURRENT_SCRIPT_NAME = os.path.splitext(os.path.basename(__file__))[0] LOG_FORMAT = ('[%(asctime)s PID %(process)s ' '%(filename)s:%(lineno)s - %(funcName)s()] ' '%(levelname)s -> \n' ...
Python
0.999994
ea1189790a3a0941c669a981d5a351de57a1b5ce
Use the oc.NWChemJsonReader() class.
docker/nwchem/src/run.py
docker/nwchem/src/run.py
import os import subprocess import jinja2 import json import openchemistry as oc def run_calculation(geometry_file, output_file, params, scratch_dir): # Read in the geometry from the geometry file # This container expects the geometry file to be in .xyz format with open(geometry_file) as f: xyz_st...
import os import subprocess import jinja2 import json import openchemistry as oc def run_calculation(geometry_file, output_file, params, scratch_dir): # Read in the geometry from the geometry file # This container expects the geometry file to be in .xyz format with open(geometry_file) as f: xyz_st...
Python
0
2a984234d6bef4667af9549459e1fd85fb213626
Bump version to v1.14.20
client/__init__.py
client/__init__.py
__version__ = 'v1.14.20' FILE_NAME = 'ok' import os import sys sys.path.insert(0, '') # Add directory in which the ok.zip is stored to sys.path. sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
__version__ = 'v1.14.19' FILE_NAME = 'ok' import os import sys sys.path.insert(0, '') # Add directory in which the ok.zip is stored to sys.path. sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
Python
0
6832112d69d8751229ca25f8269abcc6d82a3732
fix config filename
kuyruk/__main__.py
kuyruk/__main__.py
from __future__ import absolute_import import os import ast import logging import argparse from kuyruk import __version__, requeue, manager from kuyruk.worker import Worker from kuyruk.master import Master from kuyruk.config import Config logger = logging.getLogger(__name__) def worker(config, args): w = Worker(...
from __future__ import absolute_import import os import ast import logging import argparse from kuyruk import __version__, requeue, manager from kuyruk.worker import Worker from kuyruk.master import Master from kuyruk.config import Config logger = logging.getLogger(__name__) def worker(config, args): w = Worker(...
Python
0.000031
c13f78f358b3befe71539804abc80df9179b6bfa
bump to v1.7.6
client/__init__.py
client/__init__.py
__version__ = 'v1.7.6' FILE_NAME = 'ok' import os import sys sys.path.insert(0, '') # Add directory in which the ok.zip is stored to sys.path. sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
__version__ = 'v1.7.5' FILE_NAME = 'ok' import os import sys sys.path.insert(0, '') # Add directory in which the ok.zip is stored to sys.path. sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
Python
0.000001
bfce2efa821d83b83468858a068c9de7d96acab1
Make connect to heat match python-heatclient shell method
dib.py
dib.py
#!/usr/bin/env python import json import yaml import os from keystoneclient.v2_0 import client as ks_client import heatclient from heatclient import client as heat_client import uuid def parse(template): return yaml.safe_load(template) keystone = ks_client.Client(username=os.environ['OS_USERNAME'], password=os.e...
#!/usr/bin/env python import json import yaml import os import heatclient.client import keystoneclient.v2_0.client import uuid def parse(template): return yaml.safe_load(template) def get_identity_client(username, password, tenant_name): auth_url = os.environ['OS_AUTH_URL'] return keystoneclient.v2_0.cl...
Python
0.000002
d9ee5286e3134a71a1e2f19f24c01fe4c30bdf6a
add domains
misp_modules/modules/expansion/onyphe.py
misp_modules/modules/expansion/onyphe.py
import json # -*- coding: utf-8 -*- import json try: from onyphe import Onyphe except ImportError: print("pyonyphe module not installed.") misperrors = {'error': 'Error'} mispattributes = {'input': ['ip-src', 'ip-dst', 'hostname', 'domains'], 'output': ['hostname', 'domain', 'ip-src', 'ip-dst','url']} # poss...
import json # -*- coding: utf-8 -*- import json try: from onyphe import Onyphe except ImportError: print("pyonyphe module not installed.") misperrors = {'error': 'Error'} mispattributes = {'input': ['ip-src', 'ip-dst', 'hostname', 'domains'], 'output': ['hostname', 'domain', 'ip-src', 'ip-dst','url']} # poss...
Python
0.000001
76b087986aa90967918ec52b459a857c11743203
Update patterns
module/plugins/hoster/ZippyshareCom.py
module/plugins/hoster/ZippyshareCom.py
# -*- coding: utf-8 -*- import re from os import path from urllib import unquote from urlparse import urljoin from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" __version__ = "0.60" _...
# -*- coding: utf-8 -*- import re from os import path from urllib import unquote from urlparse import urljoin from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" __version__ = "0.60" _...
Python
0
3ce75ad5f3e0178394e9d496327c2e11bb74c6ac
save schedule to SQL
app/data.py
app/data.py
from .models import Settings from app import db def get_query(db_model): try: q = db.session.query(db_model).order_by(db_model.index.desc()).first() except AttributeError: try: q = db.session.query(db_model).order_by(db_model.index.desc()).first() except AttributeError: ...
from .models import Settings from app import db def get_query(db_model): try: q = db.session.query(db_model).order_by(db_model.index.desc()).first() except AttributeError: try: q = db.session.query(db_model).order_by(db_model.index.desc()).first() except AttributeError: ...
Python
0
e77bc141c8e2564509f093059e61cfb98be79e56
Add module docstring to __init__
lamana/__init__.py
lamana/__init__.py
# ----------------------------------------------------------------------------- '''The main init file that stores the package version number.''' # __version__ is used by find_version() in setup.py import lamana.input_ import lamana.distributions import lamana.constructs import lamana.theories import lamana.output_ #fr...
# ----------------------------------------------------------------------------- import lamana.input_ import lamana.distributions import lamana.constructs import lamana.theories import lamana.output_ #from lamana.models import * #import lamana.ratios #import lamana.predictions #import lamana.gamuts __title__ = 'lamana...
Python
0.000001
2cd901a3975691eb06f695f5e352c0bc46c923a0
Bump version to 0.4.11
lamana/__init__.py
lamana/__init__.py
# ----------------------------------------------------------------------------- import lamana.input_ import lamana.distributions import lamana.constructs import lamana.theories import lamana.output_ #from lamana.models import * #import lamana.ratios #import lamana.predictions #import lamana.gamuts __title__ = 'lamana...
# ----------------------------------------------------------------------------- import lamana.input_ import lamana.distributions import lamana.constructs import lamana.theories import lamana.output_ #from lamana.models import * #import lamana.ratios #import lamana.predictions #import lamana.gamuts __title__ = 'lamana...
Python
0
edaaaf23bc13996bf571946128f206013045efbb
Resolve comilation issue for darwin-framework-tool on M1 (#21761)
scripts/build/build_darwin_framework.py
scripts/build/build_darwin_framework.py
#!/usr/bin/env -S python3 -B # Copyright (c) 2022 Project Matter Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
#!/usr/bin/env -S python3 -B # Copyright (c) 2022 Project Matter Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
Python
0
35d39957d1a4fd847509384dab429092a39715e3
Load pre-trained GloVe
distance.py
distance.py
# coding: utf-8 # Author: Hussein AL-NATSHEH <hussein.al-natsheh@ish-lyon.cnrs.fr> # License: BSD 3 clause # 2016 import pandas as pd import argparse import numpy as np def load_data(dataset, verbose=0): if dataset == 'sts': #Load STS data (combined 2012-2014 and cleaned) data = pd.read_csv('data/sts_gs_all.csv...
# coding: utf-8 # Author: Hussein AL-NATSHEH <hussein.al-natsheh@ish-lyon.cnrs.fr> # License: BSD 3 clause # 2016 import pandas as pd import argparse import numpy as np def load_data(dataset, verbose=0): if dataset == "sts": #Load STS data (combined 2012-2014 and cleaned) data = pd.read_csv('data/sts_gs_all.csv...
Python
0
d15432dda3a06c08ad36901a72c6301f958b72e0
Update OneFichierCom.py
module/plugins/hoster/OneFichierCom.py
module/plugins/hoster/OneFichierCom.py
# -*- coding: utf-8 -*- import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" __version__ = "0.87" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)...
# -*- coding: utf-8 -*- import re from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" __version__ = "0.86" __status__ = "testing" __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)...
Python
0
d258bbe78be9cdf8ca2251add74a903f054b032a
add login/logout views. closes #7
app/urls.py
app/urls.py
"""testP URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-base...
"""testP URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-base...
Python
0.000219
c136d416c2cb53449e1c175412eeaa46a2f78db1
Fix syntax error in email service
zou/app/utils/emails.py
zou/app/utils/emails.py
from flask_mail import Message from zou.app import mail, app def send_email(subject, body, recipient_email, html=None): """ Send an email with given subject and body to given recipient. """ if html is None: html = body with app.app_context(): message = Message( sender=...
from flask_mail import Message from zou.app import mail, app def send_email(subject, body, recipient_email, html=None): """ Send an email with given subject and body to given recipient. """ if html is None: html = body with app.app_context(): message = Message( sender=...
Python
0.001263
d3adfcbcf281f00aa454d4d8e45f6d5502495bde
Add get_absolute_url to UserSerializer
api/users/serializers.py
api/users/serializers.py
from rest_framework import serializers as ser from api.base.serializers import JSONAPISerializer, LinksField, Link class UserSerializer(JSONAPISerializer): id = ser.CharField(read_only=True, source='_id') fullname = ser.CharField() date_registered = ser.DateTimeField(read_only=True) links = LinksFie...
from rest_framework import serializers as ser from api.base.serializers import JSONAPISerializer, LinksField, Link class UserSerializer(JSONAPISerializer): id = ser.CharField(read_only=True, source='_id') fullname = ser.CharField() date_registered = ser.DateTimeField(read_only=True) links = LinksFie...
Python
0
4b3f79ae5e30de867941d363d1f186d3c2494b4b
Remove obsolete token code.
api_sample/http_utils.py
api_sample/http_utils.py
# Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
# Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
Python
0.000011
45689b8b2d91310e4002a63253009fddae947bb3
Bump copyright year in sphinx docs
doc/conf.py
doc/conf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import pycommand extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = 'pycommand' copyright = '2013-2015, Benjamin Althues' version = pycommand.__version__ release = pycommand.__ve...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys from pycommand import __version__ as pycommand_version extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'index' project = 'pycommand' copyright = '2013, Benjamin Althues' ve...
Python
0
cae93790520765d85ed990e44b8733b44ca5eace
Modify the OpsCenter startup script to generate an SSH keypair and push the public key to the GCP project metadata using gCloud
datastax.py
datastax.py
import yaml def GenerateFirewall(context): name = 'opscenterfirewall-' + context.env['name'] firewalls = [ { 'name': name, 'type': 'compute.v1.firewall', 'properties': { 'sourceRanges': [ '0.0.0.0/0' ], ...
import yaml def GenerateFirewall(context): name = 'opscenterfirewall-' + context.env['name'] firewalls = [ { 'name': name, 'type': 'compute.v1.firewall', 'properties': { 'sourceRanges': [ '0.0.0.0/0' ], ...
Python
0
858132382c57d181d5865162c8ff87db656d4de9
split up functions better
artsy-dl.py
artsy-dl.py
#!/usr/bin/env python -tt ########################################################### ## ## ## artsy-dl.py ## ## ## ## Author: Tony Fischetti ...
#!/usr/bin/env python -tt ########################################################### ## ## ## artsy-dl.py ## ## ## ## Author: Tony Fischetti ...
Python
0.000078
7502dca0df5c7c3ea247b3bf63b2d60e7cad74ce
Remove redundant text search dictionary
anthology/database.py
anthology/database.py
"""MongoDB backend""" from pymongo import MongoClient, ASCENDING from bson import ObjectId class DatabaseError(Exception): """Raised for unrecoverable database errors""" pass def connection(): """Return MongoClient connection object. pymongo.MongoClient has it's own instance caching/connection poo...
"""MongoDB backend""" from pymongo import MongoClient, ASCENDING from bson import ObjectId class DatabaseError(Exception): """Raised for unrecoverable database errors""" pass def connection(): """Return MongoClient connection object. pymongo.MongoClient has it's own instance caching/connection poo...
Python
0.999238
69912ea520a35f8c35a62d7a3c6efe1a9367f03f
Fix typo
ckanext/mapactiontheme/tests/test_admin_controller.py
ckanext/mapactiontheme/tests/test_admin_controller.py
from ckan.plugins.toolkit import config import ckan.tests.helpers as helpers import ckan.tests.factories as factories from ckan.plugins import load class TestCustomAdminController(helpers.FunctionalTestBase): def setup(self): super(TestCustomAdminController, self).setup() self.admin = factories.Use...
from ckan.plugins.toolkit import config import ckan.tests.helpers as helpers import ckan.tests.factories as factories from ckan.plugins import load class TestCustomAdminController(helpers.FunctionalTestBase): def setup(self): super(TestCustomAdminController, self).setup() self.admin = factories.Use...
Python
0.999999
3ae496284e86815304736196bd66052fbfc9b81d
Support 'I Want you'
YoClient.py
YoClient.py
#!/usr/bin/env python import httplib import urllib class YoClient: Host = 'api.justyo.co' Port = 80 NoticeAPI = '/yo/' BroadcastAPI = '/yoall/' Headers = {'Cache-Control': 'no-cache', 'Content-Type': 'application/x-www-form-urlencoded'} #Proxy ...
#!/usr/bin/env python import httplib import urllib class YoClient: Host = 'api.justyo.co' Port = 80 NoticeAPI = '/yo/' BroadcastAPI = '/yoall/' Headers = {'Cache-Control': 'no-cache', 'Content-Type': 'application/x-www-form-urlencoded'} #Proxy ...
Python
0
9ccbc97652db1b7e6c7888b783722eee9f438104
make cbpro visible to tests
__init__.py
__init__.py
# for tests from cbpro.authenticated_client import AuthenticatedClient from cbpro.public_client import PublicClient
Python
0
020015cccceb3c2391c4764ee2ec29dfc5c461c6
Update plugin's register functions to return the object instance instead of performing the registration themselves
__init__.py
__init__.py
from . import LayerView def getMetaData(): return { "name": "LayerView", "type": "View" } def register(app): return LayerView.LayerView()
from . import LayerView def getMetaData(): return { "name": "LayerView", "type": "View" } def register(app): app.getController().addView("LayerView", LayerView.LayerView())
Python
0
90656a3b4eedac9ae87dbdb5485994c58c2f78d9
add pydq
__init__.py
__init__.py
# -*- coding: utf-8 -*- import six __title__ = 'pydq' __version__ = '0.0.1' __author__ = 'Pyiner' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2015 Pyiner' __all__ = ['DataQuery'] class DataQuery(object): def __init__(self, data): self.data = data @staticmethod def item_exist(item, **k...
# -*- coding: utf-8 -*- import six __title__ = 'requests' __version__ = '0.0.1' __author__ = 'Pyiner' __license__ = 'Apache 2.0' __copyright__ = 'Copyright 2015 Pyiner' __all__ = ['DataQuery'] class DataQuery(object): def __init__(self, data): self.data = data @staticmethod def item_exist(item,...
Python
0.000268
b186ed26e3250d8b02c94f5bb3b394c35986bcf6
Remove an import which snuck in but does not belong.
__init__.py
__init__.py
""" Spyral, an awesome library for making games. """ __version__ = '0.1.1' __license__ = 'MIT' __author__ = 'Robert Deaton' import compat import memoize import point import camera import sprite import scene import _lib import event import animator import animation import pygame import image import color import rect ...
""" Spyral, an awesome library for making games. """ __version__ = '0.1.1' __license__ = 'MIT' __author__ = 'Robert Deaton' import compat import memoize import point import camera import sprite import scene import _lib import event import animator import animation import pygame import image import color import rect ...
Python
0
c4a4c9333c874b38c121ce1181c12e7ed5aacc88
Add __init__.py
__init__.py
__init__.py
from shellgraphics import *
from ShellGraphics import *
Python
0.006636
7bee2061fc0609205bb81dc781efbcd833ca74bb
Add save() interface on Workbook
Workbook.py
Workbook.py
import Worksheet from Writer import Writer class Workbook(object): def __init__(self, encoding='utf-8'): self._worksheets = [] self._encoding = encoding self._writer = Writer(self) def add_sheet(self, worksheet): self._worksheets.append(worksheet) def new_sheet(self, sheet_name): worksheet = Wor...
import Worksheet class Workbook(object): def __init__(self, encoding='utf-8'): self._worksheets = [] self._encoding = encoding def add_sheet(self, worksheet): self._worksheets.append(worksheet) def new_sheet(self, sheet_name): worksheet = Worksheet.Worksheet(sheet_name, self) self._worksheets.append(w...
Python
0.000001