text
string
size
int64
token_count
int64
#!/usr/bin/env python3 import signal import logging import sys from gi.repository import GObject GObject.threads_init() import time from lib.args import Args from lib.loghandler import LogHandler import lib.connection as Connection def testCallback(args): log = logging.getLogger("Test") log.info(str(args...
1,667
516
import warnings from typing import Any, Callable, Optional, Tuple from tensorboard.backend.event_processing import event_accumulator from torch.utils.tensorboard import SummaryWriter from tianshou.utils.logger.base import LOG_DATA_TYPE, BaseLogger class TensorboardLogger(BaseLogger): """A logger that relies on ...
3,220
995
# Jetfuel Game Engine- A SDL-based 2D game-engine # Copyright (C) 2018 InfernoStudios # # 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...
7,326
2,251
# coding=utf-8 # Copyright 2021 The Google Research 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 applicab...
30,649
10,013
import matplotlib.pyplot as plt import numpy as np import pandas as pd import click import numba def prepare_data(data_pd, parameter): lon_set = set(data_pd["lon"]) lat_set = set(data_pd["lat"]) dep_set = set(data_pd["dep"]) lon_list = sorted(lon_set) lat_list = sorted(lat_set) dep_list = sor...
5,412
2,297
from flask import Flask from flask_appconfig import HerokuConfig def create_sample_app(): app = Flask('testapp') HerokuConfig(app) return app def test_herokupostgres(monkeypatch): monkeypatch.setenv('HEROKU_POSTGRESQL_ORANGE_URL', 'heroku-db-uri') app = create_sample_app() assert app.config...
367
136
import logging """ Formatter """ formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s', datefmt='%Y-%m-%d:%H:%M:%S') """ Set Flask logger """ logger = logging.getLogger('FLASK_LOG') logger.setLevel(logging.DEBUG) stream_log = logging.StreamHandler() stream_log.setFormatter(form...
396
146
#!/usr/bin/python3 import os import sys import socket CURRENT_DIR = os.path.dirname(__file__) NEWSBLUR_DIR = ''.join([CURRENT_DIR, '/../../']) sys.path.insert(0, NEWSBLUR_DIR) os.environ['DJANGO_SETTINGS_MODULE'] = 'newsblur_web.settings' import threading class ProgressPercentage(object): def __init__(self, fil...
1,592
574
#!/usr/bin/python # # This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # # http://www.apache.org/licenses/LICENSE-2.0 # # pylint: disable=missing-docstring # pylint: disable=duplicate-c...
22,780
7,067
#!/usr/bin/python # -*- coding: utf-8 -*- __author__ = "Ricardo Ribeiro" __credits__ = ["Ricardo Ribeiro"] __license__ = "MIT" __version__ = "0.0" __maintainer__ = "Ricardo Ribeiro" __email__ = "ricardojvr@gmail.com" __status__ = "Development" from __init__ import * import random, time f...
3,262
1,248
from typing import Tuple import numpy as np import rasterio.warp from opensfm import features from .orthophoto_manager import OrthoPhotoManager from .view import View class OrthoPhotoView(View): def __init__( self, main_ui, path: str, init_lat: float, init_lon: float, ...
4,447
1,498
# Copyright 2015 NEC Corporation. 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 ...
3,704
1,150
# uncompyle6 version 3.2.0 # Python bytecode 2.4 (62061) # Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] # Embedded file name: pirates.leveleditor.worldData.interior_spanish_npc_b from pandac.PandaModules import Point3, VBase3, Vec4, Vec3 objectStruct = {'Objects...
29,478
17,075
# PassGen # These imports will be used for this project. from colorama import Fore, Style from colorama import init import datetime import string import random import sys import os # Initilaze File organizer. os.system('title PassGen') init(autoreset = True) # Create Log Functions. class LOG: def INF...
1,844
698
""" The model file for a Memo """ import re import os import shutil import json from datetime import datetime from flask import current_app from memos import db from memos.models.User import User from memos.models.MemoState import MemoState from memos.models.MemoFile import MemoFile from memos.models.MemoSignature i...
24,723
7,184
"""Common ETL test fixtures""" import json import pytest @pytest.fixture(autouse=True) def mitx_settings(settings): """Test settings for MITx import""" settings.EDX_API_CLIENT_ID = "fake-client-id" settings.EDX_API_CLIENT_SECRET = "fake-client-secret" settings.EDX_API_ACCESS_TOKEN_URL = "http://local...
1,385
528
import numpy as np import matplotlib.pyplot as plt import matplotlib.cm as cm import random class JuliaSet: def __init__(self): """ Constructor of the JuliaSet class :param size: size in pixels (for both width and height) :param dpi: dots per inch (default 300) """ ...
8,850
2,719
#!python3 # eye_detection.py - detect eyes using webcam # tutorial: https://www.roytuts.com/real-time-eye-detection-in-webcam-using-python-3/ import cv2 import math import numpy as np def main(): faceCascade = cv2.CascadeClassifier("haarcascade_frontalface_alt.xml") eyeCascade = cv2.CascadeClassifier("haarc...
1,212
466
#!/usr/bin/env python descripts = {} with open('macaca_genes.txt') as fh: fh.readline() for line in fh: cols = line.strip('\n').split('\t') if cols[1]: descripts[cols[0]] = cols[1].split('[')[0].strip() else: descripts[cols[0]] = cols[1] with open('gene_info.txt') as fh: for line in fh: cols = line....
399
183
import gin from scaper import Scaper, generate_from_jams import copy import logging import p_tqdm import nussl import os import numpy as np def _reset_event_spec(sc): sc.reset_fg_event_spec() sc.reset_bg_event_spec() def check_mixture(path_to_mix): mix_signal = nussl.AudioSignal(path_to_mix) if mix_si...
4,627
1,478
import json def hydrateCards(rawDeckDataPath): pack = [] rawDeckData = json.load(open(rawDeckDataPath,)) for index, item in enumerate(rawDeckData): deck = [] # print(index,item) for i in rawDeckData[item]: card ={ f'{index}': { ...
4,643
1,410
import numpy as np from keras import backend as K import os import sys K.set_image_dim_ordering('tf') def patch_path(path): return os.path.join(os.path.dirname(__file__), path) def main(): sys.path.append(patch_path('..')) data_dir_path = patch_path('very_large_data') model_dir_path = patch_path('...
1,328
470
from django.conf import settings def less_settings(request): return { 'use_dynamic_less_in_debug': getattr(settings, 'LESS_USE_DYNAMIC_IN_DEBUG', True) }
172
61
# -*- coding: utf-8 -*- from scipy import stats import numpy as np import warnings from ...compat import check_is_fitted, pmdarima as pm_compat from .base import BaseEndogTransformer __all__ = ['BoxCoxEndogTransformer'] class BoxCoxEndogTransformer(BaseEndogTransformer): r"""Apply the Box-Cox transformation t...
5,898
1,774
from baserow.core.registry import Instance, Registry class UserDataType(Instance): """ The user data type can be used to inject an additional payload to the API JWT response. This is the response when a user authenticates or refreshes his token. The returned dict of the `get_user_data` method is added...
2,139
560
''' ------------------------------------- Assignment 2 - EE2703 (Jan-May 2020) Done by Akilesh Kannan (EE18B122) Created on 18/01/20 Last Modified on 04/02/20 ------------------------------------- ''' # importing necessary libraries import sys import cmath import numpy as np import pandas as pd # To improve reada...
17,197
5,158
import subprocess import os.path """ Stylish input() """ def s_input(string): return input(string+">").strip("\n") """ Execute command locally """ def execute_command(command): if len(command) > 0: print(command) proc = subprocess.Popen(command.split(" "), stdout=subprocess.PIPE, cwd="/tmp")...
880
300
import numpy as np import matplotlib.pyplot as plt from skimage.exposure import rescale_intensity from unsharp import * # Load file and normalize to 0-1 fname = 'iguana.jpg' im = plt.imread(fname) if im.mean() >= 1: im = im/255. sigma = 5 amplitude = 1.5 imsharp = unsharp_mask(im, sigma, amplitude) imsharp = re...
446
187
# -*- coding: utf-8 -*- from django.db import models from apps.registro.models.TipoDomicilio import TipoDomicilio from apps.registro.models.Localidad import Localidad from apps.registro.models.Establecimiento import Establecimiento from django.core.exceptions import ValidationError from apps.seguridad.audit import audi...
1,218
459
# 6.5 Write code using find() and string slicing (see section 6.10) to extract # the number at the end of the line below. # Convert the extracted value to a floating point number and print it out. text = "X-DSPAM-Confidence: 0.8475"; pos = text.find(':') text = float(text[pos+1:]) print text
301
106
import logging logger = logging.getLogger(__name__) print(f"!!!!!!!!!! getEffectiveLevel: {logger.getEffectiveLevel()} !!!!!!!!!!!!!") from dltb.base.observer import Observable, change from network import Network, loader from network.lucid import Network as LucidNetwork # lucid.modelzoo.vision_models: # A module ...
6,672
1,857
# -*- coding: utf-8 -*- # Copyright 2014-2016 OpenMarket Ltd # Copyright 2018-2019 New Vector Ltd # Copyright 2019 The Matrix.org Foundation C.I.C. # # 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 Licens...
87,649
23,912
# Copyright 2017 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...
3,074
874
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals) import os import sub...
4,005
1,202
# coding=utf-8 # Copyright 2020 The Google Research 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 applicab...
4,967
1,622
import os import sys import time from IPython.display import Image import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sb sb.set_style("dark") #### Initial Setup #### #plant info plant_info = pd.read_csv('../data/plant_data.csv') plant_info.index.name = 'plant_index' plants = pla...
6,941
2,419
import warnings from collections import OrderedDict from distutils.version import LooseVersion from functools import partial from inspect import isclass from typing import Callable, Optional, Dict, Union import numpy as np import torch import tqdm from torch import Tensor, nn from torch.nn import functional as F from...
9,453
3,086
#!/usr/bin/env python # Filename: polygons_cd """ introduction: compare two polygons in to shape file authors: Huang Lingcao email:huanglingcao@gmail.com add time: 26 February, 2020 """ import sys,os from optparse import OptionParser # added path of DeeplabforRS sys.path.insert(0, os.path.expanduser('~/codes/Pychar...
2,559
907
class Car(object): """ Car class that can be used to instantiate various vehicles. It takes in arguments that depict the type, model, and name of the vehicle """ def __init__(self, name="General", model="GM", car_type="saloon"): num_of_wheels = 4 num_of_doors = 4 ...
919
313
import tensorflow as tf # Convert the model. converter = tf.lite.TFLiteConverter.from_saved_model('model.py') tflite_model = converter.convert() open("trash_ai.tflite", "wb").write(tflite_model)
195
71
from django_cron import CronJobBase, Schedule from .models import Link from django.utils import timezone class MyCronJob(CronJobBase): RUN_EVERY_MINS = 1 # every 2 hours schedule = Schedule(run_every_mins=RUN_EVERY_MINS) code = 'basicapp.cron' # a unique code def do(self): current_time = t...
711
219
# coding: utf8 """ weasyprint.tests.stacking ------------------------- :copyright: Copyright 2011-2012 Simon Sapin and contributors, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division, unicode_literals from ..stacking import StackingContext from .test_boxes impo...
2,029
681
from django.shortcuts import render from django.contrib.auth.models import User from django.contrib.auth.decorators import login_required from sesame import utils from django.core.mail import send_mail def login_page(request): if request.method == "POST": email = request.POST.get("emailId") user =...
1,143
354
from .custom_check import CustomCheck, CustomCheckError from typing import Any, List import logging logger = logging.getLogger(__name__) class DSSParameterError(Exception): """Exception raised when at least one CustomCheck fails.""" pass class DSSParameter: """Object related to one parameter. It is m...
3,079
815
#!/usr/bin/python2.4 # Copyright (C) 2008 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 la...
21,868
7,412
# -*- coding: utf-8 -*- """This module contains classes for documents, and lists of documents. Documents are defined by the document rules in settings.py A file can contain one or more document. However, a document can not be constructed from more than one file. This is a limitation, obvious in cases like ...
5,681
1,569
#!/usr/bin/env python3 import os import os.path import shutil import subprocess import sys import tempfile import uuid import mgm_utils def main(): (root_dir, input_file, json_file) = sys.argv[1:4] tmpName = str(uuid.uuid4()) tmpdir = "/tmp" temp_input_file = f"{tmpdir}/{tmpName}.dat" temp_output_file = f"{tmpd...
773
324
""" Testing 3D tracer advection-diffusion equation with method of manufactured solution (MMS). """ from thetis import * import numpy from scipy import stats import pytest class Setup1: """ Constant bathymetry and u velocty, zero diffusivity, non-trivial tracer """ def bath(self, x, y, lx, ly): ...
12,313
5,543
from lxml import etree from django import forms from django.db import models class XMLFileField(models.FileField): def __init__(self, *args, **kwargs): self.schema = kwargs.pop('schema') super(XMLFileField, self).__init__(*args, **kwargs) def clean(self, *args, **kwargs): data = supe...
723
209
import tensorflow as tf from tensorflow import keras from keras_cv_attention_models.attention_layers import ( activation_by_name, batchnorm_with_activation, conv2d_no_bias, depthwise_conv2d_no_bias, add_pre_post_process, ) from keras_cv_attention_models import model_surgery from keras_cv_attention_m...
15,658
6,221
from pytest import raises from pydantic import ValidationError from robot_server.service.json_api.response import ( ResponseDataModel, ResponseModel, MultiResponseModel, ) from tests.service.helpers import ItemResponseModel def test_attributes_as_dict() -> None: MyResponse = ResponseModel[ResponseDat...
4,064
1,282
from game.game_view import GameView from game.menu_view import menu_view from game import constants import arcade SCREEN_WIDTH = constants.SCREEN_WIDTH SCREEN_HEIGHT = constants.SCREEN_HEIGHT SCREEN_TITLE = constants.SCREEN_TITLE window = arcade.Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE) start_view = menu_vi...
367
139
# Copyright 2015 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law ...
2,300
814
from concurrent.futures import TimeoutError from google.cloud import pubsub_v1 project_id = "pubsub-testing-331300" subscription_id = "test-sub" # Number of seconds the subscriber should listen for messages timeout = 5.0 subscriber = pubsub_v1.SubscriberClient() # The `subscription_path` method creates a fully qualif...
1,200
354
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import api, fields, models, _ class ResConfigSettings(models.TransientModel): _inherit = "res.config.settings" google_drive_authorization_code = fields.Char(string='Authorization Code', config_parame...
2,136
608
""" Data Loader for Generating Tasks Author: Zhao Na, 2020 """ import os import random import math import glob import numpy as np import h5py as h5 import transforms3d from itertools import combinations import torch from torch.utils.data import Dataset def sample_K_pointclouds(data_path, num_point, pc_attribs, pc_...
17,308
5,690
from dataclasses import dataclass from typing import List from greendoge.types.condition_opcodes import ConditionOpcode from greendoge.util.streamable import Streamable, streamable @dataclass(frozen=True) @streamable class ConditionWithArgs(Streamable): """ This structure is used to store parsed CLVM conditi...
467
139
"""The nexia integration base entity.""" from aiopvapi.resources.shade import ATTR_TYPE from homeassistant.const import ATTR_MODEL, ATTR_SW_VERSION import homeassistant.helpers.device_registry as dr from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.update_coordinator import CoordinatorEnt...
3,065
1,031
# Xlib.ext.res -- X-Resource extension module # # Copyright (C) 2021 Aleksei Bavshin <alebastr89@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public License # as published by the Free Software Foundation; either version 2.1 ...
9,244
3,011
# Process the unix command line of the pipeline. import argparse from version import rubra_version def get_cmdline_args(): return parser.parse_args() parser = argparse.ArgumentParser( description='A bioinformatics pipeline system.') parser.add_argument( 'pipeline', metavar='PIPELINE_FILE', type=...
1,690
542
import webbrowser import config from Generator import Generator def main(): generator = Generator() latitude, longitude = generator.getCoordinates() webbrowser.open(config.api_request.format(latitude, longitude)) if __name__ == '__main__': main()
268
80
#!/usr/bin/env python import getopt import socket import sys import cbor #from cbor2 import dumps, loads import json import time import traceback from coapthon.client.helperclient import HelperClient from coapthon.utils import parse_uri from coapthon import defines client = None paths = {} paths_extend = {} my_base ...
35,104
13,042
hiddenimports = ['sip', 'PyQt4.QtGui', 'PyQt4._qt'] from PyInstaller.hooks.hookutils import qt4_plugins_binaries def hook(mod): mod.binaries.extend(qt4_plugins_binaries('phonon_backend')) return mod
210
80
from PyTradier.base import BasePyTradier from typing import Union from datetime import datetime class MarketData(BasePyTradier): """All Methods currently only support string API calls, no datetime, bools, etc """ def quotes(self, symbols: Union[str, list], greeks: bool = False) -> dict: """Get a ...
6,579
1,811
# Copyright 2018 Jetperch LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
3,528
1,080
""" Services are the heart of RPyC: each side of the connection exposes a *service*, which define the capabilities available to the other side. Note that the services by both parties need not be symmetric, e.g., one side may exposed *service A*, while the other may expose *service B*. As long as the two can interopera...
7,677
2,167
import unittest from testbase import TaskmatorTestBase from taskmator.task import core, util from taskmator import context class ManagerTest(TaskmatorTestBase): def testManager(self): print ("Pending") def main(): unittest.main() if __name__ == '__main__': unittest.main()
307
95
"""Test discovery of entities for device-specific schemas for the Z-Wave JS integration.""" async def test_iblinds_v2(hass, client, iblinds_v2, integration): """Test that an iBlinds v2.0 multilevel switch value is discovered as a cover.""" node = iblinds_v2 assert node.device_class.specific.label == "Unus...
1,301
449
from typing import Optional from botocore.client import BaseClient from typing import Dict from typing import Union from botocore.paginate import Paginator from botocore.waiter import Waiter from typing import List class Client(BaseClient): def accept_invitation(self, DetectorId: str, InvitationId: str, MasterId:...
5,229
1,737
# Copyright 2021 Raven Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
1,218
371
from rest_framework import serializers from .models import * class CollectionSerializer(serializers.ModelSerializer): class Meta: model = Collection fields = ('collectionID', 'name', 'display_name', 'description', 'img_url') class ArtSerializer(serializers.ModelSerializer): img_url = ...
1,475
430
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
2,089
736
import unittest from api import create_app class TestBase(unittest.TestCase): """Default super class for api ver 1 tests""" # setup testing def setUp(self): self.app = create_app('testing') self.client = self.app.test_client() self.item_list = [] # deconstructs test elements ...
398
122
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import SafeString import markdown import urllib register = template.Library() @register.filter def strip_space(value): return value.replace(' ', '') @register.filter @stringfilter def commonmark(value...
865
272
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.CloudbusUserInfo import CloudbusUserInfo class MetroOdItem(object): def __init__(self): self._dest_geo = None self._od = None self._time = None ...
3,234
1,079
# Generated by Django 2.2.4 on 2019-08-10 08:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('djangocms_redirect', '0002_auto_20170321_1807'), ] operations = [ migrations.AddField( model_name='redirect', name='...
910
259
#! /usr/bin/env python import sys import json import urllib import urllib2 import time import argparse import re # Category ID for Discrete Semiconductors > Transistors > BJTs TRANSISTOR_ID = b814751e89ff63d3 def find_total_hits(search_query): """ Function: find_total_hits -------------------- Return...
5,191
1,514
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # FOGLAMP_BEGIN # See: http://foglamp.readthedocs.io/ # FOGLAMP_END """ fogbench -- a Python script used to test FogLAMP. The objective is to simulate payloads for input, REST and other requests against one or more FogLAMP instances. This version of fogbench is meant ...
14,970
5,008
# -*- coding: utf-8 -*- # This code is part of Qiskit. # # (C) Copyright IBM 2019. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modif...
19,888
5,607
#!/usr/bin/python def meh(captcha): """Returns the sum of the digits which match the next one in the captcha input string. >>> meh('1122') 3 >>> meh('1111') 4 >>> meh('1234') 0 >>> meh('91212129') 9 """ result = 0 for n in range(len(captcha)): if captcha[n]...
3,067
2,505
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ Module for graph representations of crystals. """ import copy import logging import os.path import subprocess import warnings from collections import defaultdict, namedtuple from itertools import combinati...
111,660
31,444
from . import image from . import container from . import system
65
16
from django.shortcuts import render, redirect from django.http import HttpResponse from .models import Article from django.contrib.auth.decorators import login_required from . import forms def Articles(request): articles = Article.objects.all().order_by('date') return render(request, 'articles/article_list.htm...
1,064
288
# Parser based on RFC 5228, especially the grammar as defined in section 8. All # references are to sections in RFC 5228 unless stated otherwise. import ply.yacc import sifter.grammar from sifter.grammar.lexer import tokens import sifter.handler import logging __all__ = ('parser',) def parser(**kwargs): return...
5,039
1,810
from sklearn import datasets from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import CountVectorizer from sklearn.cross_validation import train_test_split from sklearn.cross_validation import cross_val_score from sklearn.cross_validation import ShuffleSplit from sklearn....
3,904
1,576
import io import fast import spreadsheet import tab import utils import web from io import * from fast import * from spreadsheet import * from tab import * from utils import * from web import * __all__ = [] __all__.extend(io.__all__) __all__.extend(fast.__all__) __all__.extend(spreadsheet.__all__) __all__.extend(tab....
386
127
# (C) Copyright 2017 Inova Development 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 appl...
26,184
7,041
# # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or # its licensors. # # For complete copyright and license terms please see the LICENSE at the root of this # distribution (the "License"). All use of this software is governed by the License, # or, if provided, by the license below or th...
1,131
347
import os from QUANTAXIS.QASetting import QALocalize #from QUANTAXIS_CRAWLY.run_selenium_alone import (read_east_money_page_zjlx_to_sqllite, open_chrome_driver, close_chrome_dirver) from QUANTAXIS_CRAWLY.run_selenium_alone import * import urllib import pandas as pd import time from QUANTAXIS.QAUtil import (DATABASE) ...
9,057
3,673
#!/usr/bin/env python import logging import sys from app import app as application def setup_flask_logging(): # Log to stdout handler = logging.StreamHandler(sys.stdout) # Log to a file #handler = logging.FileHandler('./application.log') handler.setLevel(logging.INFO) handler.setFormatter(logg...
667
201
#!/usr/bin/env python from game.base.being import Being class Enemy(Being): def __init__(self, app, scene, **kwargs): super().__init__(app, scene, **kwargs) self.friendly = False
202
67
# -*- coding: utf-8 -*- # Generated by Django 1.11.1 on 2017-06-25 15:10 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('rates', '0001_initial'), ] operations = [ migrations.RenameField( model...
561
194
# coding: utf-8 """ Quetzal API Quetzal: an API to manage data files and their associated metadata. OpenAPI spec version: 0.5.0 Contact: support@quetz.al Generated by: https://openapi-generator.tech """ from setuptools import setup, find_packages # noqa: H301 NAME = "quetzal-openapi-client" V...
2,357
777
# coding: utf-8 from __future__ import unicode_literals import re from .adobepass import AdobePassIE from ..compat import compat_str from ..utils import ( fix_xml_ampersands, xpath_text, int_or_none, determine_ext, float_or_none, parse_duration, xpath_attr, update_url_query, Extrac...
11,115
3,307
from alpha_vantage.timeseries import TimeSeries from pprint import pprint import json import argparse def save_dataset(symbol='MSFT', time_window='daily_adj'): credentials = json.load(open('creds.json', 'r')) api_key = credentials['av_api_key'] print(symbol, time_window) ts = TimeSeries(key=api_key, o...
1,188
379
# Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 import fnmatch from io import StringIO import json import os import shutil import zipfile import re from datetime import datetime, timedelta, tzinfo from distutils.util import strtobool import boto3 import placebo from botocore.response imp...
12,570
3,764
from __future__ import unicode_literals, division, absolute_import from builtins import * # noqa pylint: disable=unused-import, redefined-builtin import pytest from flexget.entry import Entry # TODO Add more standard tests class TestNextSeriesSeasonSeasonsPack(object): _config = """ templates: ...
16,865
5,160
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. """ This module define a WulffShape class to generate the Wulff shape from a lattice, a list of indices and their corresponding surface energies, and the total area and volume of the wulff shape,the weighted su...
22,630
7,443
class Any2Int: def __init__(self, min_count: int, include_UNK: bool, include_PAD: bool): self.min_count = min_count self.include_UNK = include_UNK self.include_PAD = include_PAD self.frozen = False self.UNK_i = -1 self.UNK_s = "<UNK>" self.PAD_i = -2 ...
2,721
992
from app import app from flask import Flask, request, jsonify, g import sqlite3 import os import json from random import randint from flask_jwt_extended import jwt_required import datetime from flask_mysqldb import MySQL mysql = MySQL() def get_db(rom): db = getattr(g, '_database', None) if db is None: ...
6,805
2,584