text
string
size
int64
token_count
int64
#coding:utf-8 # # id: bugs.core_2678 # title: Full outer join cannot use available indices (very slow execution) # decription: # tracker_id: CORE-2678 # min_versions: ['3.0'] # versions: 3.0 # qmid: None import pytest from firebird.qa import db_factory, isql_act, Action # version: 3....
1,749
730
from flask import current_app class Category: def __init__(self, id, name, description, thumb): self._id = id self._name = name self._description = description def setId(self, id): self._id = id def getId(self): return self._id def setName(self, name): ...
962
271
"""Test suite for the {{ cookiecutter.project_slug_no_hyphen }} package."""
76
24
# SPDX-License-Identifier: MIT # Copyright (c) 2018-2020 The Pybricks Authors """Pybricks robotics module.""" from _pybricks.robotics import DriveBase
153
64
#!/usr/bin/env python import psycopg2 import time from ..models import User class StorageManager: def __init__(self): self.conn = None self._connect() self._create_table() def _connect(self): while True: try: self.conn = psycopg2.connect( ...
3,693
902
"""Custon color that looks for colors of format `#RRGGBBAA` as `#AARRGGBB`.""" from coloraide.css.colors import Color, SRGB from coloraide.colors import _parse as parse from coloraide import util import copy import re class ASRGB(SRGB): """SRGB that looks for alpha first in hex format.""" MATCH = re.compile(...
2,906
978
import random import jobs import balance from economy import roman_numbers class Earth: def __init__(self): self.current_day = 1 self.main_quest = None self.amount_location = 7 # max 8 self.locations = [] # self.location_names = [] def new_quest(self): ...
2,115
681
from django.db import models from .media import Water from .media import Electricity from .media import Gas from .media import WasteWater from .media import Telecommunication from .generic import Attachment from .generic import Photo from .generic import Location as EstateLocation from cigeo.models import GenericNote ...
2,190
704
import json import ntpath import shutil from pathlib import Path import pickle5 def load_pickle_files_as_data(file_paths): """ Load pickle files containing decision outputs as an data array. :param file_paths: A List of file paths to the individual pickle files. :return: A data array. """ da...
2,328
717
from rest_framework.generics import ListAPIView from rest_framework.permissions import IsAdminUser from goods.models import SPU, SPUSpecification from meiduo_admin.serializers.spus import SPUSimpleSerializer, SPUSpecSerializer class SPUSimpleView(ListAPIView): permission_classes = [IsAdminUser] queryset = S...
747
280
# Hacked by Ry2uko :D import copy import random # Consider using the modules imported above. class Hat: def __init__(self, **balls): self.contents = [] for color in balls: for n in range(0,balls[color]): self.contents.append(color) def draw(self, num): drawn...
1,172
349
import tkinter as tk from tkinter.messagebox import showerror from constants.frames import MAIN_FRAME_NAME from util import add_new_quantity class AddQuantityFrame(tk.Frame): def __init__(self, root, controller): tk.Frame.__init__(self, root) self.controller = controller self.main_label...
1,611
528
from setuptools import setup import versioneer setup(name='gym_pysc2', version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), install_requires=['gym'] # And any other dependencies foo needs )
226
73
import zmq import sys import os import math def loadFiles(path): files = {} dataDir = os.fsencode(path) for file in os.listdir(dataDir): filename = os.fsdecode(file) print("Loading {}".format(filename)) files[filename] = file return files def main(): if len(sys.argv) != 3:...
1,395
438
""" Neighborhood Components Analysis (NCA) Ported to Python from https://github.com/vomjom/nca """ from __future__ import absolute_import import numpy as np from six.moves import xrange from sklearn.utils.validation import check_X_y from .base_metric import BaseMetricLearner EPS = np.finfo(float).eps class NCA(Bas...
1,618
664
# 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...
2,923
915
"""Authors: Cody Baker and Ben Dichter.""" from pathlib import Path import spikeextractors as se from pynwb.ecephys import ElectricalSeries from ..baserecordingextractorinterface import BaseRecordingExtractorInterface from ....utils import get_schema_from_hdmf_class, FilePathType try: from pyintan.intan import r...
4,721
1,292
import os import youtube_dl os.system("setup.bat") playlist = input("Paste the Youtube Playlist URL Here.") track = 1 print("""THIS TOOL WILL ATTEMPT TO DOWNLOAD THE FIRST 1000 SONGS IN THE QUEUE.\n PLEASE DO NOT INTERRUPT THE TOOL. YOU MAY CLOSE THE TOOL WHEN IT DISPLAYS "DONE!". ALL...
739
289
# coding: utf-8 """ manage.py ~~~~~~~~~ """ import os import sys import shutil import platform from app import app from gen import Gen from flask_script import Manager """编码设置""" if (platform.python_version().split('.')[0] == '2'): # reload(sys) is evil :) reload(sys) sys.setdefaultencoding('utf...
1,903
695
from typing import Any import torch import torch.nn as nn from cvmodels.segmentation import unet, deeplab as dl def output(model: nn.Module, input_batch: torch.Tensor) -> Any: model.eval() with torch.no_grad(): return model(input_batch) def numel(m: torch.nn.Module, only_trainable: bool = True) -> ...
3,152
1,154
# Copyright (c) Uber Technologies, Inc. and its affiliates. # Copyright (c) 2021 Kuaishou AI Platform & DS3 Lab. # # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from distutils.version import LooseVersion impor...
10,981
3,272
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import pandas as pd from aif360.datasets import BinaryLabelDataset from aif360.metrics import ClassificationMetric def test_generalized_entropy_inde...
4,046
1,535
city_country = {} for _ in range(int(input())): country, *cities = input().split() for city in cities: city_country[city] = country for _ in range(int(input())): print(city_country[input()])
200
68
import os from dotenv import load_dotenv load_dotenv() basedir = os.path.abspath(os.path.dirname(__file__)) class Config: SECRET_KEY = os.getenv('SECRET_KEY') or os.urandom(32) SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_RECORD_QUERIES = True MAIL_SERVER = os.getenv('MAIL_SERVER') or 'smtp.goog...
1,562
648
import asyncio async def wait_sec(l): print("Before wait") await asyncio.sleep(1) print("After wait") l[0] = False async def main(): # await asyncio.gather(wait_sec([True]), wait_sec([True]), wait_sec([True])) run = [True] asyncio.create_task(wait_sec(run)) await asyncio.sleep(0) ...
998
376
# from vk_bot.core.modules.basicplug import BasicPlug # import math # class Calculator(BasicPlug): # doc = "Калькулятор" # command = ("калькулятор",) # def main(self): # try: # x = self.text[1]; x = int(x) # encalc = self.text[2]; encalc = encalc.lower() # y = sel...
1,438
476
import openmoc import openmoc.log as log import openmoc.plotter as plotter import openmoc.materialize as materialize log.set_log_level('NORMAL') ############################################################################### ########################### Creating Materials ############################ #############...
9,201
3,475
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
22,314
7,672
""" Created on July 20, 2020 Updated on May 19, 2021 model: Product-based Neural Networks for User Response Prediction @author: Ziyao Geng(zggzy1996@163.com) """ import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.regularizers import l2 from tensorflow.keras.layers import Embedding, Dens...
5,279
1,665
nume1 = int(input("Digite um numero")) nume2 = int(input("Digite um numero")) nume3 = int(input("Digite um numero")) nume4 = int(input("Digite um numero")) nume5 = int(input("Digite um numero")) table = [nume1,nume2,nume3,nume4,nume5] tableM = (float((nume1 + nume2 + nume3 + nume4 + nume5))) print(float(tableM))
314
130
from typing import TypeVar from .abstract import AbstractBox T = TypeVar('T') class ValueBox(AbstractBox[T]): _value: T @property def value(self) -> T: return self._value @value.setter def value(self, value: T): self._value = value
274
90
from mongoengine import * class Subject(Document): subject = StringField()
79
21
class Solution: def combinationSum(self, candidates, target): def lookup(candidates, index, target, combine, result): if target == 0: result.append(combine) return if index >= len(candidates) and target > 0: return ...
767
220
#!/usr/bin/env python # -*- coding: utf-8 -*- __doc__ = ''' Crawl comment from nicovideo.jp Usage: crawl_comments.py --url <url> --mail <mail> --pass <pass> [--sqlite <sqlite>] [--csv <csv>] Options: --url <url> --mail <mail> --pass <pass> --sqlite <sqlite> (optional) path of comment DB [d...
1,204
489
# Functions to do the greedy similarity maximisation for article:node assignments # All code is original import random def computeSimSum(G, similarityMatrix, asgn): """ Compute the total similarity sum for the current node:article assignment """ S = sum([similarityMatrix[asgn[j], asgn[i]] for j in ra...
2,095
690
import sys import numpy as np import shutil import time import itertools as it import collections import ctypes as ct import os import copy sys.path.append(os.path.dirname(__file__)) from ThreadStoppable import ThreadStoppable class Idq801(object): def __init__( self, deviceId=-1, timesta...
23,463
7,578
import sys, numpy, argparse, os def loadSamplelist(fin_samples, sample_fin_list, sample_header, sample_name_field, sample_size): for l in open(fin_samples): ls=l.strip() sample_fin_list.append(ls) for r in open(ls): rs=map(lambda x:x.split('/')[-sample_name_field].split('.bam')[0],r.strip().strip(',').split(...
7,472
3,181
# This program reads a file representing web server logs in common log format and streams them into a PubSub topic # with lag characteristics as determined by command-line arguments import argparse from google.cloud import pubsub_v1 import time from datetime import datetime, timezone import random from anytree...
7,444
2,306
"""Database setup""" # Third party library from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate # initialization of the database and migration database = SQLAlchemy() migrate = Migrate()
210
61
import datetime as dt import matplotlib.dates as mdates import matplotlib.pyplot as plt import pandas as pd from powersimdata.input.check import _check_time_series from postreise.analyze.time import change_time_zone def plot_heatmap( series, time_zone=None, time_zone_label=None, title=None, cmap...
4,111
1,411
# Copyright 2018, The TensorFlow Federated 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 applicable law o...
4,000
1,217
from django.contrib import admin from blog.models import Post, Comment # Register your models here. admin.site.register(Post) admin.site.register(Comment)
162
46
from unittest.mock import NonCallableMock, sentinel from pytest import mark, raises, fixture from preacher.compilation.argument import Argument from preacher.compilation.error import CompilationError, NamedNode, IndexedNode from preacher.compilation.request.request import RequestCompiler, RequestCompiled from preache...
6,459
2,013
# imports from telegram.ext import ( CommandHandler, MessageHandler, Filters, ConversationHandler, ) from handler_functions.start import start from handler_functions.bio import bio from handler_functions.gender import gender from handler_functions.photo import photo, skip_photo from handler_functions.lo...
1,109
310
# 英制单位英寸和公制单位厘米互换 value =float(input('请输入长度:')) unit =input('请输入单位:') if unit == 'in' or unit == '英寸': print('%f英寸 = %f厘米' % (value, value * 2.54)) elif unit == '厘米' or unit == 'cm': print('%f 厘米 = %f英寸' % (value, value / 2.54)) else: print('请输入有效的单位')
265
160
from ocean_lib.models.data_token import DataToken from ocean_lib.models.dtfactory import DTFactory from ocean_lib.ocean.util import to_base_18 def test1(network, alice_wallet, dtfactory_address): dtfactory = DTFactory(dtfactory_address) dt_address = dtfactory.createToken('foo_blob', 'DT1', 'DT1', to_base_18(...
485
172
# coding=utf-8 """PyTorch optimization for BERT model.""" from apex.contrib.optimizers import FP16_Optimizer class FP16_Optimizer_State(FP16_Optimizer): def __init__(self, init_optimizer, static_loss_scale=1.0, dynamic_loss_scale=False, dynamic_...
4,223
1,216
from .generator import * from .types import *
46
13
import Bugdetectionuniversalframe import os import re class overflowdetection(Bugdetectionuniversalframe.uniframe): def __init__(self): Bugdetectionuniversalframe.uniframe.__init__(self) def deploy(self):#Re-write deploy method flag=0 self.filesort() if self.path != "": ...
956
272
""" station.py """ from datetime import datetime, timedelta import gzip import numpy as np import requests import urllib _BASEURL = 'http://www.ndbc.noaa.gov/data' _SENSOR_URL = _BASEURL+'/stations/buoyht.txt' _REALTIME_URL = _BASEURL+'/realtime2/' _RECENT_URL = _BASEURL+'/stdmet/' _HISTORICAL_URL = _BASEURL+'/histori...
7,517
2,613
# -*- coding: utf-8 -*- #!/usr/bin/env python __author__ = "Andres Mendez-Vazquez" __copyright__ = "Copyright 2018" __credits__ = ["Andres Mendez-Vazquez"] __license__ = "Apache" __version__ = "v1.0.0" __maintainer__ = "Andres Mendez-Vazquez" __email = "kajuna0kajuna@gmail.com" __status__ = "Development" from data_m...
765
291
# version of the graw package __version__ = "0.1.0"
54
24
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from .. import _utilitie...
6,779
2,077
import numpy as np import matplotlib.pyplot as plt TOTAL = 200 STEP = 0.25 EPS = 0.1 INITIAL_THETA = [9, 14] def func(x): return 0.2 * x + 3 def generate_sample(total=TOTAL): x = 0 while x < total * STEP: yield func(x) + np.random.uniform(-1, 1) * np.random.uniform(2, 8) x += STEP def...
2,688
1,012
import castle from typing import Tuple def select_player_types() -> Tuple[castle.PlayerType, castle.PlayerType]: player1, player2 = None, None while True: print(f'1) Play a person') print(f'2) Play the computer') print(f'3) Play the computer against itself') choice_str = input...
4,103
1,624
#!/usr/bin/env python3 # Copyright 2018 Brocade Communications Systems LLC. 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 also obtain a copy of the License at # http://www.apache.org/licenses/LICENS...
2,603
762
from django.shortcuts import render,redirect,reverse from . import forms,models from django.db.models import Sum from django.contrib.auth.models import Group from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required,user_passes_test from django.conf import settings from djan...
31,078
9,614
import random import numpy as np import itertools import re from collections import defaultdict import os def get_tags(s, open_delim='<', close_delim='/>'): """Iterator to spit out the xml style disfluency tags in a given string. Keyword arguments: s -- input string """ while True: # Sear...
28,322
8,522
from rest_framework.pagination import PageNumberPagination class FavouritePagination(PageNumberPagination): page_size=4
124
38
''' @author Gabriel Flores Checks the primality of an integer. ''' def is_prime(x): ''' Checks the primality of an integer. ''' sqrt = int(x ** (1/2)) for i in range(2, sqrt, 1): if x % i == 0: return False return True def main(): try: print("\n\n") a = int(input(" Enter an integer to check if ...
564
233
#!/usr/bin/env python """Plot the performance of different variants of the string routines for one size. """ import libplot import pylab def plot(records, bytes): records = [x for x in records if x.bytes==bytes] variants = libplot.unique(records, 'variant', prefer='this') functions = libplot.unique(re...
1,580
551
import sqlite3 import time, datetime, random import matplotlib matplotlib.use("Agg") #added due to error, possibly due to install configuration import matplotlib.pyplot as plt print(matplotlib.get_backend()) import matplotlib.dates as mdates from matplotlib import style style.use('fivethirtyeight') conn = sqlite3...
3,292
1,144
import json import os from urllib.parse import parse_qs from urllib.parse import urlparse import pytest import responses from freezegun import freeze_time from jwkest import BadSignature from jwkest.jwk import SYMKey from oic.oauth2.message import MissingSigningKey from oic.oauth2.message import WrongSigningAlgorithm...
42,098
12,928
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import io from codecs import open from setuptools import setup, find_packages def walk_subpkg(name): data_files = [] package_dir = 'cartoframes' for parent, dirs, files in os.walk(os.path.join(package_dir, name)): # Remove package_dir from t...
2,338
873
#!/usr/bin/env python # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. """Run BioSQL tests using MySQL.""" import unittest # Really do want "import *" to get all the test clases: from common_BioSQL ...
1,026
353
# Generated by Django 2.2.6 on 2020-04-05 07:50 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('saraswati', '0003_auto_20200402_1918'), ] operations = [ migrations.AddField( model_name='ritual', name='people_name...
429
160
# Copyright (C) 2015 UCSC Computational Genomics Lab # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
14,709
3,799
from datetime import date import dash import dash_bootstrap_components as dbc import dash_core_components as dcc import dash_html_components as html import pandas as pd import plotly.express as px from dash.dependencies import Input, Output test_data = pd.read_csv("data/world_data.csv") today = date.today() external...
9,819
2,550
from collections import OrderedDict import skimage.io as io from config import get_config config = get_config() class LRUCache: def __init__(self, capacity: int): self._ordered_dict = OrderedDict() self._capacity = capacity def get(self, key): self._move_to_end_if_exist(key) ...
979
321
import numpy from heapq import * import time def heuristic(a, b): return (b[0] - a[0]) ** 2 + (b[1] - a[1]) ** 2 def astar(canvas, array, start, goal): neighbours = [(0, 1), (0, -1), (1, 0), (-1, 0)] close_set = set() came_from = {} gscore = {start: 0} fscore = {start: heuristic(start, goal)...
1,852
591
import logging import time from qupy.framing.slip import Slip from qupy.interface.serial import SerialPort from qupy.interface.errors import InterfaceTimeoutError, InterfaceIOError, InterfaceError from qupy.comm.client import CommClient logging.basicConfig(level=logging.DEBUG) if __name__ == '__main__': s = Se...
1,119
311
import torch from transformers import PreTrainedTokenizerFast from transformers import BartForConditionalGeneration class AbsSummarization(): def __init__(self): self.tokenizer = PreTrainedTokenizerFast.from_pretrained('gogamza/kobart-summarization') self.model = BartForConditionalGeneration.from_pretrained('gog...
699
245
# -*- coding: utf-8 -*- import tempfile from dp_tornado.engine.helper import Helper as dpHelper class ImageHelper(dpHelper): def compare(self, i1, i2, error=0): i1 = self.load(i1) i2 = self.load(i2) if not i1 or not i2: return None s1 = i1.size s2 = i2.size...
12,413
3,556
import requests from bs4 import BeautifulSoup import json import re # Range of Roll Number - User Input start_roll = int(input("Starting Roll Number: ")) end_roll = int(input("Ending Roll Number: ")) # Semester - User Input sem = int(input("Which Semester[1-8]: ")) # Verbosity verbose = int(input("Verbo...
4,385
1,714
#!/usr/bin/env python __author__ = "Adeel Ahmad" __email__ = "adeelahmad14@hotmail.com" __status__ = "Production" import matplotlib.pyplot as plt import numpy as np import skimage as ski import Image def cartoonify(im, display=False): """ function receives an image and add its gradient magnitude in it and add it ...
1,411
667
from dataclasses import dataclass import json import re @dataclass class KeyMapper(dict): """ Example: km = KeyMapper({'messages': {'message1': 'Hello World!'}}}) print(km['messages.message1']) Variables: __delimiter__ is set to dot-notation by default, unless specified otherwise. ...
4,341
1,186
# -*- coding: utf-8 -*- """Demo37_PythonforDataScience.ipynb # PYTHON FOR DATA SCIENCE We will take our python programming skills a step further and process large data in it. Python is an excellent language for deployment. Hence we will be using open source data during the learning process!! This will make sure we un...
3,401
1,335
# Copyright 2017 QuantRocket - 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 ...
4,401
1,308
from ink2canvas.lib.simpletransform import parseTransform class GradientHelper(object): def __init__(self, abstractShape): self.abstractShape = abstractShape def hasGradient(self, key): style = self.abstractShape.getStyle() if key in style: styleParamate...
3,889
1,100
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Kay management script. :Copyright: (c) 2009 Accense Technology, Inc. All rights reserved. :license: BSD, see LICENSE for more details. """ import sys import os import logging sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path import kay kay.setup_en...
529
198
from pymicro.crystal.microstructure import * from pymicro.crystal.texture import * from pymicro.examples import PYMICRO_EXAMPLES_DATA_DIR from matplotlib import pyplot as plt, colors, colorbar, cm import pathlib as pl '''This example demonstrate how a field can be used to color each symbol on the pole figure with th...
1,624
662
import time import sys import os import numpy as np import torch import torch.nn as nn import torchvision.models as models from torch.nn.utils.rnn import pack_padded_sequence from model.base_torch import BaseModel from model.utils.general import init_dir, get_logger from model.utils.general import Progb...
11,634
3,632
#!/usr/bin/python # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. """This entry point runs all script tests.""" import logging.config import unittest if ...
719
227
""" 11367. Report Card Time 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 64 ms 해결 날짜: 2020년 9월 18일 """ def main(): for _ in range(int(input())): name, score = input().split() score = int(score) if score < 60: grade = 'F' elif score < 67: grade = 'D' elif score < 70:...
623
282
from __future__ import print_function, division, absolute_import import copy import numpy as np import skimage.draw import skimage.measure from .. import imgaug as ia from .utils import normalize_shape, project_coords # TODO functions: square(), to_aspect_ratio(), contains_point() class BoundingBox(object): ""...
49,691
14,672
#!/usr/bin/env python from twisted.internet import endpoints from twisted.internet import protocol from twisted.internet import defer from twisted.mail import imap4 from scanner_relay.pipeline import Pipeline from scanner_relay.authentication import PassStoreFetcher, PlainPasswordFetcher import logging # Global con...
2,891
822
""" Created by akiselev on 2019-06-14 There is a horizontal row of cubes. The length of each cube is given. You need to create a new vertical pile of cubes. The new pile should follow these directions: if is on top of then . When stacking the cubes, you can only pick up either the leftmost or the rightmost cube ...
1,202
399
# # # File: flask_web_py3.py # # # import os import json import redis import urllib import flask from flask import Flask from flask import render_template,jsonify from flask_httpauth import HTTPDigestAuth from flask import request, session, url_for from redis_support_py3.graph_query_support_py3 impo...
14,674
4,808
import os import logging from typing import Optional import click from git_talk.lib.changelog import generate_changelog from git_talk.lib.changelog.presenter import MarkdownPresenter from git_talk.lib.changelog.repository import GitRepository # @click.command() # @click.option( # "-r", # ...
4,160
1,364
# Copyright (c) Stanford University # # This source code is patent protected and being made available under the # terms explained in the ../LICENSE-Academic and ../LICENSE-GOV files. # Author: Mario J Srouji # Email: msrouji@stanford.edu import copy import sys sys.path.append("../FormatParsers/") sys.path.append("../...
6,429
1,973
import tensorflow as tf def _smooth_l1_loss(y_true, y_pred): t = tf.abs(y_pred - y_true) return tf.where(t < 1, 0.5 * t ** 2, t - 0.5) def MultiBoxLoss(num_class=2, neg_pos_ratio=3): """multi-box loss""" def multi_box_loss(y_true, y_pred): num_batch = tf.shape(y_true)[0] num_prior = ...
3,624
1,341
import unittest import random from time import sleep import os from bingmaps import * class BingMapsTestError(Exception): """Bing Maps test exception""" def __init__(self, reason): self.reason = unicode(reason) def __str__(self): return self.reason # TODO: enter your key for testing api...
2,416
826
from cds.CloudflareWrapper import suggest_set_up, cf_config_filename from .FirewallWrapper import FirewallWrapper import logging as log def open_web_if_webserver_running(): fw = FirewallWrapper() from .utils import is_process_running, query_yes_no webserver_running = is_process_running('nginx') if web...
1,153
346
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2019-10-24 16:07 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('awardapp', '0003_auto_20191024_1606'), ] operations = [ migrations.AlterField...
450
167
# -*- coding: utf-8 -*- # cython: language_level=3 # Copyright (c) 2020 Nekokatt # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights...
21,395
6,614
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
8,649
2,391
# Saul Castro # Hiralben Hirpara # config file format import random def openFile(): file = open("test.txt", 'r') return file def printFile(f): print(f.read()) def readInput(): testout = "CarpenteRatcheThread" file = open("test.txt", 'r') s = str(file.read()) words = s.split(" "); ...
3,911
1,382
from global_utils import * # target word TARGET_WORD = 'right' def display_lowpass_normal(wav, lowpass_signal, fs, label=''): fig, (axs_raw, axs_low) = plt.subplots(2) fig.tight_layout(pad=3.0) fig.set_figheight(FIG_HEIGHT) fig.set_figwidth(FIG_WIDTH) # display the plot axs_raw.plot(wav) ...
2,646
1,022
# Copyright 2019 Quantapix 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 l...
2,010
559
import pygame, sys, random, time from pygame.locals import * class Missile: def __init__(self, screen, x): # Store the data. Initialize: y to 591 and exploded to False. self.screen = screen self.x = x self.y = 591 self.exploded = False def move(self): # ...
6,636
2,207