text
string
size
int64
token_count
int64
# Copyright 2018 The TensorFlow 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 applica...
7,766
2,402
from meerk40t.core.cutcode import CutCode, RawCut from meerk40t.core.parameters import Parameters from meerk40t.core.units import UNITS_PER_MIL from meerk40t.kernel import Module from meerk40t.numpath import Numpath from meerk40t.svgelements import Color class LihuiyuEmulator(Module): def __init__(self, context, ...
16,979
4,983
# -*- coding: utf8 -*- # Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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...
105,704
38,568
# Ported to Python 3 # Originally from https://github.com/DeprecatedCode/oauth2lib/blob/d161b010f8a596826050a09e5e94d59443cc12d9/oauth2lib/provider.py import json import logging from requests import Response from io import StringIO try: from werkzeug.exceptions import Unauthorized except ImportError: Unauthor...
20,152
5,433
from model import ImageCluster m=ImageCluster( base_model='vgg16',#your feature map extractor model resorted_img_folder='resorted_data',#the folder for clustered images cluster_algo='kmeans',#cluster algorithm base_img_folder='data', maxK=150,#the max k num is 30, which means ImageCluster calculates...
773
261
# Copyright (c) 2021 GradsFlow. 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 ...
1,058
344
from Jumpscale import j JSBASE = j.baseclasses.object from .ExecutorBase import * import serial class ExecutorSerial(ExecutorBase): """ This executor is primary made to communicate with devices (routers, switch, ...) over console cable but you can use underlaying method to communicate with any serial de...
2,330
715
# Copyright MelisaDev 2022 - Present # Full MIT License can be found in `LICENSE.txt` at the project root. from __future__ import annotations class Snowflake(int): """ Discord utilizes Twitter's snowflake format for uniquely identifiable descriptors (IDs). These IDs are guaranteed to be unique across all...
2,201
704
"""Classes derived from the Feedgen extension classes.""" from typing import Dict, List, Optional from lxml import etree from lxml.etree import Element from flask import current_app from feedgen.ext.base import BaseEntryExtension, BaseExtension from feed.domain import Author, Media class ArxivExtension(BaseExtensio...
8,749
2,364
from abc import ABC from pathlib import Path from typing import Any from dataclasses import dataclass from test_infra import consts from test_infra.utils.global_variables import GlobalVariables from .base_config import _BaseConfig global_variables = GlobalVariables() @dataclass class BaseNodeConfig(_BaseConfig, AB...
1,132
356
# MemPool.py # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import logging from lib.serialize import uint256_to_shortstr class MemPool(object): def __init__(self): self.pool = {} # setup logging logging.basicConfi...
952
383
''' Created on Jun 13, 2019 @author: sarvi ''' from sly import Parser from .lexer import BashLexer class ASTCommands(list): __slots__ = ('grouping') def __init__(self, command, grouping=None): self.append(command) self.grouping = grouping def __repr__(self): x=[str(i) for i in s...
13,530
4,482
import datetime def print_header(): print('----------------------------') print(' Due Date APP ') print('----------------------------') print() def get_lmp_from_patient(): print("When was the patient's last normal menstrual cycle? ") date_str = input('Format: [dd/mm/yyyy}') ...
1,555
558
from django import forms from django.core.validators import MinValueValidator, MinLengthValidator class OriginForm(forms.Form): origin_address = forms.CharField(validators=[MinLengthValidator(1)], widget=forms.TextInput(attrs={'class': 'form-control', 'id': 'inlineFormInputGroup', 'placeholder': '123 Tech St, Sili...
1,471
472
import bili_statistics from reqs.storm_raffle_handler import StormRaffleHandlerReq from tasks.utils import UtilsTask from .base_class import Forced, DontWait, Multi class StormRaffleJoinTask(Forced, DontWait, Multi): TASK_NAME = 'join_storm_raffle' # 为了速度,有时不用等room_id验证就参加,置room_id为0,is_normal_room自然会返回固定值tr...
1,940
746
import theano import theano.tensor as T import treeano import treeano.nodes as tn fX = theano.config.floatX @treeano.register_node("grad_net_interpolation") class GradNetInterpolationNode(treeano.NodeImpl): """ interpolates outputs between 2 nodes """ hyperparameter_names = ("late_gate",) chil...
4,767
1,359
import gzip #pragma: no cover import bz2 #pragma: no cover import lzma #pragma: no cover class RawFile(object):#pragma: no cover def __init__(self,filename): self.filename = filename if filename.endswith('.gz'): self.handle = gzip.open(filename,'rt') elif filename.endsw...
662
207
# -*- coding: utf-8 -*- import os class BaseConf(object): HEADERS = { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/55.0.2883.95 " "Safari/537.36", "Accept": "tex...
846
347
# -*- coding: utf-8 -*- import functools import httplib as http import markupsafe from django.core.paginator import Paginator from django.db.models import Q, QuerySet from framework.exceptions import HTTPError def get_or_http_error(Model, pk_or_query, allow_deleted=False, display_name=None): """Load an instance ...
4,724
1,407
# -*- coding: utf-8 -*- # # Copyright (c) 2016, deepsense.io # # 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...
2,886
826
from adafruit_hid.keyboard import Keyboard from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS from adafruit_hid.keycode import Keycode import usb_hid import time class HumanKeyboard(object): def __init__(self): self.keyboard = Keyboard(usb_hid.devices) self.keyboardLayout = KeyboardLayou...
626
200
from src.base.solution import Solution from src.tests.part2.q104_test_max_bi_tree_depth import MaxBiTreeDepthTestCases class MaxBiTreeDepth(Solution): def gen_test_cases(self): return MaxBiTreeDepthTestCases() def run_test(self, input): return self.maxDepth(input) def maxDepth(self, root...
579
204
from django.contrib import admin from . import models class SupplierAdmin(admin.ModelAdmin): list_display = ('supplier_name', 'contact', ) search_fields = ['supplier_name', 'contact', ] admin.site.register(models.Suppliers, SupplierAdmin) class InventoryUserAdmin(admin.ModelAdmin): list_display = ('empl...
771
241
try: name = "" except: pass else: print na<ref>me
55
25
import requests class ByteSession(object): def __init__(self, token, providedSession=False): self._userToken = token if providedSession == False: self._session = requests.session() else: self._session = providedSession self._session.headers = { ...
500
148
# -*- coding: utf-8 -*- """ Description of example """ import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui, mkQApp import numpy as np app = mkQApp() # win.setWindowTitle('pyqtgraph example: ____') if __name__ == '__main__': pg.exec()
252
97
''' Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this ...
73,328
22,637
# -*- encoding: utf-8 -*- import multiprocessing as mp import time from pudb.remote import set_trace def worker(worker_id): """ Simple worker process""" i = 0 while i < 10: if worker_id == 1: # debug process with id 1 set_trace(term_size=(80, 24)) time.sleep(1) # represents ...
642
227
""" Test calling user defined functions using expression evaluation. This test checks that typesystem lookup works correctly for typedefs of untagged structures. Ticket: https://llvm.org/bugs/show_bug.cgi?id=26790 """ from __future__ import print_function import lldb from lldbsuite.test.decorators import * from lld...
1,317
426
from PIL import Image, ImageEnhance user_account_name = "Thomas.Li26" def main(): mode = input("Specify image editing mode. Type DEEPFRY, STRETCH, BRIGHTNESS, SHARPEN, or INVERT: ") if mode == "DEEPFRY": DEEPFRY() if mode == "STRETCH": STRETCH() if mode == "INVERT": ...
2,486
905
# Curbrock Summon 2 CURBROCK2 = 9400930 # MOD ID CURBROCKS_ESCAPE_ROUTE_VER2 = 600050040 # MAP ID CURBROCKS_ESCAPE_ROUTE_VER3 = 600050050 # MAP ID 2 sm.spawnMob(CURBROCK2, 190, -208, False) sm.createClock(1800) sm.addEvent(sm.invokeAfterDelay(1800000, "warp", CURBROCKS_ESCAPE_ROUTE_VER3, 0)) sm.waitForMobDeath(CURBRO...
377
224
""" Cancelling jobs on the University cluster forces programs to instantly quit, which sometimes crashes cluster nodes. As a remedy, this killswitch listener will stop the experiment in a nicer way to prevent this from happening. The experiment will be stopped if a file named "stop" is encountered i...
786
201
from rest_framework import status from rest_framework.generics import ( RetrieveUpdateAPIView, CreateAPIView, RetrieveUpdateDestroyAPIView ) from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.response import Response from rest_framework.views import APIView from ..authenticatio...
2,255
570
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Implements a frozen dictionary-like object""" import collections import copy import common.memo as memo class frozendict(collections.Mapping): """A f...
1,882
588
__version__ = '5.0.2'
22
13
from neurecon.reconstruction import reconstruct
50
15
def solution(string): return string[::-1]
46
16
# -*- coding: utf-8 -*- """Utilities common to CIFAR10 and CIFAR100 datasets. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import sys from six.moves import cPickle def load_batch(fpath, label_key='labels'): """Internal utility for parsing CIFAR ...
965
322
def getNumBags(color): if color=='': return 0 numBags=1 for bag in rules[color]: numBags+=bag[1]*getNumBags(bag[0]) return numBags with open('day7/input.txt') as f: rules=dict([l.split(' contain') for l in f.read().replace(' bags', '').replace(' bag', '').replace('.', '').replace(' ...
523
192
from core.advbase import * from slot.d import * def module(): return Luther class Luther(Adv): a1 = ('cc',0.10,'hit15') conf = {} conf ['slots.d'] = Leviathan() conf['acl'] = """ `dragon `s1 `s2, seq=5 and cancel `s3, seq=5 and cancel or fsc `fs, seq=5 ...
471
181
import hashlib from io import BytesIO import logging import os from typing import Any, cast, Dict, List, Optional, Sequence, Type, TYPE_CHECKING, Union from pkg_resources import parse_version import wandb from wandb import util from ._private import MEDIA_TMP from .base_types.media import BatchableMedia, Media from ....
21,646
6,450
import datetime # Gets time from milliseconds # Returns string formatted as HH:MM:SS:mmm, MM:SS:mmm or S:mmm, depending on the time. def get_time_from_milliseconds(milli): milliseconds = milli % 1000 seconds= (milli//1000)%60 minutes= (milli//(1000*60))%60 hours= (milli//(1000*60*60))%24 if hours...
669
270
#!/usr/bin/env python """Pi digits example Example shows arbitrary precision using mpmath with the computation of the digits of pi. """ from mpmath import libmp, pi from mpmath import functions as mpf_funs import math from time import clock import sys def display_fraction(digits, skip=0, colwidth=10, columns=5): ...
2,721
939
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-03-13 00:16 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion import mailauth.models import uuid class Migration(migrations.Migration): dependencies = [ ...
1,272
386
# Copyright 2013 IBM Corp. # # 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 wri...
10,580
3,464
import SimpleXMLRPCServer import sys import logging from K8055Controller import K8055Controller logging.basicConfig() controller_log = logging.getLogger("Controller") class Controller: def __init__(self): self.k8055 = K8055Controller() controller_log.debug("initialized") def reset(s...
1,018
358
from .crnn import CRNN from .crnn import CRNN_Attention
55
19
import nltk import re import sys from sys import argv from nltk.sentiment.vader import SentimentIntensityAnalyzer def ajay(ans): ajay = SentimentIntensityAnalyzer() completeScore = 0 questionWeights = [0.05, 0.20, 0.05, 0.05, 0.05, 0.20, 0.05, 0.05, 0.20, 0.10] print ans ansList = ans.split("$") ...
3,206
878
# vim: set filetype=python ts=4 sw=4 # -*- coding: utf-8 -*- """This module retrieves AWS credentials after authenticating with Okta.""" from __future__ import absolute_import, division, print_function, unicode_literals import logging from future import standard_library from tokendito import aws_helpers from tokendit...
1,487
452
from . import rest from . import helpers
42
13
import io import codecs import tarfile import re import gzip import xml.etree.ElementTree as ET from fnmatch import fnmatch from pathlib import Path from typing import NamedTuple import ir_datasets from ir_datasets.indices import PickleLz4FullStore from .base import GenericDoc, GenericQuery, GenericScoredDoc, BaseDocs,...
15,833
4,770
#!/usr/bin/env python # -*- coding: utf-8 -*- from .utils import download_from_yaml def download(output_dir: str, snippet_only: bool, ignore_cache: bool = False) -> None: """Downloads data files from list of URLs (default: download.yaml) into data directory (default: data/). Args: output_dir: A str...
844
234
#!/usr/bin/python # (c) 2020, NetApp, Inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ''' na_ontap_autosupport_invoke ''' from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = { 'metadata_version': '1.1', 's...
6,770
2,062
from freight.api.serializer import serialize from freight.testutils import TestCase class UserSerializerTest(TestCase): def test_simple(self): user = self.create_user() result = serialize(user) assert result["id"] == str(user.id) assert result["name"] == user.name
304
86
import sys import numpy as np from matplotlib import pyplot as pl from rw import WriteGTiff fn = '../pozo-steep-vegetated-pcl.npy' pts = np.load(fn) x, y, z, c = pts[:, 0], pts[:, 1], pts[:, 2], pts[:, 5] ix = (0.2 * (x - x.min())).astype('int') iy = (0.2 * (y - y.min())).astype('int') shape = (100, 100) xb = np.aran...
1,639
776
# comtypes._meta helper module from ctypes import POINTER, c_void_p, cast import comtypes ################################################################ # metaclass for CoClass (in comtypes/__init__.py) def _wrap_coclass(self): # We are an IUnknown pointer, represented as a c_void_p instance, # but...
2,228
730
################################################################################ ## ## 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 of the License, or (at your op...
33,321
9,800
#!/usr/bin/env python ############################################################################ # # Copyright (C) 2016 The Qt Company Ltd. # Contact: https://www.qt.io/licensing/ # # This file is part of Qt Creator. # # Commercial License Usage # Licensees holding valid commercial Qt licenses may use this file in #...
3,560
1,042
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import json import os import torch model_params_subdir = "ModelParameters" optimizer_params_subdir = "OptimizerParameters" latent_codes_subdir = "LatentCodes" logs_filename = "Logs.pth" reconstructions_subdir = "Reconstructions" reconstruc...
5,190
1,722
from EmoPy.src.fermodel import FERModel from EmoPy.src.directory_data_loader import DirectoryDataLoader from EmoPy.src.csv_data_loader import CSVDataLoader from EmoPy.src.data_generator import DataGenerator from EmoPy.src.neuralnets import ConvolutionalNNDropout from sklearn.model_selection import train_test_split impo...
1,571
487
from jinja2 import nodes from jinja2.ext import Extension class TestExtension(Extension): tags = {'test_ext'} def parse(self, parser): return nodes.Const("This is test extension")
189
56
#!/usr/bin/env python3 ################################################################################ # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"),...
45,622
14,943
# # Copyright (c) 2015-2019 Thierry Florac <tflorac AT ulthar.net> # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRAN...
799
306
import os import pytest import torch from hivemind import RemoteExpert from hivemind.moe.server import background_server CUSTOM_EXPERTS_PATH = os.path.join(os.path.dirname(__file__), "test_utils", "custom_networks.py") @pytest.mark.forked def test_custom_expert(hid_dim=16): with background_server( expe...
1,811
612
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = "Ringo" ''' 价格动量 策略 (难度:初级) 参考: https://www.shinnytech.com/blog/momentum-strategy/ 注: 该示例策略仅用于功能示范, 实盘时请根据自己的策略/经验进行修改 ''' from tqsdk import TqAccount, TqApi, TargetPosTask # 设置指定合约,获取N条K线计算价格动量 SYMBOL = "SHFE.au1912" N = 15 api = TqApi() klines = api.get_...
1,639
919
# import the necessary packages import numpy as np import cv2 import imutils def color_transfer(source, target, clip=True, preserve_paper=True): """ Transfers the color distribution from the source to the target image using the mean and standard deviations of the L*a*b* color space. This implemen...
10,323
3,518
from Library.CreateATree import CreateATree tree = CreateATree.BinarySearchTree() nodesList = list((4, 5, 1, 3, 2)) for i in range(0, len(nodesList)): tree.insert(nodesList[i]) #tree.printInorder() tree.printPreorder() #tree.printPostorder()
250
94
# # VAZ Projects # # # Author: Marcelo Tellier Sartori Vaz <marcelotsvaz@gmail.com> from django.urls import path from . import views app_name = 'siteApp' urlpatterns = [ path( '', views.Home.as_view(), name = 'home' ), path( 'about-me', views.About_me.as_view(), name = 'about_me' ), path( 'searc...
522
233
class SVDError(Exception): """Generic errors.""" pass
63
21
''' @author Tomáš Keske @since 10.8.2019 ''' import sys from jnius import autoclass from Conf.Conf import * class ServiceBase(): def __init__(self): PythonServiceClass = autoclass('org.kivy.android.PythonService') self.Context = autoclass('android.content.Context') self.Service = Python...
1,286
373
# api/queue/__init__.py import os from flask import Flask from flask_bootstrap import Bootstrap # instantiate the extensions bootstrap = Bootstrap() def create_app(script_info=None): # instantiate the app app = Flask( __name__, template_folder="../client/templates", static_folder=...
723
222
import adblock import pytest SMALL_FILTER_LIST = """ ||wikipedia.org^ ||old.reddit.com^ ||lobste.rs^ """ def empty_engine(): return adblock.Engine(adblock.FilterSet()) def test_engine_creation_and_blocking(): filter_set = adblock.FilterSet(debug=True) filter_set.add_filter_list(SMALL_FILTER_LIST) e...
2,183
705
from rest_framework.routers import SimpleRouter from .views.upgrade_notice import UpgradeNoticeViewSet router = SimpleRouter(trailing_slash=False) router.register('upgrade_notice', UpgradeNoticeViewSet, basename='upgrade_notice')
232
71
''' Largest rectangle area in a histogram:: Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity, assume that all bars have same width and the width is 1 unit. ''' def max_area_histogram(histogram): stack = list()...
1,048
363
# -*- coding: utf-8 -*- """ pbkdf2_ctypes ~~~~~~ Fast pbkdf2. This module implements pbkdf2 for Python using crypto lib from openssl or commoncrypto. Note: This module is intended as a plugin replacement of pbkdf2.py by Armin Ronacher. Git repository: $ git clone https://github.c...
7,448
2,588
import sys import os import psycopg2 import base64 from cryptography.hazmat.primitives import serialization, hashes from cryptography.hazmat.primitives.asymmetric import padding, rsa from cryptography.hazmat.backends import default_backend import time if len(sys.argv) < 2: print("Please enter either create or rem...
2,389
703
# Copyright David Abrahams 2004. Distributed under the Boost # Software License, Version 1.0. (See accompanying # file LICENSE.txt or copy at https://www.bfgroup.xyz/b2/LICENSE.txt) from b2.build import type def register (): type.register_type ('OBJ', ['obj'], None, ['NT', 'CYGWIN']) type.register_type ('OBJ'...
342
125
"""Tests for square-free decomposition algorithms and related tools. """ from sympy.polys.rings import ring from sympy.polys.domains import FF, ZZ, QQ from sympy.polys.polyclasses import DMP from sympy.polys.specialpolys import f_polys from sympy.utilities.pytest import raises f_0, f_1, f_2, f_3, f_4, f_5, f_6 = f_p...
4,465
2,444
import enum from typing import Union @enum.unique class PPT(enum.Enum): # Source: https://docs.microsoft.com/en-us/office/vba/api/powerpoint.ppsaveasfiletype AnimatedGIF = 40 BMP = 19 Default = 11 EMF = 23 External = 64000 GIF = 16 JPG = 17 META = 15 MP4 = 39 OpenPresentati...
1,377
572
# Generated by Django 4.0.1 on 2022-01-19 23:58 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('news', '0001_initial'), ] operations = [ migrations.AddField( model_name='movies', name='year', field=mo...
378
130
import panel as pn import param from awesome_panel_extensions.frameworks.fast import FastTemplate, FastTextInput WIDGETS = { "some_text": {"type": FastTextInput, "readonly": True, "sizing_mode": "fixed", "width": 400} } class ParameterizedApp(param.Parameterized): some_text = param.String(default="This is s...
653
206
# -*- coding: utf-8 -*- import pymysql import sys, os, json, time, pymongo app_dir = os.path.abspath("../") sys.path.append(app_dir) from gjqyxyxxcxxt import settings from gjqyxyxxcxxt.database.my_redis import QueueRedis conn = None def connect_db(): global conn conn = pymysql.connect(host="172.16.16.15",port...
1,271
487
#main_section > lines > line > text #main_section > lines > line > sub_line > text #main_section > sub_sections #main_section > templates > type #main_section > templates > empty_values #main_section > templates > values #main_section > templates > sub_templates #main_section > title > line > text from transformers.mod...
86,132
47,879
# Importing section import json import requests import argparse import hashlib import time from http import HTTPStatus # Main if __name__ == "__main__": arg_parser = argparse.ArgumentParser() args = arg_parser.parse_args() set_cmd = 'updateSla' params = { 'idx': 'sla04', ...
1,019
368
def sort(arr): # Start index 0. start = 0 # End index end = len(arr)-1 while start <= end: # Swap all positive value with last index end & decrease end by 1. if arr[start] >= 0: arr[start], arr[end] = arr[end], arr[start] end -= 1 else: # ...
498
182
import json def __text_from_anchor_sents_file(anchor_sents_file, output_file): f = open(anchor_sents_file, encoding='utf-8') fout = open(output_file, 'w', encoding='utf-8', newline='\n') for i, line in enumerate(f): sent = json.loads(line) fout.write('{}\n'.format(sent['tokens'])) ...
1,199
486
""" Test harness for smp.py """ import sys import os sys.path.append('/Users/ptendick/open-source-workspace/cannr Image/source/cannr/lib') os.environ['PATH'] = '/Library/Frameworks/Python.framework/Versions/3.7/bin:' + os.environ['PATH'] import cannr import smp # Test openProcess by opening a Flask process def test_o...
1,106
379
import tensorflow as tf import tensorflow.contrib.slim as slim import tensorflow.contrib.slim.python.slim.nets.resnet_v1 as resnet_v1 import tensorflow.contrib.slim.python.slim.nets.inception_v1 as inception_v1 import tensorflow.contrib.slim.python.slim.nets.resnet_utils as slim_utils from tensorflow.contrib import l...
2,833
973
""" Checkpoint Saver Track top-n training checkpoints and maintain recovery checkpoints on specified intervals. Hacked together by / Copyright 2020 Ross Wightman """ import glob import operator import os import logging import torch from .model import unwrap_model, get_state_dict _logger = logging.getLogger(__nam...
6,133
1,833
# AGC004a def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**6) a, b, c = map(int, input().split()) if a % 2 == 0 or b % 2 == 0 or c % 2 == 0: print(0) exit(0) print(min(a*b, b*c, c*a)) if __name__ == '__main__': main()
292
134
# Copyright 2012 OpenStack Foundation # 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 requ...
12,603
4,079
# Copyright 2016 Quora, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
13,664
3,979
""" The Galaxy web application framework """ from .framework import url_for from .framework.base import httpexceptions from .framework.decorators import ( do_not_cache, error, expose, expose_api, expose_api_anonymous, expose_api_anonymous_and_sessionless, expose_api_raw, expose_api_raw_...
1,108
383
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from abc import ABCMeta, abstractmethod from pathlib import Path from textwrap import dedent from typing import ClassVar, Iterable, List, Optional, Tuple, Type from pants.core.goals.check...
6,318
1,853
import os import random from typing import Any, Dict, List, Union import numpy as np import torch from colorama import Fore, Style from sklearn.metrics import f1_score from sklearn.metrics import precision_recall_fscore_support as score from sklearn.metrics import precision_score, recall_score def highlight(input_: ...
9,851
3,403
# Copyright (C) 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
11,463
2,898
# Copyright (c) 2010-2012 OpenStack Foundation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
33,549
10,213
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension """ import torch.nn as n...
10,138
3,181
# coding=utf8 ''' Created on 29 Oct 2013 @author: Nicolas Poirey ''' from Worker import Worker from Phase import Phase class Assignment(object): ''' Classe Assignment définissant une affectation attributs publics : - num : l'id de l'affectation (int) - worker : l'ouvrier de l'affectation (Wor...
4,665
1,596
from binascii import hexlify from functools import wraps from logging import error from os import urandom from random import randint from flask import make_response from flask import render_template from werkzeug.exceptions import BadRequest from werkzeug.exceptions import Forbidden from werkzeug.exceptions import Gon...
2,257
716