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
026ba5fa78cb9916bffc23cf7dda1d1deb81b24c
Bump version 1.0.3
story/__init__.py
story/__init__.py
""" Story - PySchool """ __author__ = 'PySchool' __version__ = '1.0.3' __licence__ = 'MIT'
""" Story - PySchool """ __author__ = 'PySchool' __version__ = '1.0.2' __licence__ = 'MIT'
Python
0
8d0e3ae1f80e8b19292b18a20a338cbfd00364c7
Bump to version number 1.6.0
stream/release.py
stream/release.py
# coding=utf-8 """ stream.release ~~~~~~~~~~~~~~ Include release information of the package. :copyright: (c) 2016 by Ali Ghaffaari. :license: MIT, see LICENSE for more details. """ # CONSTANTS ################################################################### # Development statuses: DS_PLANNING...
# coding=utf-8 """ stream.release ~~~~~~~~~~~~~~ Include release information of the package. :copyright: (c) 2016 by Ali Ghaffaari. :license: MIT, see LICENSE for more details. """ # CONSTANTS ################################################################### # Development statuses: DS_PLANNING...
Python
0.000001
c8069fff1941d0739bca8716a5e26f5c02ccffe3
Add South field tuple.
django_enumfield/fields.py
django_enumfield/fields.py
from django.db import models class EnumField(models.Field): __metaclass__ = models.SubfieldBase def __init__(self, enumeration, *args, **kwargs): self.enumeration = enumeration kwargs.setdefault('choices', enumeration.get_choices()) super(EnumField, self).__init__(*args, **kwargs) ...
from django.db import models class EnumField(models.Field): __metaclass__ = models.SubfieldBase def __init__(self, enumeration, *args, **kwargs): self.enumeration = enumeration kwargs.setdefault('choices', enumeration.get_choices()) super(EnumField, self).__init__(*args, **kwargs) ...
Python
0.000001
2c73fee5b0a3a527d0ee3c51291c7b4c01c9f688
Revert "Создание скрипта изменения группы"
fixture/group.py
fixture/group.py
class GroupHelper: def __init__(self, app): self.app = app def open_groups_page(self): wd = self.app.wd wd.find_element_by_link_text("groups").click() def create(self, group): wd = self.app.wd self.open_groups_page() # создание новой группы wd.find_...
class GroupHelper: def __init__(self, app): self.app = app def open_groups_page(self): wd = self.app.wd wd.find_element_by_link_text("groups").click() def create(self, group): wd = self.app.wd self.open_groups_page() # создание новой группы wd.find_...
Python
0
4e8177bca4335c34950adb54c0bca4bca59ef0c0
fix error: has no attribute __subclass__
app/auth/oauth.py
app/auth/oauth.py
from rauth import OAuth2Service from flask import current_app, url_for, redirect, request, session class OAuthSignIn(object): providers = None def __init__(self, provider_name): self.provider_name = provider_name credentials = current_app.config['OAUTH_CREDENTIALS'][provider_name] self.consumer_id = credenti...
from rauth import OAuth2Service from flask import current_app, url_for, redirect, request, session class OAuthSignIn(object): providers = None def __init__(self, provider_name): self.provider_name = provider_name credentials = current_app.config['OAUTH_CREDENTIALS'][provider_name] self.consumer_id = credenti...
Python
0.000033
65d91fe8857ab63827f1b85935d8a6647bd57543
test refactoring
plenum/test/view_change/test_client_req_during_view_change.py
plenum/test/view_change/test_client_req_during_view_change.py
import pytest from plenum.common.constants import NODE, TXN_TYPE, GET_TXN from plenum.common.exceptions import RequestNackedException from plenum.test.helper import sdk_send_random_and_check, \ sdk_send_random_requests, sdk_get_and_check_replies, sdk_gen_request, \ checkDiscardMsg from plenum.test.pool_transac...
import functools import pytest from plenum.common.constants import NODE, TXN_TYPE, GET_TXN from plenum.common.exceptions import RequestNackedException from plenum.test.helper import sdk_send_random_and_check, \ sdk_send_random_requests, sdk_get_and_check_replies, sdk_gen_request, \ checkDiscardMsg from plenum...
Python
0
e8056e4e2c5ef55b46a99afaf7664a734b401443
add pending as a "sent" state
tests/postman.py
tests/postman.py
import os from notifications_python_client.errors import HTTPError from config import config from tests.test_utils import create_temp_csv, RetryException def send_notification_via_api(client, template_id, to, message_type): jenkins_build_id = os.getenv('BUILD_ID', 'No build id') personalisation = {'build_id...
import os from notifications_python_client.errors import HTTPError from config import config from tests.test_utils import create_temp_csv, RetryException def send_notification_via_api(client, template_id, to, message_type): jenkins_build_id = os.getenv('BUILD_ID', 'No build id') personalisation = {'build_id...
Python
0.000001
b951c30a856611ba37bba4cc0e6ef294b55650c9
allow code to be defined as an array of string
web/Language.py
web/Language.py
import json import os class Language: def __init__(self, key): """ Initialize the Language object, which will contain concepts for a given structure :param key: ID of the language in the meta_info.json file """ # Add an empty string to convert SafeString to str sel...
import json import os class Language: def __init__(self, key): """ Initialize the Language object, which will contain concepts for a given structure :param key: ID of the language in the meta_info.json file """ # Add an empty string to convert SafeString to str sel...
Python
0.000028
0781b47512cbab5fc1a090ff68b5f9d434a864af
Update examples/API_v2/lookup_users_using_user_ids.py
examples/API_v2/lookup_users_using_user_ids.py
examples/API_v2/lookup_users_using_user_ids.py
import tweepy # Replace bearer token value with your own bearer_token = "" # Initializing the Tweepy client client = tweepy.Client(bearer_token) # Replace User IDs ids = [2244994945, 6253282] # By default the user ID, name and username are returned. user_fields can be # used to specify the additional user data th...
import tweepy # Replace bearer token value with your own bearer_token = "" # Initializing the Tweepy client client = tweepy.Client(bearer_token) # Replace User IDs ids = [2244994945, 6253282] # By default the user ID, name and username are returned. user_fields can be # used to specify the additional user data th...
Python
0
54c81494cbbe9a20db50596e68c57e1caa624043
Add a User post_save hook for creating user profiles
src-django/authentication/signals/user_post_save.py
src-django/authentication/signals/user_post_save.py
from authentication.models import UserProfile from django.contrib.auth.models import User, Group from django.dispatch import receiver from django.db.models.signals import post_save from django.conf import settings from rest_framework.authtoken.models import Token @receiver(post_save, sender=User) def on_user_post_sav...
from django.contrib.auth.models import User, Group from django.dispatch import receiver from django.db.models.signals import post_save from django.conf import settings from rest_framework.authtoken.models import Token @receiver(post_save, sender=User) def on_user_post_save(sender, instance=None, created=False, **kwar...
Python
0.000001
9b678e184a568baea857ca68fcacb5070db6792d
update modulation.py
examples/modulation.py
examples/modulation.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import initExample from lase.core import KClient # Driver to use from lase.drivers import Oscillo # Modules to import import numpy as np import matplotlib.pyplot as plt import time # Connect to Lase host = '192.168.1.4' # Lase IP address client = KClient(host) driver...
#!/usr/bin/env python # -*- coding: utf-8 -*- import initExample from lase.core import KClient # Driver to use from lase.drivers import Oscillo # Modules to import import numpy as np import matplotlib.pyplot as plt import time # Connect to Lase host = '192.168.1.4' # Lase IP address client = KClient(host) drive...
Python
0.000001
1014c809638157da85794223c4990b5ae20512fa
Add crawled_at field back
hackernews_scrapy/items.py
hackernews_scrapy/items.py
# -*- coding: utf-8 -*- import scrapy class HackernewsScrapyItem(scrapy.Item): title = scrapy.Field() url = scrapy.Field() crawled_at = scrapy.Field(serializer=str)
# -*- coding: utf-8 -*- import scrapy class HackernewsScrapyItem(scrapy.Item): title = scrapy.Field() url = scrapy.Field()
Python
0
d8cb4384f32f4d0e20f3212a36cc01915260f7a8
Support custom actions in search router
tests/routers.py
tests/routers.py
"""Search router.""" from rest_framework.routers import DefaultRouter, DynamicRoute, Route class SearchRouter(DefaultRouter): """Custom router for search endpoints. Search endpoints don't follow REST principles and thus don't need routes that default router provides. """ routes = [ Route...
"""Search router.""" from rest_framework.routers import DefaultRouter, Route class SearchRouter(DefaultRouter): """Custom router for search endpoints. Search endpoints don't follow REST principles and thus don't need routes that default router provides. """ routes = [ Route( ...
Python
0
43922bb7cf5015cbf3538195d3d4f93ff8c9ec18
Bump version
tomb_cli/__about__.py
tomb_cli/__about__.py
__title__ = 'tomb_cli' __summary__ = 'Top level CLI command for tomb' __uri__ = 'http://github.com/tomborine/tomb_cli' __version__ = '0.0.2' __author__ = 'John Anderson' __email__ = 'sontek@gmail.com' __license__ = 'MIT' __copyright__ = '2015 John Anderson (sontek)'
__title__ = 'tomb_cli' __summary__ = 'Top level CLI command for tomb' __uri__ = 'http://github.com/tomborine/tomb_cli' __version__ = '0.0.1' __author__ = 'John Anderson' __email__ = 'sontek@gmail.com' __license__ = 'MIT' __copyright__ = '2015 John Anderson (sontek)'
Python
0
18f373ffc1e49b33708ae2303b61ccf76ffa686e
Use pylab.load to read in data.
examples/ortho_demo.py
examples/ortho_demo.py
from matplotlib.toolkits.basemap import Basemap from pylab import * # read in topo data from pickle (on a regular lat/lon grid) etopo = array(load('etopo20data.gz'),'f') lons = array(load('etopo20lons.gz'),'f') lats = array(load('etopo20lats.gz'),'f') # create Basemap instance for Orthographic (satellite view) projecti...
from matplotlib import rcParams, use rcParams['numerix'] = 'Numeric' # make sure Numeric is used (to read pickle) from matplotlib.toolkits.basemap import Basemap import cPickle from pylab import * # read in topo data from pickle (on a regular lat/lon grid) topodict = cPickle.load(open('etopo20.pickle','rb')) etopo = t...
Python
0.000094
35d0ce026741c65cdb834f5828ef4000f6d06150
fix for runtest path handling from Marek
tests/runtest.py
tests/runtest.py
#! /usr/bin/env python """ Test runner for main pygr tests. Collects all files ending in _test.py and executes them with unittest.TextTestRunner. """ import os, sys, re, unittest, shutil, re, shutil from testlib import testutil, testoptions from pygr import logger def all_tests(): "Returns all file names that en...
#! /usr/bin/env python """ Test runner for main pygr tests. Collects all files ending in _test.py and executes them with unittest.TextTestRunner. """ import os, sys, re, unittest, shutil, re, shutil from testlib import testutil, testoptions from pygr import logger def all_tests(): "Returns all file names that en...
Python
0
6d4c5618db43725c0af2b37661911a960bfa0aa2
Allow an already deleted watch to not fail the stack.delete().
heat/engine/cloud_watch.py
heat/engine/cloud_watch.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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 applicab...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # 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 applicab...
Python
0
2ab2927b2ee4f821fd75050da19a7f1f81aaeca8
FIX divide mnist features by 255 in mlp example (#11961)
examples/neural_networks/plot_mnist_filters.py
examples/neural_networks/plot_mnist_filters.py
""" ===================================== Visualization of MLP weights on MNIST ===================================== Sometimes looking at the learned coefficients of a neural network can provide insight into the learning behavior. For example if weights look unstructured, maybe some were not used at all, or if very l...
""" ===================================== Visualization of MLP weights on MNIST ===================================== Sometimes looking at the learned coefficients of a neural network can provide insight into the learning behavior. For example if weights look unstructured, maybe some were not used at all, or if very l...
Python
0
45c67e0b9bc168549fdd1eb2cde3599aae921567
Update base.py
webhook/base.py
webhook/base.py
""" Base webhook implementation """ import json from django.http import HttpResponse from django.views.generic import View from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt class WebhookBase(View): """ Simple Webhook base class to handle the most stand...
""" Base webhook implementation """ import json from django.http import HttpResponse from django.views.generic import View from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_exempt class WebhookBase(View): """ Simple Webhook base class to handle the most stand...
Python
0.000001
1abd5833ef8936185f4c8870d300b3793da4ce00
Fix regex for parsing Solr dates. The solr documentation suggests it will always use 4-digit years. In practice, though, it returns < 4 digits for years before 1000 AD. This fixes the date-parsing regex to account for the discrepancy.
sunburnt/dates.py
sunburnt/dates.py
from __future__ import absolute_import import datetime import re import warnings try: import mx.DateTime except ImportError: warnings.warn( "mx.DateTime not found, retricted to Python datetime objects", ImportWarning) mx = None year = r'[+/-]?\d+' tzd = r'Z|((?P<tzd_sign>[-+])(?P<tzd_hou...
from __future__ import absolute_import import datetime import re import warnings try: import mx.DateTime except ImportError: warnings.warn( "mx.DateTime not found, retricted to Python datetime objects", ImportWarning) mx = None year = r'[+/-]?\d*\d\d\d\d' tzd = r'Z|((?P<tzd_sign>[-+])(?P...
Python
0
a751e7f51412581e14cc822f1e443ed97746055a
Update structures example
examples/structures.py
examples/structures.py
from numba import struct, jit, double import numpy as np record_type = struct([('x', double), ('y', double)]) record_dtype = record_type.get_dtype() a = np.array([(1.0, 2.0), (3.0, 4.0)], dtype=record_dtype) @jit(argtypes=[record_type[:]]) def hypot(data): # return types of numpy functions are inferred result...
from numba import struct, jit, double import numpy as np record_type = struct([('x', double), ('y', double)]) record_dtype = record_type.get_dtype() a = np.array([(1.0, 2.0), (3.0, 4.0)], dtype=record_dtype) @jit(argtypes=[record_type[:]]) def hypot(data): # return types of numpy functions are inferred result...
Python
0
f6045517b27bf6f878ab2906aa6b793cfd640786
upgrade anymail
toucan_conf/settings/prod/__init__.py
toucan_conf/settings/prod/__init__.py
import os from .. import * try: from ..secrets import ALLOWED_HOSTS except ImportError: raise ImportError('Please set ALLOWED_HOSTS in the secrets file when using production config.') try: from ..secrets import ANYMAIL except ImportError: raise ImportError('Please set ANYMAIL settings in the secrets ...
import os from .. import * try: from ..secrets import ALLOWED_HOSTS except ImportError: raise ImportError('Please set ALLOWED_HOSTS in the secrets file when using production config.') try: from ..secrets import ANYMAIL except ImportError: raise ImportError('Please set ANYMAIL settings in the secrets ...
Python
0
594c68fb47ee37ff13b02637462d2bd79beb6f43
update config tests for schema v3
assigner/tests/config_test.py
assigner/tests/config_test.py
from assigner.tests.utils import AssignerTestCase from assigner.config.versions import ( validate, get_version, upgrade, ValidationError, VersionError, ) from assigner.config.upgrades import UPGRADES from assigner.config.schemas import SCHEMAS CONFIGS = [ { # Version 0 "token": "xxx ...
from assigner.tests.utils import AssignerTestCase from assigner.config.versions import validate, get_version, upgrade, ValidationError, VersionError from assigner.config.upgrades import UPGRADES from assigner.config.schemas import SCHEMAS CONFIGS = [ { # Version 0 "token": "xxx gitlab token xxx", ...
Python
0
193d911536799751c9ec29571cb8091bcd187087
fix uraseuranta py
pdi_integrations/arvo/python_scripts/get_arvo_uraseuranta.py
pdi_integrations/arvo/python_scripts/get_arvo_uraseuranta.py
#import json import requests #import os from pandas.io.json import json_normalize #import datetime import base64 import os try: api_key = os.environ['AUTH_API_KEY'] except KeyError: print("API-key is missing") try: api_user = os.environ['AUTH_API_USER'] except KeyError: print("API-user is missing") re...
#import json import requests #import os from pandas.io.json import json_normalize #import datetime import os try: api_key = os.environ['AUTH_API_KEY'] except KeyError: print("API-key missing") result = [] good_result=[] filtered_result=[] urls = [] url = 'https://arvo.csc.fi/api/vipunen/uraseuranta' reqhe...
Python
0.000001
a0f7ca32edd5c924366738e0e6d6b8ab4e483cc8
Undo last commit.
foliant/utils.py
foliant/utils.py
'''Various utilities used here and there in the Foliant code.''' from contextlib import contextmanager from pkgutil import iter_modules from importlib import import_module from shutil import rmtree from pathlib import Path from logging import Logger from typing import Dict, Tuple, Type, Set from halo import Halo de...
'''Various utilities used here and there in the Foliant code.''' from contextlib import contextmanager from pkgutil import iter_modules from importlib import import_module from shutil import rmtree from pathlib import Path from logging import Logger from typing import Dict, Tuple, Type, Set from halo import Halo de...
Python
0
77859dbc019a19222ada36ebccc849ba77649a86
add to unicode functions to all forum models
forums/models.py
forums/models.py
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User class Category(models.Model): name = models.CharField(_("Name"), max_length=255, unique=True) position = models.IntegerField(_("Position"), default=0) class Meta: orde...
from django.db import models from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User class Category(models.Model): name = models.CharField(_("Name"), max_length=255, unique=True) position = models.IntegerField(_("Position"), default=0) class Meta: orde...
Python
0
f22ad01d72b8ab2a12bf68a23b79c9a1b2e6f237
Standardizing all to uppercase for compare
tms/tms_utils.py
tms/tms_utils.py
# Local modules from common import telegram_utils from tms import tms_data class Verse(): def __init__(self, ref, title, pack, pos): self.reference = ref self.title = title self.pack = pack self.position = pos def get_reference(self): return self.reference de...
# Local modules from common import telegram_utils from tms import tms_data class Verse(): def __init__(self, ref, title, pack, pos): self.reference = ref self.title = title self.pack = pack self.position = pos def get_reference(self): return self.reference de...
Python
0.99991
694df5ba69e4e7123009605e59c2b5417a3b52c5
Remove print statement about number of bins
tools/fitsevt.py
tools/fitsevt.py
#! /usr/bin/python3 import sys import os import math from astropy.io import fits inputFolder = sys.argv[1] outputFolder = sys.argv[2] eLo = int(sys.argv[3]) eHi = int(sys.argv[4]) binSize = int(sys.argv[5]) fnames = os.listdir(inputFolder) for fname in fnames: print(fname) hdulist = fits.open(inputFolder+"/"+fna...
#! /usr/bin/python3 import sys import os import math from astropy.io import fits inputFolder = sys.argv[1] outputFolder = sys.argv[2] eLo = int(sys.argv[3]) eHi = int(sys.argv[4]) binSize = int(sys.argv[5]) fnames = os.listdir(inputFolder) for fname in fnames: print(fname) hdulist = fits.open(inputFolder+"/"+fna...
Python
0.003864
22a4644bd510a8b786d181c01c20f3dc522dac8d
Update corehq/apps/auditcare/migrations/0004_add_couch_id.py
corehq/apps/auditcare/migrations/0004_add_couch_id.py
corehq/apps/auditcare/migrations/0004_add_couch_id.py
# Generated by Django 2.2.20 on 2021-05-21 17:32 from django.db import migrations, models ACCESS_INDEX = "audit_access_couch_10d1b_idx" ACCESS_TABLE = "auditcare_accessaudit" NAVIGATION_EVENT_INDEX = "audit_nav_couch_875bc_idx" NAVIGATION_EVENT_TABLE = "auditcare_navigationeventaudit" def _create_index_sql(table_n...
# Generated by Django 2.2.20 on 2021-05-21 17:32 from django.db import migrations, models ACCESS_INDEX = "audit_access_couch_10d1b_idx" ACCESS_TABLE = "auditcare_accessaudit" NAVIGATION_EVENT_INDEX = "audit_nav_couch_875bc_idx" NAVIGATION_EVENT_TABLE = "auditcare_navigationeventaudit" def _create_index_sql(table_n...
Python
0
0c816aaa82ee9fee1ee244c6b96c1a2718ec836e
use default python command from the environment
testrunner.py
testrunner.py
#!/usr/bin/env python import os import sys import unittest USAGE = """%prog SDK_PATH TEST_PATH Run unit tests for App Engine apps.""" SDK_PATH_manual = '/usr/local/google_appengine' TEST_PATH_manual = '../unittests' def main(sdk_path, test_path): os.chdir('backend') sys.path.extend([sdk_path, '.', '../lib', '../...
#!/usr/bin/python import os import sys import unittest USAGE = """%prog SDK_PATH TEST_PATH Run unit tests for App Engine apps.""" SDK_PATH_manual = '/usr/local/google_appengine' TEST_PATH_manual = '../unittests' def main(sdk_path, test_path): os.chdir('backend') sys.path.extend([sdk_path, '.', '../lib', '../test...
Python
0.000001
ec2aaf86f2002b060f6e5b4d040961a37f89d06a
Update rearrange-string-k-distance-apart.py
Python/rearrange-string-k-distance-apart.py
Python/rearrange-string-k-distance-apart.py
# Time: O(n) # Space: O(n) class Solution(object): def rearrangeString(self, str, k): """ :type str: str :type k: int :rtype: str """ cnts = [0] * 26; for c in str: cnts[ord(c) - ord('a')] += 1 sorted_cnts = [] for i in xrange(26...
# Time: O(nlogc), c is the count of unique characters. # Space: O(c) from collections import defaultdict from heapq import heappush, heappop class Solution(object): def rearrangeString(self, str, k): """ :type str: str :type k: int :rtype: str """ if k == 0: ...
Python
0.000046
392cf8f05b6c23600e7a61a51494771ab08f2274
add exceptions to should_curry
toolz/curried.py
toolz/curried.py
""" Alternate namespece for toolz such that all functions are curried Currying provides implicit partial evaluation of all functions Example: Get usually requires two arguments, an index and a collection >>> from toolz.curried import get >>> get(0, ('a', 'b')) 'a' When we use it in higher order ...
""" Alternate namespece for toolz such that all functions are curried Currying provides implicit partial evaluation of all functions Example: Get usually requires two arguments, an index and a collection >>> from toolz.curried import get >>> get(0, ('a', 'b')) 'a' When we use it in higher order ...
Python
0.000011
778bab1b4f57eb03137c00203d7b5f32c018ca83
fix error
ImagePaste.py
ImagePaste.py
# import sublime import sublime_plugin import os import sys package_file = os.path.normpath(os.path.abspath(__file__)) package_path = os.path.dirname(package_file) lib_path = os.path.join(package_path, "lib") if lib_path not in sys.path: sys.path.append(lib_path) print(sys.path) from PIL import ImageGrab from...
# import sublime import sublime_plugin import os package_file = os.path.normpath(os.path.abspath(__file__)) package_path = os.path.dirname(package_file) lib_path = os.path.join(package_path, "lib") if lib_path not in sys.path: sys.path.append(lib_path) print(sys.path) from PIL import ImageGrab from PIL import...
Python
0.000002
734457ed995a3dfcacf8556ed4e98e7536e63a66
Fix typos
nodeconductor/openstack/management/commands/initsecuritygroups.py
nodeconductor/openstack/management/commands/initsecuritygroups.py
from __future__ import unicode_literals from django.conf import settings from django.core.management.base import BaseCommand, CommandError from nodeconductor.openstack import models, executors, handlers class Command(BaseCommand): help_text = "Add default security groups with given names to all tenants." d...
from __future__ import unicode_literals from django.conf import settings from django.core.management.base import BaseCommand, CommandError from nodeconductor.openstack import models, executors, handlers class Command(BaseCommand): help_text = "Add default security groups with given names to all tenants to tenan...
Python
0.999537
b5b38d5ba76e61bc14e25a45394424436e323c5d
fix reduction2 index dict
utils/speedyvec/vectorizers/subject_verb_agreement.py
utils/speedyvec/vectorizers/subject_verb_agreement.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals """Generate a model capable of detecting subject-verb agreement errors""" from pattern.en import lexeme, tenses from pattern.en import pluralize, singularize from textstat.textstat import textstat from time import sleep import hashlib...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals """Generate a model capable of detecting subject-verb agreement errors""" from pattern.en import lexeme, tenses from pattern.en import pluralize, singularize from textstat.textstat import textstat from time import sleep import hashlib...
Python
0
8463c22898210990e911580d217559efdbbfe5d7
Make disk space test optional
earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/geecheck_tests/user_tests/disk_space_test.py
earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/geecheck_tests/user_tests/disk_space_test.py
#!/usr/bin/env python # # Copyright 2017 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 ...
#!/usr/bin/env python # # Copyright 2017 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 ...
Python
0.000007
88db3ab0e09639d07a0374f9e1877ae3a3669fd4
Use more unittest.TestCase.assertIn instead of *.assertTrue(foo in bar).
utils/swift_build_support/tests/products/test_llvm.py
utils/swift_build_support/tests/products/test_llvm.py
# tests/products/test_llvm.py -----------------------------------*- python -*- # # This source file is part of the LLVM.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the LLVM project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See http://swift.org/LICENSE.txt f...
# tests/products/test_llvm.py -----------------------------------*- python -*- # # This source file is part of the LLVM.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the LLVM project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See http://swift.org/LICENSE.txt f...
Python
0
a602ed873d71253723f07dfa043d959cd247d734
Add latest version of py-typing (#13287)
var/spack/repos/builtin/packages/py-typing/package.py
var/spack/repos/builtin/packages/py-typing/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) from spack import * class PyTyping(PythonPackage): """This is a backport of the standard library typing module to 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) from spack import * class PyTyping(PythonPackage): """This is a backport of the standard library typing module to Py...
Python
0
41a22d7bdf4fb7c9a50a6d51eab67e1459af5456
Update wifi migration script to handle blocklist merges.
ichnaea/scripts/migrate.py
ichnaea/scripts/migrate.py
""" Manual migration script to move networks from old single wifi table to new sharded wifi table structure. """ from collections import defaultdict import sys import time from ichnaea.config import read_config from ichnaea.db import ( configure_db, db_worker_session, ) from ichnaea.models.wifi import ( Wi...
""" Manual migration script to move networks from old single wifi table to new sharded wifi table structure. """ from collections import defaultdict import sys import time from ichnaea.config import read_config from ichnaea.db import ( configure_db, db_worker_session, ) from ichnaea.models.wifi import ( Wi...
Python
0
d4adaaf52a81c0d471657672fee5b5ed2ad4e306
update export agency stats
export_agency_stats.py
export_agency_stats.py
#!/usr/bin/env python2 from time import sleep import requests import unicodecsv from utils import get_api_key token = get_api_key() url = 'https://www.muckrock.com/api_v1/' headers = {'Authorization': 'Token %s' % token, 'content-type': 'application/json'} next_ = url + 'agency' fields = ( "id", "...
#!/usr/bin/env python2 import requests import unicodecsv from utils import get_api_key token = get_api_key() url = 'https://www.muckrock.com/api_v1/' headers = {'Authorization': 'Token %s' % token, 'content-type': 'application/json'} next_ = url + 'agency' fields = ( "id", "name", "slug", ...
Python
0
24f485f256279e2fc86c12cdf383c93850f7f328
Add utility method to check if message sender is admin
IrcMessage.py
IrcMessage.py
import time import Constants class IrcMessage(object): """Parses incoming messages into usable parts like the command trigger""" def __init__(self, messageType, bot, user=None, source=None, rawText=""): self.createdAt = time.time() #MessageType is what kind of message it is. A 'say', 'action' or 'quit', for i...
import time import Constants class IrcMessage(object): """Parses incoming messages into usable parts like the command trigger""" def __init__(self, messageType, bot, user=None, source=None, rawText=""): self.createdAt = time.time() #MessageType is what kind of message it is. A 'say', 'action' or 'quit', for i...
Python
0.000005
6641fd1275c27dfb27787ed25b80af3b6ba14b9f
debug by further reduction
apdflash/scarecrowDreams.py
apdflash/scarecrowDreams.py
print "hellow world"
import sys,os sys.path.insert(0, '../helpers') from mpi4py import MPI
Python
0
14b1f9bde45b66f8752778469f1daae77b49f4e0
Add comment
bluebottle/bb_orders/signals.py
bluebottle/bb_orders/signals.py
from django.db.models.signals import post_save, post_delete from django.dispatch import receiver from django.dispatch.dispatcher import Signal from django_fsm.signals import post_transition from bluebottle.donations.models import Donation from bluebottle.payments.models import OrderPayment from bluebottle.payments.se...
from django.db.models.signals import post_save, post_delete from django.dispatch import receiver from django.dispatch.dispatcher import Signal from django_fsm.signals import post_transition from bluebottle.donations.models import Donation from bluebottle.payments.models import OrderPayment from bluebottle.payments.se...
Python
0
5e371a6aea1c3c0eb126849ef4c5855202b05cfa
Use standard name for output files
packages/cardpay-reward-programs/cardpay_reward_programs/utils.py
packages/cardpay-reward-programs/cardpay_reward_programs/utils.py
import tempfile from pathlib import PosixPath import pyarrow.parquet as pq import yaml from cloudpathlib import AnyPath, CloudPath from cachetools import cached, TTLCache def get_local_file(file_location): if isinstance(file_location, PosixPath): return file_location.as_posix() elif isinstance(file_...
import tempfile from pathlib import PosixPath import pyarrow.parquet as pq import yaml from cloudpathlib import AnyPath, CloudPath from cachetools import cached, TTLCache def get_local_file(file_location): if isinstance(file_location, PosixPath): return file_location.as_posix() elif isinstance(file_...
Python
0.000009
b52c8ab9c87c2de5feec91164d54b4f51ad5b759
Add queryEnvKey
packaging/setup/ovirt_engine_setup/dialog.py
packaging/setup/ovirt_engine_setup/dialog.py
# # ovirt-engine-setup -- ovirt engine setup # Copyright (C) 2013-2015 Red Hat, 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 # # Unl...
# # ovirt-engine-setup -- ovirt engine setup # Copyright (C) 2013-2015 Red Hat, 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 # # Unl...
Python
0.000001
cd0123b2cce81c063f42ff5a9f80665b602bdefd
use the wright product
addons/hr_timesheet_project/wizard/timesheet_hour_encode.py
addons/hr_timesheet_project/wizard/timesheet_hour_encode.py
############################################################################## # # Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved. # Fabien Pinckaers <fp@tiny.Be> # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsabili...
############################################################################## # # Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved. # Fabien Pinckaers <fp@tiny.Be> # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsabili...
Python
0.000214
5a9358147c9930faf5b6d153344fb012c4a8f304
Add MSISDN in the phone_number provider
faker/providers/phone_number/pt_BR/__init__.py
faker/providers/phone_number/pt_BR/__init__.py
from __future__ import unicode_literals from .. import Provider as PhoneNumberProvider class Provider(PhoneNumberProvider): formats = ( '+55 (011) #### ####', '+55 (021) #### ####', '+55 (031) #### ####', '+55 (041) #### ####', '+55 (051) #### ####', '+55 (061) ####...
from __future__ import unicode_literals from .. import Provider as PhoneNumberProvider class Provider(PhoneNumberProvider): formats = ( '+55 (011) #### ####', '+55 (021) #### ####', '+55 (031) #### ####', '+55 (041) #### ####', '+55 (051) #### ####', '+55 (061) ####...
Python
0.000001
374ef731e658097f9b2d2d7593ed1126ec52d282
Fix issues with `skip_unknown`
ycml/transformers/sequences.py
ycml/transformers/sequences.py
import logging from .base import PureTransformer from .text import ListCountVectorizer __all__ = ['TokensToIndexTransformer'] logger = logging.getLogger(__name__) class TokensToIndexTransformer(PureTransformer): def __init__(self, skip_unknown=False, pad_sequences=None, count_vectorizer_args={}, pad_sequences_...
import logging from .base import PureTransformer from .text import ListCountVectorizer __all__ = ['TokensToIndexTransformer'] logger = logging.getLogger(__name__) class TokensToIndexTransformer(PureTransformer): def __init__(self, ignore_unknown=False, pad_sequences=None, count_vectorizer_args={}, pad_sequence...
Python
0
de6babf92252ea5828a9c17d76766357cff3e440
Extend _VALID_URL (Closes #10812)
youtube_dl/extractor/tvland.py
youtube_dl/extractor/tvland.py
# coding: utf-8 from __future__ import unicode_literals from .mtv import MTVServicesInfoExtractor class TVLandIE(MTVServicesInfoExtractor): IE_NAME = 'tvland.com' _VALID_URL = r'https?://(?:www\.)?tvland\.com/(?:video-clips|(?:full-)?episodes)/(?P<id>[^/?#.]+)' _FEED_URL = 'http://www.tvland.com/feeds/mr...
# coding: utf-8 from __future__ import unicode_literals from .mtv import MTVServicesInfoExtractor class TVLandIE(MTVServicesInfoExtractor): IE_NAME = 'tvland.com' _VALID_URL = r'https?://(?:www\.)?tvland\.com/(?:video-clips|episodes)/(?P<id>[^/?#.]+)' _FEED_URL = 'http://www.tvland.com/feeds/mrss/' _...
Python
0
59d4678e8319320b9b5ccd304b1034188c02ae61
insert pth eggs at index of site-packages they come from
pkgs/development/python-modules/site/site.py
pkgs/development/python-modules/site/site.py
def __boot(): import sys, imp, os, os.path PYTHONPATH = os.environ.get('PYTHONPATH') if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH): PYTHONPATH = [] else: PYTHONPATH = PYTHONPATH.split(os.pathsep) pic = getattr(sys,'path_importer_cache',{}) stdpath = sys.pat...
def __boot(): import sys, imp, os, os.path PYTHONPATH = os.environ.get('PYTHONPATH') if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH): PYTHONPATH = [] else: PYTHONPATH = PYTHONPATH.split(os.pathsep) pic = getattr(sys,'path_importer_cache',{}) stdpath = sys.pat...
Python
0
a34d08cec2cdcf259070ca51c69dcd425a04c5be
move use_container into execkwargs
tests/util.py
tests/util.py
from __future__ import absolute_import import os import functools from pkg_resources import (Requirement, ResolutionError, # type: ignore resource_filename) import distutils.spawn import pytest from cwltool.utils import onWindows, windows_default_container_id from cwltool.factory import Fa...
from __future__ import absolute_import import os import functools from pkg_resources import (Requirement, ResolutionError, # type: ignore resource_filename) import distutils.spawn import pytest from cwltool.utils import onWindows, windows_default_container_id from cwltool.factory import Fa...
Python
0.000009
b06863b3bd9b12c47380362b3d4182167a6d2eaa
Update openssl.py
wigs/openssl.py
wigs/openssl.py
class openssl(Wig): tarball_uri = 'https://github.com/openssl/openssl/archive/OpenSSL_$RELEASE_VERSION$.tar.gz' git_uri = 'https://github.com/openssl/openssl' last_release_version = 'v1_1_0e' def setup(self): self.configure_flags += [S.FPIC_FLAG] def gen_configure_snippet(self): return './config %s' % ' '....
class openssl(Wig): tarball_uri = 'https://github.com/openssl/openssl/archive/OpenSSL_$RELEASE_VERSION$.tar.gz' git_uri = 'https://github.com/openssl/openssl' last_release_version = 'v1_0_2d' def setup(self): self.configure_flags += [S.FPIC_FLAG] def gen_configure_snippet(self): return './config %s' % ' '.jo...
Python
0.000002
66c4b93ae78c98928946f0ceeee3a2c16be7655d
Add coding line
app/tests/integration/test_database.py
app/tests/integration/test_database.py
# -*- coding: utf-8 -*- """ Database tests. """ from __future__ import unicode_literals from __future__ import absolute_import from unittest import TestCase from lib import database from models.trends import Trend class TestDatabaseSetup(TestCase): """ Test the database library module. """ def tearD...
""" Database tests. """ from __future__ import unicode_literals from __future__ import absolute_import from unittest import TestCase from lib import database from models.trends import Trend class TestDatabaseSetup(TestCase): """ Test the database library module. """ def tearDown(self): datab...
Python
0.000878
005eea5e467c3a0aa6b942ce377a5c72b9177e21
Fix build_lines() - s/bw/image
textinator.py
textinator.py
import click from PIL import Image @click.command() @click.argument('image', type=click.File('rb')) @click.argument('out', type=click.File('wt'), default='-', required=False) @click.option('-p', '--palette', default='█▓▒░ ', help="A custom palette for rendering images. Goes from dark to b...
import click from PIL import Image @click.command() @click.argument('image', type=click.File('rb')) @click.argument('out', type=click.File('wt'), default='-', required=False) @click.option('-p', '--palette', default='█▓▒░ ', help="A custom palette for rendering images. Goes from dark to b...
Python
0
1f130a8577f16809008bd301ab8c47aab4677750
Add build_lines function, move image generation there.
textinator.py
textinator.py
import click from PIL import Image def scale(val, src, dst): """ Scale the given value from the scale of src to the scale of dst. """ return ((val - src[0]) / (src[1]-src[0])) * (dst[1]-dst[0]) + dst[0] def value_to_char(value, palette, value_range=(0, 256)): palette_range = (0, len(palette)) ...
import click from PIL import Image def scale(val, src, dst): """ Scale the given value from the scale of src to the scale of dst. """ return ((val - src[0]) / (src[1]-src[0])) * (dst[1]-dst[0]) + dst[0] def value_to_char(value, palette, value_range=(0, 256)): palette_range = (0, len(palette)) ...
Python
0
bf7fd4e606901fae6a434e4a375ac72bcbc66e00
Fix plugin
tgp/plugin.py
tgp/plugin.py
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ------------------------------------------------...
Python
0.000001
fe81916434e6aa04d9672589cb75fde3c676e19f
Fix revision chain
src/ggrc/migrations/versions/20151216132037_5410607088f9_delete_background_tasks.py
src/ggrc/migrations/versions/20151216132037_5410607088f9_delete_background_tasks.py
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """Delete background tasks Revision ID: 5410607088f9 Revises: 1ef8f4f504ae Crea...
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file> # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> # Created By: miha@reciprocitylabs.com # Maintained By: miha@reciprocitylabs.com """Delete background tasks Revision ID: 5410607088f9 Revises: 504f541411a5 Crea...
Python
0.000003
0ce840cf43b06fc810bbe45d2aed5fcc591be87c
Add ShortenedUrl class
url_shortener.py
url_shortener.py
# -*- coding: utf-8 -*- import os from bisect import bisect_left from flask import Flask from flask_sqlalchemy import SQLAlchemy from sqlalchemy import types class SlugValueError(ValueError): '''The value of slug is incorrect ''' class Slug(object): ''' An identifier for shortened url In has two valu...
# -*- coding: utf-8 -*- import os from bisect import bisect_left from flask import Flask from flask_sqlalchemy import SQLAlchemy from sqlalchemy import types class SlugValueError(ValueError): '''The value of slug is incorrect ''' class Slug(object): ''' An identifier for shortened url In has two valu...
Python
0
07bda8adbeb798dfd100b63a784e14a00cf33927
add new views to urls
urlsaver/urls.py
urlsaver/urls.py
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.main_view, name='main'), url(r'^register/', views.register_view, name='register'), url(r'^login/', views.login_view, name='login'), url(r'^logout/', views.logout_view, name='logout'), ]
from django.conf.urls import url from . import views urlpatterns = [ url(r'^$', views.main_view, name='main'), ]
Python
0
38d47061b6c1ea3250b99f7376d7479e970974a5
define cheakInradius
MonteCarlo.py
MonteCarlo.py
from math import * def checkInradius(x, y): z = x**2 + y**2 z = sqrt(z) if z < 1.0: return True else: return False N = int(raw_input('Insert your N (random) :: '))
from math import * N = int(raw_input('Insert your N (random) :: ')) print N
Python
0.99981
2ff82cd1e34472173cd8631b8e353515d2c38a41
Rename get_update_db() into get_wrapupdater()
wrapweb/hook.py
wrapweb/hook.py
# Copyright 2015 The Meson development team # # 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 ...
# Copyright 2015 The Meson development team # # 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 ...
Python
0.004751
e97755dffbc834853f3f46a8233a295671b53f5d
Disable pylint broad-except in wrapweb.hook
wrapweb/hook.py
wrapweb/hook.py
# Copyright 2015 The Meson development team # # 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 ...
# Copyright 2015 The Meson development team # # 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 ...
Python
0
7b717c778f02e642c564e9afaf406b0cc4f399ac
Move EE Initialize
geebam/geebam.py
geebam/geebam.py
#! /usr/bin/env python import argparse import json import logging import logging.config import os import sys import ee import batch_uploader def setup_logging(path): with open(path, 'rt') as f: config = json.load(f) logging.config.dictConfig(config) def delete_collection(id): logging.info('At...
#! /usr/bin/env python import argparse import json import logging import logging.config import os import sys import ee import batch_uploader def setup_logging(path): with open(path, 'rt') as f: config = json.load(f) logging.config.dictConfig(config) def delete_collection(id): logging.info('At...
Python
0.000001
33c1db03e6b52d73ee6571f3f645f1b8d01e9a25
Comment to clarify the use of a custom field source
snippets/serializers.py
snippets/serializers.py
from django.forms import widgets from rest_framework import serializers from snippets.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES from django.contrib.auth.models import User class UserSerializer(serializers.ModelSerializer): # Add a filed to diplsay a list of related snippets. snippets = serializer...
from django.forms import widgets from rest_framework import serializers from snippets.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES from django.contrib.auth.models import User class UserSerializer(serializers.ModelSerializer): # Add a filed to diplsay a list of related snippets. snippets = serializer...
Python
0
dd9e53cbe02c0652cca35cde6d859512de4f9e44
fix user_detail pipeline issue
social/pipeline/user.py
social/pipeline/user.py
from uuid import uuid4 from social.utils import slugify, module_member USER_FIELDS = ['username', 'email'] def get_username(strategy, details, user=None, *args, **kwargs): if 'username' not in strategy.setting('USER_FIELDS', USER_FIELDS): return storage = strategy.storage if not user: ...
from uuid import uuid4 from social.utils import slugify, module_member USER_FIELDS = ['username', 'email'] def get_username(strategy, details, user=None, *args, **kwargs): if 'username' not in strategy.setting('USER_FIELDS', USER_FIELDS): return storage = strategy.storage if not user: ...
Python
0
2b553e23791adaa9e333d6f8feded8e95fd348c9
Bump version to 0.2.0a0
cachy/version.py
cachy/version.py
# -*- coding: utf-8 -*- VERSION = '0.2.0a0'
# -*- coding: utf-8 -*- VERSION = '0.1.1'
Python
0.000001
a9240cd8bcfced47b402fdbff0162ad939eaa631
Fix typo
Yank/multistate/__init__.py
Yank/multistate/__init__.py
#!/usr/local/bin/env python # ============================================================================== # MODULE DOCSTRING # ============================================================================== """ MultiState ========== Multistate Sampling simulation algorithms, specific variants, and analyzers This ...
#!/usr/local/bin/env python # ============================================================================== # MODULE DOCSTRING # ============================================================================== """ MultiState ========== Multistate Sampling simulation algorithms, specific variants, and analyzers This ...
Python
0.999999
4a18649367e6593724cdde6cf821eced595bb3cf
use list comprehension for auto-parse
genson/genson.py
genson/genson.py
import argparse import sys import re import json from .generator import SchemaNode DESCRIPTION = """ Generate one, unified JSON Schema from one or more JSON objects and/or JSON Schemas. (uses Draft 4 - http://json-schema.org/draft-04/schema) """ def main(): args = parse_args() s = SchemaNode() for sche...
import argparse import sys import re import json from .generator import SchemaNode DESCRIPTION = """ Generate one, unified JSON Schema from one or more JSON objects and/or JSON Schemas. (uses Draft 4 - http://json-schema.org/draft-04/schema) """ def main(): args = parse_args() s = SchemaNode() for sche...
Python
0.000002
c3d454d5d7272620ab83b9e02cc8063d0e16da0f
Add an embedded favicon for error pages
edgedb/lang/common/markup/renderers/dhtml/__init__.py
edgedb/lang/common/markup/renderers/dhtml/__init__.py
## # Copyright (c) 2011 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## import os from semantix.rendering.css import dumps as scss_dumps, reload as scss_reload from .. import json from ... import serialize __all__ = 'render', _FAVICON = ('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQ...
## # Copyright (c) 2011 Sprymix Inc. # All rights reserved. # # See LICENSE for details. ## import os from semantix.rendering.css import dumps as scss_dumps, reload as scss_reload from .. import json from ... import serialize __all__ = 'render', _HTML_TPL_START = '''<!DOCTYPE html> <!-- Copyright (c) 2011 Sprymi...
Python
0
8f1d2f0e821724f010291d340f30d5842ad32c76
add word2vec yahoo for shoes
extractVecMat_shoes.py
extractVecMat_shoes.py
#/datastore/zhenyang/bin/python import sys import os import gensim, logging import numpy as np import scipy.io as sio def main(): ############## logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) #pretrained_model = './vectors.bin' #pretrained_model = '../fr...
#/datastore/zhenyang/bin/python import sys import os import gensim, logging import numpy as np import scipy.io as sio def main(): ############## logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) #pretrained_model = './vectors.bin' #pretrained_model = '../fr...
Python
0.000238
24f5be6e6a409b7447ccd6fede81b8c55662def4
add return data
util/strategy.py
util/strategy.py
import numpy as np from trendy import segtrends import pandas as pd import tradingWithPython as twp from filter import movingaverage def orders_from_trends(x, segments=2, charts=True, window=7, momentum=False): ''' generate orders from segtrends ''' x_maxima, maxima, x_minima, minima = segtrends(x, segments, ...
import numpy as np from trendy import segtrends import pandas as pd import tradingWithPython as twp from filter import movingaverage def orders_from_trends(x, segments=2, charts=True, window=7, momentum=False): ''' generate orders from segtrends ''' x_maxima, maxima, x_minima, minima = segtrends(x, segments, ...
Python
0.025135
efc26d1e3065f18a80b601e8416abe0a19c83103
Simplify a test case, NFC
packages/Python/lldbsuite/test/lang/swift/variables/bridged_string/TestSwiftBridgedStringVariables.py
packages/Python/lldbsuite/test/lang/swift/variables/bridged_string/TestSwiftBridgedStringVariables.py
# coding=utf-8 # TestSwiftBridgedStringVariables.py # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.txt for license information ...
# coding=utf-8 # TestSwiftBridgedStringVariables.py # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/LICENSE.txt for license information ...
Python
0.000002
b45e9be5338baa652055f52c494a4febefe75c2d
Fix dealing with numpy arrays.
pydevd_plugins/extensions/types/pydevd_plugin_numpy_types.py
pydevd_plugins/extensions/types/pydevd_plugin_numpy_types.py
from _pydevd_bundle.pydevd_extension_api import TypeResolveProvider from _pydevd_bundle.pydevd_resolver import defaultResolver, MAX_ITEMS_TO_HANDLE, TOO_LARGE_ATTR, TOO_LARGE_MSG from .pydevd_helpers import find_mod_attr # ===============================================================================================...
from _pydevd_bundle.pydevd_extension_api import TypeResolveProvider from _pydevd_bundle.pydevd_resolver import defaultResolver, MAX_ITEMS_TO_HANDLE, TOO_LARGE_ATTR, TOO_LARGE_MSG from .pydevd_helpers import find_mod_attr # ===============================================================================================...
Python
0
d90d7c35df1f815f31de2cad9fe2dde43f9f561a
Print generation date.
git_changelog.py
git_changelog.py
from __future__ import print_function from collections import defaultdict import datetime import glob import json import os import re import subprocess from urllib2 import urlopen DEBUG = False GIT_EXEC = "/usr/bin/git" REPOSITORIES = glob.glob("/ssd/swinbank/src/*") # Everything in w_2017_8 JIRA_API_URL = "https://j...
from __future__ import print_function from collections import defaultdict import glob import json import os import re import subprocess from urllib2 import urlopen DEBUG = False GIT_EXEC = "/usr/bin/git" REPOSITORIES = glob.glob("/ssd/swinbank/src/*") # Everything in w_2017_8 JIRA_API_URL = "https://jira.lsstcorp.org...
Python
0.000001
d7e9264418cbe5574d7475094e2c06a878897c34
fix ALDC scraper
every_election/apps/election_snooper/snoopers/aldc.py
every_election/apps/election_snooper/snoopers/aldc.py
from datetime import datetime from .base import BaseSnooper from election_snooper.models import SnoopedElection class ALDCScraper(BaseSnooper): snooper_name = "ALDC" base_url = "https://www.aldc.org/" def get_all(self): url = "{}category/forthcoming-by-elections/".format(self.base_url) p...
from datetime import datetime from .base import BaseSnooper from election_snooper.models import SnoopedElection class ALDCScraper(BaseSnooper): snooper_name = "ALDC" base_url = "https://www.aldc.org/" def get_all(self): url = "{}category/forthcoming-by-elections/".format(self.base_url) p...
Python
0
021ca057be4333d209454b043c79f9d6d327c3e0
Return the response for the main page without jinja rendering as AngularJS is doing the rendering
webapp/keepupwithscience/frontend/main.py
webapp/keepupwithscience/frontend/main.py
from flask import Blueprint, render_template, make_response bp = Blueprint('main', __name__) @bp.route('/') def index(): """Returns the main interface.""" return make_response(open('keepupwithscience/frontend/templates/main.html').read()) # return render_template('main.html')
from flask import Blueprint, render_template bp = Blueprint('main', __name__) @bp.route('/') def index(): """Returns the main interface.""" return render_template('main.html')
Python
0.000021
392e34a70bd2bccba268ec9de1752afc50cd1b35
Add the httlib dir to the build
packaging/datadog-agent-lib/setup.py
packaging/datadog-agent-lib/setup.py
#!/usr/bin/env python try: from setuptools import setup, find_packages except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages import os, sys from distutils.command.install import INSTALL_SCHEMES def getVersion(): try: from con...
#!/usr/bin/env python try: from setuptools import setup, find_packages except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages import os, sys from distutils.command.install import INSTALL_SCHEMES def getVersion(): try: from con...
Python
0
a9ff99f94938c5e50038b9d98200c5247e651c35
Fix AttributeError: module 'config' has no attribute 'expires'
utils/ignores.py
utils/ignores.py
import random import time import config import log as logging def check_ignored(host, channel): ignores = config.expires['global'] if channel in config.ignores['channel'].keys(): ignores.extend(config.expires['channel'][channel]) for i in ignores: for (uhost, expires) in i: #...
import random import time import config import log as logging def check_ignored(host, channel): ignores = config.expires['global'] if channel in config.expires['channel'].keys(): ignores.extend(config.expires['channel'][channel]) for i in ignores: for (uhost, expires) in i: #...
Python
0.014043
7de5d99866164c0f17aa85f8cdd910132ac35667
use re.split instead of string.split
topiary/rna/common.py
topiary/rna/common.py
# Copyright (c) 2015. Mount Sinai School of Medicine # # 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 o...
# Copyright (c) 2015. Mount Sinai School of Medicine # # 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 o...
Python
0.000032
9c90c539f83551de2645522c22ccbd0c75d34be3
Fix Mapbox routing fixture shape
server/lib/python/cartodb_services/test/test_mapboxrouting.py
server/lib/python/cartodb_services/test/test_mapboxrouting.py
import unittest from mock import Mock from cartodb_services.mapbox import MapboxRouting from cartodb_services.mapbox.routing import DEFAULT_PROFILE from cartodb_services.tools.exceptions import ServiceException from cartodb_services.tools import Coordinate from credentials import mapbox_api_key INVALID_TOKEN = 'invali...
import unittest from mock import Mock from cartodb_services.mapbox import MapboxRouting from cartodb_services.mapbox.routing import DEFAULT_PROFILE from cartodb_services.tools.exceptions import ServiceException from cartodb_services.tools import Coordinate from credentials import mapbox_api_key INVALID_TOKEN = 'invali...
Python
0
ab505466859a5d2e5b397d1fb1fc3271977a2024
modify register validation
app/user/forms.py
app/user/forms.py
from flask_wtf import Form from wtforms import StringField, PasswordField, TextAreaField, SelectField, validators from wtforms.ext.sqlalchemy.fields import QuerySelectField from .models import User from app.post.models import Post_type from flask.ext.bcrypt import check_password_hash class LoginForm(Form): userna...
from flask_wtf import Form from wtforms import StringField, PasswordField, TextAreaField, SelectField, validators from wtforms.ext.sqlalchemy.fields import QuerySelectField from .models import User from app.post.models import Post_type from flask.ext.bcrypt import check_password_hash class LoginForm(Form): userna...
Python
0.000001
8bc108c5a8b4ce3fa5192363576eef7f67f4d82e
Update tracking params
app/utils/meta.py
app/utils/meta.py
from urllib.parse import unquote, urlparse import aiohttp from sanic.log import logger from .. import settings def get_watermark(request, watermark: str) -> tuple[str, bool]: api_key = _get_api_key(request) if api_key: api_mask = api_key[:2] + "***" + api_key[-2:] logger.info(f"Authenticated...
from urllib.parse import unquote, urlparse import aiohttp from sanic.log import logger from .. import settings def get_watermark(request, watermark: str) -> tuple[str, bool]: api_key = _get_api_key(request) if api_key: api_mask = api_key[:2] + "***" + api_key[-2:] logger.info(f"Authenticated...
Python
0.000001
29e56ec30c13c5fbb562e77cdb2c660d5fc52842
remove debugging print
freppledb/common/management/commands/generatetoken.py
freppledb/common/management/commands/generatetoken.py
# # Copyright (C) 2021 by frePPLe bv # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This library is distri...
# # Copyright (C) 2021 by frePPLe bv # # This library is free software; you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This library is distri...
Python
0.000081
9235d1aa35e6a597be3c497577de528425d6e046
comment cleanup
training/parse_osm.py
training/parse_osm.py
from lxml import etree import ast import re # parse xml data, return a list of dicts representing addresses def xmlToAddrList(xml_file): tree = etree.parse(xml_file) root = tree.getroot() addr_list=[] for element in root: if element.tag == 'node' or element.tag =='way': address={} for x in element.iter('ta...
from lxml import etree import ast import re # parse xml data, return a list of dicts representing addresses def xmlToAddrList(xml_file): tree = etree.parse(xml_file) root = tree.getroot() addr_list=[] for element in root: if element.tag == 'node' or element.tag =='way': address={} for x in element.iter('ta...
Python
0
d7bea2995fc54c15404b4b47cefae5fc7b0201de
FIX partner internal code compatibility with sign up
partner_internal_code/res_partner.py
partner_internal_code/res_partner.py
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import fields, models, api class pa...
# -*- coding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in module root # directory ############################################################################## from openerp import fields, models, api class pa...
Python
0
7428f7d87d33ab1531f94753516ad4a56780a612
Add helper to predefine remove recursive flag. Add copy_to and copy_from helpers which aid the copying of single files
virtualbox/library_ext/guest_session.py
virtualbox/library_ext/guest_session.py
import time from virtualbox import library """ Add helper code to the default IGuestSession class. """ # Add context management to IGuestSession class IGuestSession(library.IGuestSession): __doc__ = library.IGuestSession.__doc__ def __enter__(self): return self def __exit__(self, exception_type...
import time from virtualbox import library """ Add helper code to the default IGuestSession class. """ # Add context management to IGuestSession class IGuestSession(library.IGuestSession): __doc__ = library.IGuestSession.__doc__ def __enter__(self): return self def __exit__(self, exception_type...
Python
0
da05fe2d41a077276946c5d6c86995c60315e093
Make sure we load pyvisa-py when enumerating instruments.
src/auspex/instruments/__init__.py
src/auspex/instruments/__init__.py
import pkgutil import importlib import pyvisa instrument_map = {} for loader, name, is_pkg in pkgutil.iter_modules(__path__): module = importlib.import_module('auspex.instruments.' + name) if hasattr(module, "__all__"): globals().update((name, getattr(module, name)) for name in module.__all__) for name in module...
import pkgutil import importlib import pyvisa instrument_map = {} for loader, name, is_pkg in pkgutil.iter_modules(__path__): module = importlib.import_module('auspex.instruments.' + name) if hasattr(module, "__all__"): globals().update((name, getattr(module, name)) for name in module.__all__) for name in module...
Python
0
23d4e48155e8906510d09a5eaf9fafafa7280d63
Fix a few typos in the test.
test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
test/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
""" Test lldb data formatter subsystem. """ import os, time import unittest2 import lldb from lldbtest import * import lldbutil class LibcxxUnorderedDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @skipUnlessDarwin @dsym_test def test_with_dsym_and_run_command(self): ...
""" Test lldb data formatter subsystem. """ import os, time import unittest2 import lldb from lldbtest import * import lldbutil class LibcxxUnorderedDataFormatterTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @skipUnlessDarwin @dsym_test def test_with_dsym_and_run_command(self): ...
Python
0.999998
abc74f521f1b52fe2b17046cc81705a691314832
Give an error only if the report object is not None
ReadConfig.py
ReadConfig.py
# # ReadConfig # # Ron Lockwood # University of Washington, SIL International # 12/4/14 # # Version 1.1 - 3/7/18 - Ron Lockwood # Give an error only if the report object is not None # # Functions for reading a configuration file import re CONFIG_FILE = 'FlexTrans.config' def readConfig(report): tr...
# # ReadConfig # # Ron Lockwood # University of Washington, SIL International # 12/4/14 # # Functions for reading a configuration file import re CONFIG_FILE = 'FlexTrans.config' def readConfig(report): try: f_handle = open(CONFIG_FILE) except: report.Error('Error reading the file: "'...
Python
0.999999
4eb4a2eaa42cd71bf4427bdaaa1e853975432691
Allow keyword arguments in GeneralStoreManager.create_item method
graphene/storage/intermediate/general_store_manager.py
graphene/storage/intermediate/general_store_manager.py
from graphene.storage.id_store import * class GeneralStoreManager: """ Handles the creation/deletion of nodes to the NodeStore with ID recycling """ def __init__(self, store): """ Creates an instance of the GeneralStoreManager :param store: Store to manage :return: Ge...
from graphene.storage.id_store import * class GeneralStoreManager: """ Handles the creation/deletion of nodes to the NodeStore with ID recycling """ def __init__(self, store): """ Creates an instance of the GeneralStoreManager :param store: Store to manage :return: Ge...
Python
0.000001
ad47fb85e5c2deb47cbe3fc3478e1ae2da93adfe
Update h-index.py
Python/h-index.py
Python/h-index.py
# Time: O(n) # Space: O(n) # Given an array of citations (each citation is a non-negative integer) # of a researcher, write a function to compute the researcher's h-index. # # According to the definition of h-index on Wikipedia: # "A scientist has index h if h of his/her N papers have # at least h citations each, an...
# Time: O(nlogn) # Space: O(1) # Given an array of citations (each citation is a non-negative integer) # of a researcher, write a function to compute the researcher's h-index. # # According to the definition of h-index on Wikipedia: # "A scientist has index h if h of his/her N papers have # at least h citations each...
Python
0.000002
56adaeecb5ed868ca057a4985a9305770d551b61
Add version
sqlalchemy_seed/__init__.py
sqlalchemy_seed/__init__.py
# -*- coding: utf-8 -*- """ sqlalchemy_seed ~~~~~~~~~~~~~~~ `sqlalchemy_seed` is a seed library which provides initial data to database using SQLAlchemy. :copyright: (c) 2017 Shinya Ohyanagi, All rights reserved. :license: BSD, see LICENSE for more details. """ import os import importlib impor...
# -*- coding: utf-8 -*- """ sqlalchemy_seed ~~~~~~~~~~~~~~~ Seed :copyright: (c) 2017 Shinya Ohyanagi, All rights reserved. :license: BSD, see LICENSE for more details. """ import os import importlib import json import yaml def create_table(base, session=None): """Create table. :param ...
Python
0
4fd6d20be257cca38f98d20df78b35d7c7bc3911
Fix factory_jst
feder/teryt/factory.py
feder/teryt/factory.py
from random import randint from .models import JednostkaAdministracyjna as JST from .models import Category def factory_jst(): category = Category.objects.create(name="X", level=1) return JST.objects.create(name="X", id=randint(0, 1000), category=category, ...
from autofixture import AutoFixture from .models import JednostkaAdministracyjna def factory_jst(): jst = AutoFixture(JednostkaAdministracyjna, field_values={'updated_on': '2015-02-12'}, generate_fk=True).create_one(commit=False) jst.rght = 0 jst.save() ret...
Python
0.000002
2eefaca1d7d27ebe2e9a489ab2c1dc2927e49b55
Bump version
sqliteschema/__version__.py
sqliteschema/__version__.py
__author__ = "Tsuyoshi Hombashi" __copyright__ = "Copyright 2016, {}".format(__author__) __license__ = "MIT License" __version__ = "1.0.2" __maintainer__ = __author__ __email__ = "tsuyoshi.hombashi@gmail.com"
__author__ = "Tsuyoshi Hombashi" __copyright__ = "Copyright 2016, {}".format(__author__) __license__ = "MIT License" __version__ = "1.0.1" __maintainer__ = __author__ __email__ = "tsuyoshi.hombashi@gmail.com"
Python
0
bc904f3ab7cc9d697dc56058ac9cb578055c401f
raise exception rather than logging and returning
checks.d/hdfs.py
checks.d/hdfs.py
from checks import AgentCheck class HDFSCheck(AgentCheck): """Report on free space and space used in HDFS. """ def check(self, instance): try: import snakebite.client except ImportError: raise ImportError('HDFSCheck requires the snakebite module') if 'name...
from checks import AgentCheck class HDFSCheck(AgentCheck): """Report on free space and space used in HDFS. """ def check(self, instance): try: import snakebite.client except ImportError: raise ImportError('HDFSCheck requires the snakebite module') if 'name...
Python
0
082562d4fc3567f956e95d71807c65281a69b3ff
change get_many to expect ids
feedly/storage/base.py
feedly/storage/base.py
from feedly.serializers.base import BaseSerializer class BaseActivityStorage(object): ''' The storage class for activities data ''' serializer = BaseSerializer def __init__(self, **options): self.options = options self.serializer = self.serializer() def add_to_storage(self,...
from feedly.serializers.base import BaseSerializer class BaseActivityStorage(object): ''' The storage class for activities data ''' serializer = BaseSerializer def __init__(self, **options): self.options = options self.serializer = self.serializer() def add_to_storage(self,...
Python
0
6a8c8bc0e407327e5c0e4cae3d4d6ace179a6940
Add team eligibility to API
webserver/codemanagement/serializers.py
webserver/codemanagement/serializers.py
from rest_framework import serializers from greta.models import Repository from competition.models import Team from .models import TeamClient, TeamSubmission class TeamSerializer(serializers.ModelSerializer): class Meta: model = Team fields = ('id', 'name', 'slug', 'eligible_to_win') class Rep...
from rest_framework import serializers from greta.models import Repository from competition.models import Team from .models import TeamClient, TeamSubmission class TeamSerializer(serializers.ModelSerializer): class Meta: model = Team fields = ('id', 'name', 'slug') class RepoSerializer(seriali...
Python
0
d50daddde2186d54659a4f8dbf63622311ed6d22
remove service class
glim/services.py
glim/services.py
from glim.core import Service class Config(Service): pass class Session(Service): pass class Router(Service): pass
# metaclass for Service class class DeflectToInstance(type): def __getattr__(selfcls, a): # selfcls in order to make clear it is a class object (as we are a metaclass) try: # first, inquiry the class itself return super(DeflectToInstance, selfcls).__getattr__(a) except Attrib...
Python
0.000003
72902ebcada7bdc7a889f8766b63afff82110182
Comment about recursion limit in categories.
webshop/extensions/category/__init__.py
webshop/extensions/category/__init__.py
# Copyright (C) 2010-2011 Mathijs de Bruin <mathijs@mathijsfietst.nl> # # This file is part of django-webshop. # # django-webshop is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 2, or (at...
# Copyright (C) 2010-2011 Mathijs de Bruin <mathijs@mathijsfietst.nl> # # This file is part of django-webshop. # # django-webshop is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 2, or (at...
Python
0
f5fad49e0b20e54e01fe4d9ae69be0694d7878f9
add docstring to test setup, and move to the top
sale_exception_nostock/tests/test_dropshipping_skip_check.py
sale_exception_nostock/tests/test_dropshipping_skip_check.py
# Author: Leonardo Pistone # Copyright 2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any la...
# Author: Leonardo Pistone # Copyright 2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any la...
Python
0