text
string
size
int64
token_count
int64
import logging from phore.framework import tester, validatornode, shardnode from phore.pb import common_pb2 class ShardSyncTest(tester.Tester): def __init__(self): logging.info(logging.INFO) super().__init__() def _do_run(self): beacon_nodes = [self.create_beacon_node() for _ in ran...
1,327
493
#! /usr/bin/env python # # vim: ts=2 sw=2 et # import sys #from wx.py.crust import Display inchpm=39.3700 dpi=100 if len(sys.argv) >1: dpi=int(sys.argv[1]) displaympp=1/(float(dpi)*inchpm) print "display mpp=%f"%(displaympp) mpp= 20037508.342789244 * 2 / 256 print "Level : mpp \t\t: scale" for i in ra...
426
237
x = input("Enter sentence: ") count={"Uppercase":0, "Lowercase":0} for i in x: if i.isupper(): count["Uppercase"]+=1 elif i.islower(): count["Lowercase"]+=1 else: pass print ("There is:", count["Uppercase"], "uppercases.") print ("There is:", count["Lowercase"], "lowercases.")
314
105
from pathlib import Path from smarts.sstudio import gen_scenario from smarts.sstudio import types as t traffic = t.Traffic( flows=[ t.Flow( route=t.RandomRoute(), rate=60 * 60, actors={t.TrafficActor(name="car", vehicle_type=vehicle_type): 1}, ) for vehi...
684
217
import inspect import os from collections import Callable from asyncorm.application.configure import get_model from asyncorm.exceptions import AsyncOrmFieldError, AsyncOrmModelDoesNotExist, AsyncOrmModelError from asyncorm.manager import ModelManager from asyncorm.models.fields import AutoField, Field, ForeignKey, Man...
13,196
3,821
""" TODO: """ import time import logging import os from os.path import join import sys import configparser import threading import argparse from . import methods from . import args from . import focus # Global int to track # of errors d...
74,222
21,278
input = """ f(X,1) :- a(X,Y), g(A,X),g(B,X), not f(1,X). a(X,Y) :- g(X,0),g(Y,0). g(x1,0). g(x2,0). """ output = """ f(X,1) :- a(X,Y), g(A,X),g(B,X), not f(1,X). a(X,Y) :- g(X,0),g(Y,0). g(x1,0). g(x2,0). """
273
185
# Copyright (c) 2016, Frederik Hermans, Liam McNamara # # This file is part of FOCUS and is licensed under the 3-clause BSD license. # The full license can be found in the file COPYING. import cPickle as pickle import sys import click import imageframer import numpy as np import rscode import focus def _grayscale(...
5,100
1,576
import logging from typing import Sequence import numpy as np from calc.optimize import root class Bond(object): """ Represents a coupon paying bond. Upon creation, the time to maturity, coupon periods per year, coupon rate must be provided. If yield to maturity is provided, bond value would be igno...
6,444
2,127
# # Jasy - Web Tooling Framework # Copyright 2010-2012 Zynga Inc. # Copyright 2013-2014 Sebastian Werner # import os import jasy import jasy.core.Console as Console from jasy.item.Script import ScriptError from jasy.item.Script import ScriptItem import jasy.script.Resolver as ScriptResolver from jasy.script.Resolve...
9,074
2,406
file = open("13") sum = 0 for numbers in file: #print(numbers.rstrip()) numbers = int(numbers) sum += numbers; print(sum) sum = str(sum) print(sum[:10])
171
70
# 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...
25,033
7,957
from sklearn.model_selection import cross_val_score, GridSearchCV, cross_validate, train_test_split from sklearn.metrics import accuracy_score, classification_report from sklearn.neural_network import MLPClassifier import pandas as pd import csv from sklearn.preprocessing import label_binarize from sklearn.preprocessi...
1,581
620
import matplotlib.pyplt as plt from bermuda import ellipse, polygon, rectangle plt.plot([1,2,3], [2,3,4]) ax = plg.gca() # default choices for everything e = ellipse(ax) # custom position, genric interface for all shapes e = ellipse(ax, bbox = (x, y, w, h, theta)) e = ellipse(ax, cen=(x, y), width=w, height=h, the...
711
285
from sqlalchemy.orm.exc import NoResultFound from porthole.app import Session from .logger import PortholeLogger from porthole.models import AutomatedReport, AutomatedReportContact, AutomatedReportRecipient class AutomatedReportContactManager(object): def __init__(self, session=None): self.session = sessi...
5,605
1,618
#! /usr/bin/env python # # =============================================================== # Description: Two neighborhood benchmark # # Created: 2014-03-21 13:39:06 # # Author: Ayush Dubey, dubey@cs.cornell.edu # # Copyright (C) 2013-2014, Cornell University, see the LICENSE # ...
3,433
1,258
# Copyright 2022 MosaicML Composer authors # SPDX-License-Identifier: Apache-2.0 """BraTS (Brain Tumor Segmentation) dataset hyperparameters.""" from dataclasses import dataclass import torch import yahp as hp from composer.datasets.brats import PytTrain, PytVal, get_data_split from composer.datasets.dataset_hparam...
1,705
561
from quo.getchar import getchar getchar()
43
16
from setuptools import setup, find_packages setup( name='syntaxerrors', version='0.0.1', description='Report better SyntaxErrors', author='Carl Friedrich Bolz-Tereick', author_email='cfbolz@gmx.de', packages=['syntaxerrors'], package_dir={'': 'src'}, include_package_data=True, )
313
102
import operator from amino.either import Left, Right from amino import Empty, Just, Maybe, List, Either, _ from amino.test.spec_spec import Spec from amino.list import Lists class EitherSpec(Spec): def map(self) -> None: a = 'a' b = 'b' Right(a).map(_ + b).value.should.equal(a + b) ...
1,492
562
variable1 = "variable original" def variable_global(): global variable1 variable1 = "variable global modificada" print(variable1) #variable original variable_global() print(variable1) #variable global modificada
221
59
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import datetime import os from apscheduler.schedulers.blocking import BlockingScheduler from weather_alarm.constants import * from weather_alarm.forecaster import Forecaster from weather_alarm.sender import NotificationSender sender = NotificationSender(BOT_TOKEN, TELEG...
1,314
477
# -*- coding: utf-8 -*- """ authlib.oauth2.rfc6749 ~~~~~~~~~~~~~~~~~~~~~~ This module represents a direct implementation of The OAuth 2.0 Authorization Framework. https://tools.ietf.org/html/rfc6749 """ from .wrappers import OAuth2Request, OAuth2Token, HttpRequest from .errors import ( OAuth2...
2,237
659
TIMEOUT=100 def GenerateWriteCommand(i2cAddress, ID, writeLocation, data): i = 0 TIMEOUT = 100 command = bytearray(len(data)+15) while (i < 4): command[i] = 255 i += 1 command[4] = i2cAddress command[5] = TIMEOUT command[6] = ID command[7] = 2 command[...
1,613
707
# coding:utf-8 # version:python2.7.3 # author:kyh # import x,y data from txt and create kernel density map import arcpy from arcpy.sa import * from arcpy import env def read_point_data(filepath,i): # Read data file and create shp file with open(filepath, 'r') as pt_file: pt=arcpy.Point() ptGeo...
1,220
458
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """******************************************************************************* * MIT License * Copyright (c) Charu Sharma 2021 * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided th...
6,676
2,362
import pandas as pd class ProcessCSV: """ A general class to read in and process a csv format file using pandas. """ def __init__(self, filename, delim=',', header=None, usecols=None, dtype=None, ignore=False, *args): self._filename = filename self._args = args self._df = self....
893
296
from flask import request, g, abort from flask_restplus import Resource, fields from pyinfrabox.utils import validate_uuid4 from pyinfraboxutils.ibflask import auth_required, OK from pyinfraboxutils.ibrestplus import api from pyinfraboxutils.token import encode_project_token from api.namespaces import project as ns p...
2,521
778
import argparse from pathlib import Path from datetime import datetime, date, timedelta from queries import run_queries, precompute, cleanup from batches import run_batch_update import os import time import re if __name__ == '__main__': parser = argparse.ArgumentParser(description='LDBC TigerGraph BI workload Benc...
2,716
946
import numpy as np import chainer import chainer.functions as F import chainer.links as L from chainer import cuda, optimizers, serializers, Variable import sys sys.path.insert(0, '../') from common.loss_functions import * class Updater(chainer.training.StandardUpdater): def __init__(self, *args, **kwargs): ...
3,001
1,061
#! /usr/bin/env python3. # create ig definition file with all value sets in the /resources directory import json, os, sys, logging, re, csv from lxml import etree #logging.disable(logging.CRITICAL) logging.basicConfig(level=logging.DEBUG, format=' %(asctime)s - %(levelname)s- %(message)s') logging.info('Start of progr...
19,032
5,590
from functools import lru_cache from itertools import product from pathlib import Path from typing import Optional, List, Tuple from pydantic import validate_arguments import pyhmmer import requests as r from yarl import URL from sadie.typing import Species, Chain, Source class G3: """API Wrapper with OpenAPI f...
8,456
2,732
# coding: utf-8 from nlp_components.content_items_processors import process_list_content_sentences from nlp_components.content_items_processors import process_list_content_sentences_real import dals.os_io.io_wrapper as dal import json # NO DRY!! def read_utf_txt_file(fname): sets = dal.get_utf8_template() se...
1,683
600
import os client_id = os.environ['BOT_CLIENT_ID'] client_secret = os.environ['BOT_CLIENT_SECRET'] user_agent = os.environ['BOT_USER_AGENT'] username = os.environ['BOT_USERNAME'] password = os.environ['BOT_PASSWORD'] num_subs = int(os.environ['BOT_SUB_COUNT']) sub_settings = [[ os.environ['BOT_SUBREDDIT' + i], ...
1,132
485
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2017 Contributor # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
4,305
1,201
from .main import SatType class String(SatType, str): def __new__(cls, *args, **kwargs): return str.__new__(cls, *args, **kwargs) def __init__(self, *args, **kwargs): SatType.__init__(self)
228
80
from setuptools import setup setup(name='zerocater', version='0.0.1', description="Python interface to ZeroCater", long_description='', keywords='zerocater food delivery meal planning catering lunch', author='ZeroCater', author_email='tech@zerocater.com', url='https://github.c...
737
226
import pytest from app import create_app, db from config import TestConfig @pytest.fixture def test_client(): flask_app = create_app(TestConfig) with flask_app.test_client() as testing_client: with flask_app.app_context(): yield testing_client @pytest.fixture def init_database(test_clie...
373
120
from django.contrib import admin from django.urls import path , include from . import views urlpatterns = [ path('',views.index,name='index') ]
154
46
from django.db import models from django.urls import reverse from django.contrib.auth.models import User from django.utils import timezone import uuid ANNOTATION = ( ('asm', 'Asymmetry'), ('dst', 'Dystonia'), ('dsk', 'Dyskensia'), ('ebt', 'En Bloc Turning'), ('str', 'Short Stride Length'), ('mo...
6,435
2,081
from distutils.core import setup from setuptools import find_packages setup( name='mopac', packages=find_packages(), version='0.1', description='Model-based policy optimization', long_description=open('./README.md').read(), author='', author_email='', url='', entry_points={ ...
533
166
import datetime import canal from influxdb import InfluxDBClient class IMU(canal.Measurement): accelerometer_x = canal.IntegerField() accelerometer_y = canal.IntegerField() accelerometer_z = canal.IntegerField() gyroscope_x = canal.IntegerField() gyroscope_y = canal.IntegerField() gyroscope_z...
1,531
568
# # This file is part of ravstack. Ravstack is free software available under # the terms of the MIT license. See the file "LICENSE" that was provided # together with this source file for the licensing terms. # # Copyright (c) 2015 the ravstack authors. See the file "AUTHORS" for a # complete list. from __future__ impo...
2,820
883
#!/usr/bin/python import user import serial from pprint import pprint, pformat import insulaudit from insulaudit.data import glucose from insulaudit.log import io from insulaudit.devices import onetouch2 import sys PORT = '/dev/ttyUSB0' def get_serial( port, timeout=2 ): return serial.Serial( port, timeout=timeou...
1,217
462
import os.path import zipfile import pandas as pd from collections import defaultdict from graphdb_builder import builder_utils ######################### # SMPDB database # ######################### def parser(databases_directory, download=True): config = builder_utils.get_config(config_name="smpdbConfig.ym...
3,743
1,072
import time #Timing stuff lastTime = None prevFrameTime = 0; def waitFramerate(T): #TODO if we have enough time, call the garbage collector global lastTime, prevFrameTime ctime = time.monotonic() if lastTime: frameTime = ctime-lastTime #how long the last frame took sleepTime = T-frameTime #how much time is rem...
738
269
# -*- coding: utf-8 -*- # 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 "Li...
9,988
2,629
from __future__ import annotations import re from typing import Union import warp.yul.ast as ast from warp.yul.AstVisitor import AstVisitor from warp.yul.WarpException import WarpException class AstParser: def __init__(self, text: str): self.lines = text.splitlines() if len(self.lines) == 0: ...
13,497
4,230
# encoding: utf-8 ''' @author: Minghao Guo @contact: mh.guo0111@gmail.com @software: basenef @file: doc_generator.py @date: 4/13/2019 @desc: ''' import os import sys import time from getpass import getuser import matplotlib import numpy as np import json from srfnef import Image, MlemFull matplotlib.use('Agg') autho...
5,911
2,245
import pandas as pd import numpy as np DATA_PATH = "./data/EVconsumption/" weather = pd.read_csv(DATA_PATH + "dimweathermeasure.csv", sep = "|") osm = pd.read_csv(DATA_PATH + "osm_dk_20140101.csv", sep = "|") data0 = pd.read_csv(DATA_PATH + "2020_11_25_aal_viterbi.csv", sep = ",") data1 = pd.read_csv(DATA_PATH + "202...
760
328
import requests import json class WordDefinition: def __init__(self, word): self.word = word self.definisi = None self.json_data = None def url_data(self): api_url = 'http://kateglo.com/api.php' r = requests.get(api_url, params={ 'format': 'json', 'phrase'...
964
298
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. # # 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/LIC...
113,179
34,884
from yolov3.utils import data
30
11
""" This module provides classes that support observers, smart value handling and debug functions All changes to values nominate an agent, and observers nominate the agent making changes they are interested in. It supercedes the pvars module """ import logging, sys, threading, pathlib, math, json from enum import Enu...
21,354
5,997
import et.codecs tests = [ { "data": 0, "e_data": { 1: b'\x00\x010', 2: b'\x00\x02x\x9c3\x00\x00\x001\x001' } }, { "data": {}, "e_data": { 1: b'\x00\x01{}', 2: b'\x00\x02x\x9c\xab\xae\x05\x00\x01u\x00\xf9' } ...
578
262
import sqlite3 import pytest from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker import tests.testsite.testapp.models as dm from tests.sa_models import Base, Car, Child, Dog, Parent @pytest.fixture(scope="session") def engine(): print("NEW ENGINE") engine = create_engine( "s...
2,801
1,012
"""Module containing session and auth logic.""" import collections.abc as abc_collections import datetime from contextlib import contextmanager from logging import getLogger import dateutil.parser import requests from . import __version__ from . import exceptions as exc __url_cache__ = {} __logs__ = getLogger(__pac...
10,409
2,891
import theano import theano.tensor as T from theano.sandbox.rng_mrg import MRG_RandomStreams from theano.tensor.nnet.conv import conv2d from theano.tensor.signal.downsample import max_pool_2d from theano.tensor.shared_randomstreams import RandomStreams import numpy as np from toolbox import * from modelbase import * ...
3,046
1,224
import pandas as pd def one_hot(df, column): df = pd.concat([df, pd.get_dummies(df[column], prefix=column)], axis=1) df.drop([column], axis=1, inplace=True) return df
181
70
from typing import List class Solution: """ BFS """ def canReach_1(self, arr: List[int], start: int) -> bool: """ Recursively. """ seen = set() def helper(pos): if not 0 <= pos < len(arr) or pos in seen: return False ...
1,019
291
import pygame FPS = 60 BLOCK_SIZE = 48 COLOR_BACKGROUND = pygame.Color(0, 0, 0)
81
43
class AveragingBucketUpkeep: def __init__(self): self.numer = 0.0 self.denom = 0 def add_cost(self, cost): self.numer += cost self.denom += 1 return self.numer / self.denom def rem_cost(self, cost): self.numer -= cost self.denom -= 1 if self....
392
133
""" Installs and configures neutron """ import logging import os import re import uuid from packstack.installer import utils from packstack.installer import validators from packstack.installer.utils import split_hosts from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile # Controller o...
42,674
13,457
#--- Exercício 2 - Variáveis #--- Crie um menu para um sistema de cadastro de funcionários #--- O menu deve ser impresso com a função format() #--- As opções devem ser variáveis do tipo inteiro #--- As descrições das opções serão: #--- Cadastrar funcionário #--- Listar funcionários #--- Editar funcionário #--...
1,217
451
BB BBBBBBBBBBBBBBBBBB BB BBBBBBBBBBBBBBBB BBBBBBB BBBBBBBBBBBBBBBBBBBBBB BBBBB BB BBBBBBBBBB BB BB BB BBBBBBBBBB XXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXX BBBBB BBB BBBBB BB BBBB BBBBBBB BBBBBBBBBBBBBB BBBBBB BB BBBBBBBBBB BB BB BB BBBBBBBBBB XXXXXXXXXXX BBBBB
284
140
# Copyright 2018 Jet.com # # 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, sof...
1,137
365
from hyperopt import hp # Define the search space here, e.g. # from hyperopt.pyll.base import scope # search_space = { # 'epochs': hp.qloguniform('epochs', 0, 4, 2), # 'max_df': hp.uniform('max_df', 1, 2), # 'max_ngrams': scope.int(hp.quniform('max_ngram', 3, 9, 1)) # } # Default search space: Try di...
417
175
#!/usr/bin/env python ############################################################################# ## # This file is part of Taurus ## # http://taurus-scada.org ## # Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain ## # Taurus is free software: you can redistribute it and/or modify # it under the terms of t...
4,633
1,391
__version__ = "2.18" def version(): """Returns the version number of the installed workflows package.""" return __version__ class Error(Exception): """Common class for exceptions deliberately raised by workflows package.""" class Disconnected(Error): """Indicates the connection could not be establ...
347
91
import numpy as np from functools import wraps from autoconf import conf from autoarray.structures.grids.one_d import abstract_grid_1d from autoarray.structures.grids.two_d import grid_2d from autoarray.structures.grids.two_d import grid_2d_interpolate from autoarray.structures.grids.two_d import grid_2d_iterat...
18,592
5,541
""" Sanjay Reddy S-2013A7PS189P Aditya Sarma -2013A7PS079P Vamsi T -2013A7PS039P Artificial Intelligence Term Project """ import pickle import BeautifulSoup import re import boto from boto.s3.connection import S3Connection from boto.s3.key import Key from google import search def get_10_summary(query, sourc...
742
243
from event_testing.resolver import SingleSimResolver from sims4.resources import Types from sims4.tuning.tunable import TunableList, TunableReference from sims4.tuning.tunable_base import GroupNames from traits.trait_tracker import TraitPickerSuperInteraction import services class PickCareerByAgentInteraction(TraitPic...
2,055
606
from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path('json', views.api, name='api'), ]
149
48
# MINLP written by GAMS Convert at 04/21/18 13:55:18 # # Equation counts # Total E G L N X C B # 617 367 103 147 0 0 0 0 # # Variable counts # x b i s1s s2s sc ...
68,549
41,768
import openmc import openmc.deplete import matplotlib.pyplot as plt ############################################################################### # Load previous simulation results ############################################################################### # Load geometry from statepoint st...
3,265
1,031
from datetime import datetime as dt from typing import Optional, List from pydantic import BaseModel from ..utils.schemaHelper import Base, as_form class TreatmentTypeBase(Base): name: str room: str description: str fee: float is_active: Optional[str] = None @as_form class CreateTreatmentTy...
660
216
# -*- coding: utf-8 -*- from pep3143daemon import DaemonContext, PidFile import signal import os import sys import time class Daemon: def stop(self, pidfile): try: pid = open(pidfile).readline() except IOError: print("Daemon already gone, or pidfile was deleted manually") ...
2,211
638
from django import forms from crispy_forms.helper import FormHelper from pagedown.widgets import PagedownWidget from .models import Post class PostForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(PostForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) cont...
623
178
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('games', '0003_auto_20150725_1737'), ] operations = [ migrations.AlterField( model_name='game', name=...
1,621
465
import sys import json from os import path from argparse import ArgumentParser sys.path.append(path.dirname(path.dirname(path.abspath(__file__))) + '/utils/') from algorithm_utils import set_algorithms_output_data from health_check_lib import HealthCheckLocalDT def main(): # Parse arguments parse...
783
265
# -*-coding:UTF-8-*- from handler import SearchHandler urlpattern = ( (r'/search', SearchHandler), )
107
41
import logging from utils.common.datapipeline import DataPipeline import boto3 import json from copy import deepcopy s3 = boto3.resource('s3') bucket = s3.Bucket('tier-0') def run(config=None): orgs = [] for obj in bucket.objects.all(): key = str(obj.key) if len(key.split("_")) != 3: ...
1,601
557
import math import numpy as np from matplotlib.patches import FancyArrowPatch def home_has_possession(row): if row.possessionTeam == row.homeTeamAbbr: return True return False def calculate_team_sitation(row): ball_string = 'football' if row.team == ball_string: return ball_string ...
3,595
1,324
#!/usr/bin/env python3 class UnionFind(): def __init__(self, n): self.parent = [-1 for _ in range(n)] # 正==子: 根の頂点番号 / 負==根: 連結頂点数 def find(self, x): if self.parent[x] < 0: return x else: self.parent[x] = self.find(self.parent[x]) return self....
1,103
422
#!/usr/bin/env python # 標準ライブラリ from pathlib import Path from re import search, sub from sys import exit, argv from xml.etree import ElementTree as ET import csv # サードパーティライブラリ from requests import get from requests.exceptions import Timeout, RequestException # ローカルなライブラリ from constants import ENC_API_KEY, NTA_API_...
4,963
2,138
# custom libs from lib.args import getConf # Python libs from re import sub from os import mkdir from os.path import exists from getpass import getuser from socket import gethostname def genFrame(file): from classes.frame import Frame from lib.array import getGrid grid = getGrid(file) return(Frame(len(grid[0]), l...
3,289
1,328
# Licensed to the StackStorm, Inc ('StackStorm') 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 th...
5,538
1,431
""" This module comes with functions to decide which poker player out of all players has the best cards. """ import itertools # full_list in [('A','A'),('B','B')...,('F','F')] def results(full_list, public_card): """ The results function takes a list of player cards and the community cards (in the middle of...
6,372
1,858
from django.db import models class Chatbot(models.Model): name = models.CharField(max_length=500) def __str__(self): return f"name={self.name}" class WikiArticle(models.Model): name = models.CharField(max_length=500) summary = models.TextField(max_length=100) full_page = models.TextFiel...
420
145
from discord.ext.commands import Bot from discord_components import DiscordComponents, Button, ButtonStyle, InteractionType from asyncio import TimeoutError bot = Bot("!") @bot.event async def on_ready(): DiscordComponents(bot) print(f"Logged in as {bot.user}!") @bot.command() async def waitforclick(ctx): ...
1,026
308
"""Pascal VOC Semantic Segmentation Dataset.""" import os import torch import numpy as np from PIL import Image from .segbase import SegmentationDataset class VOCSegmentation(SegmentationDataset): """Pascal VOC Semantic Segmentation Dataset. Parameters ---------- root : string Path to VOCdev...
7,081
2,280
from app import app import urllib.request,json from .models import source from .models import article Source = source.Source Article = article.Article # Getting api key api_key = app.config['NEWS_API_KEY'] # Getting the source base url base_url = app.config["SOURCE_API_BASE_URL"] article_url = app.config["ARTICLE_A...
4,580
1,287
num1 =1 num2 = 222
19
14
# -*- coding: utf-8 -*- # Author:Guzhongren # created: 2017-05-08 import os path = 'C:\\geoconFailed\\willfix\\' for file in os.listdir(path): if os.path.isfile(os.path.join(path,file))==True: _file= file.split(".") _file_name=_file[0] _file_type=_file[1] new_file_name=_file_name[:-...
445
192
import sys c=[[2if a=="#"else 0for a in i]for i in sys.argv[1].split("\n")] n=len(c) def m(x): d[0]=(d[0]+a[d[1]]+3)%4 a[d[1]]=(x+a[d[1]])%4 if a[d[1]]==2:d[2]+=1 d[1]+=(s+(1-s)*(d[0]&1))*(-1+2*(d[0]&1^(d[0]&2)>>1)) s=1001 a=[] k=(s-n)//2 for i in range(s):a+=[0]*k+c[i-k]+k*[0]if k<=i<(s+n)/2else[0]*s b=list(a) d=[...
434
299
""" Automatic speech recognition scenario """ import logging from typing import Optional from tqdm import tqdm import numpy as np from art.preprocessing.audio import LFilter, LFilterPyTorch from armory.utils.config_loading import ( load_dataset, load_model, load_attack, load_adversarial_dataset, ...
10,178
2,799
# Copyright (c) 2022, Oracle and/or its affiliates. # # Licensed under the Universal Permissive License v 1.0 as shown at # https://oss.oracle.com/licenses/upl import xml.dom.minidom import re import sys def getManagedServerCount(domainHome): # use the parse() function to load and parse an XML file doc = xml.dom....
5,558
1,870
sqlqueries = { 'WeatherForecast':"select concat ('FY', to_char(f.forecasted_timestamp, 'YY')) Fiscal_yr, to_char(f.forecasted_timestamp, 'MON') Fiscal_mth, concat ('Day_', to_char(f.forecasted_timestamp, 'DD')) Fiscal_day, f.zipcode zip, min(f.temp_avg) low, max(f.temp_avg) high, max(f.wind_speed) wind, max(f.humid...
2,228
853
"""Test the functionality of protocols.application.states classes.""" from ventserver.protocols.application import lists from ventserver.protocols.protobuf import mcu_pb as pb def test_send_new_elements() -> None: """Test adding new elements to a list for sending.""" example_sequence = [ lists.Update...
5,005
1,517
# file that contains db models to be exposed via a REST API from models import room, survey, wifi_log, timetable, module # import db models from app import app # import Flask app from auth import auth # import Auth app to provide user authentificaiton from flask import request # import request object to parse json req...
1,969
506