text
string
size
int64
token_count
int64
import matplotlib.pyplot as plt import gym from gym.wrappers import atari_preprocessing from atari_wrappers import FireOnResetWrapper, FrameStackWrapper env = gym.make('BreakoutNoFrameskip-v4') print('State space:', env.observation_space) print('Action space:', env.action_space) print(env.get_action_meanings()) #env...
786
317
# -*- coding: utf-8 -*- # -------------------------- # Copyright © 2014 - Qentinel Group. # # 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...
3,746
1,093
# Generated by Django 3.1 on 2020-08-07 09:32 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('quickstart', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='diary', name='tags', ), ]
315
109
#!/usr/bin/env python # coding:utf-8 import json import time import datetime def get_time(f='%m-%d %H:%M:%S'): return time.strftime(f, time.localtime(time.time())) class _JSONEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, datetime.datetime): r = o.isoformat() ...
752
255
#!/usr/bin/env python """ List of Linux cgroups """ import lib_util import lib_common from sources_types.Linux import cgroup as survol_cgroup # cat /proc/cgroups # #subsys_name hierarchy num_cgroups enabled # cpuset 0 1 1 # cpu 0 1 1 # cpuacct 0 1 1 # blkio 0 ...
1,419
527
from io import BytesIO as IoBytesIO from colorthief import ColorThief from discord.ext.commands import command, Cog, group from re import search as re_search, sub as re_sub, compile as re_compile from PIL import Image from traceback import format_exc from os import remove as os_rem from datetime import datetime from di...
47,490
15,399
from abc import ABCMeta, abstractmethod import sys import numpy as np from scipy import linalg from scipy import stats import pandas as pd from vmaf.core.mixin import TypeVersionEnabled from vmaf.tools.misc import import_python_file, indices from vmaf.mos.dataset_reader import RawDatasetReader __copyright__ = "Copyr...
40,487
14,745
''' loan_payoff_tools: Test module. Meant for use with py.test. Write each test as a function named test_<something>. Read more here: http://pytest.org/ Copyright 2014, Phillip Green II Licensed under MIT ''' import unittest from datetime import date from loan_payoff_tools.payment_manager import Account from loan_p...
10,766
4,356
from abc import ABC, abstractmethod from functools import lru_cache from pystac.serialization.identify import OldExtensionShortIDs, STACVersionID from typing import Any, Callable, Dict, List, Optional, Tuple import pystac from pystac.serialization import STACVersionRange from pystac.stac_object import STACObjectType ...
14,015
3,824
#!/usr/bin/env python #coding=utf-8 #====================================================================== #Program: Diffusion Weighted MRI Reconstruction #Module: $RCSfile: mhd_utils.py,v $ #Language: Python #Author: $Author: bjian $ #Date: $Date: 2008/10/27 05:55:55 $ #Version: $Revision: 1...
4,339
1,538
import StringIO as io import json import time # data = '{"filename":"results/result_00000002.jpg","tag":[{"person":32,"left":373,"right":515,"top":81,"bot":388},{"person":31,"left":439,"right":556,"top":65,"bot":384}]}' # data = '{"filename":"results/result_00000056.jpg","tag":[{"car":28,"left":370,"right":719,"top":3...
2,454
1,178
# @l2g 384 python3 # [384] Shuffle an Array # Difficulty: Medium # https://leetcode.com/problems/shuffle-an-array # # Given an integer array nums,design an algorithm to randomly shuffle the array. # All permutations of the array should be equally likely as a result of the shuffling. # Implement the Solution class: # # ...
2,064
711
# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% import time import random import tensorflow as tf import numpy as np from numpy import load from numpy import zeros from numpy import ones from numpy.random import randint from tensorflow.keras.optimizers import Adam from tensorf...
10,259
4,202
from flask import request, render_template, redirect, flash from flask.helpers import url_for from ssis.models.student import Student from ssis.models.course import Course from ssis.models.college import College from .utils import add_course_to_db, update_course_record, check_page_limit, check_limit_validity from . imp...
4,673
1,409
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import autosklearn.classification import numpy import os import pandas import sys def ingest(): training_data = pandas.read_csv(os.getenv('TRAINING'), header=0) tournament_data = pandas.read_csv(os.getenv('TESTING'), header=0) features = [f for f in list(tra...
1,372
511
import torch from basicts.runners.base_traffic_runner import TrafficRunner class DCRNNRunner(TrafficRunner): def __init__(self, cfg: dict): super().__init__(cfg) def setup_graph(self, data): try: self.train_iters(data, 0, 0) except: pass def data_reshaper(s...
3,280
1,000
# -*- coding: utf-8 -*- """ This module defines the structure of GP primitives. The GP primitives are nodes with typed edges (parent input and child output types must match) and variable arity (for a given type, its final arity can be chosen during the evolution process). A ``GpPrimitive`` is a node whose types, ari...
17,143
4,883
""" This python function is part of the main processing workflow. It is called when a Transcribe job is started, and it will create an entry in a DynamoDB table that holds some job information and the Step Functions task token. The Step Function should then wait for another task to read this task token from DynamoDB ...
2,408
692
# Copyright 2014 Facebook, Inc. # You are hereby granted a non-exclusive, worldwide, royalty-free license to # use, copy, modify, and distribute this software in source code or binary # form for use in connection with the web services and APIs provided by # Facebook. # As with any software that integrates with the Fa...
7,388
2,268
import argparse import horovod.torch as hvd import pickle import numpy.random as rnd import numpy as np import torch import os arrays = [] class MaxMinQuantizer(): def __init__(self, q_bits, bucket_size): self.q = q_bits self.num_levels = 1 << self.q self.bucket_size = bucket_size def...
6,503
2,309
############################################################################ # # # Copyright (c) 2019-2020 Carl Drougge # # Modifications copyright (c) 2020 Anders Berkeman # # ...
6,495
2,031
# Copyright 2021 The TensorFlow Probability 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...
2,115
667
def gcd(a, b): while b != 0: x = a % b a = b b = x return a def lcm(a, b): gcd2 = gcd(a, b) return (a * b) // gcd2 n=int(input()) for i in range(n): a,b=input().split() a=int(a) b=int(b) print(lcm(a, b))
263
128
""" Generate the data used in the microRNA dashboard for the following tables: - Rfam miRNAs without matches - Rfam non-miRNA families matching miRBase Requires a mapping between all sequences from miRBase and the current Rfam models. The mapping can be generated as follows: wget https://ftp.ebi.ac.uk/pub/databases/R...
5,712
2,175
from matplotlib import pyplot time_list = [2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017] time_list_append = [2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022] predict = [10453, 10655.758342548274, 10726.259909546003, 10651.26868581213, 10399.137368507683, 9965.11495705042, 9558.34124532155...
739
537
#!/usr/bin/env python # script to draw PDA chromatogram & spectrum figure using Hitachi HPLC Chromaster stx/ctx files import pandas as pd import numpy as np import glob import os import sys import matplotlib.pyplot as plt # change this if using different user/folder data_dir = "raw/" # can give sample name file as ...
5,841
2,097
# Generated by Django 3.1.3 on 2021-04-17 21:49 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('classic_tetris_project', '0048_auto_20210417_2147'), ] operations = [ migrations.AlterField( mo...
1,764
568
''' Copyright 2017 Debasish Mandal Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistr...
6,941
2,674
# -*- coding: utf-8 -*- """ Created on Tue Mar 19 22:59:23 2019 @author: pradal """ # coding: utf8 from __future__ import absolute_import from __future__ import print_function import sys import os from optparse import OptionParser from path import Path from pycropml.cyml import transpile_file, transpile_package, t...
3,445
1,046
# flake8: noqa from .entrypoint import prompt, do_gauss_jordan from .line import Line from .term import Term from .aux_functions import strip, to_term, iterable_to_matrix, file_to_matrix
188
63
from pytube import YouTube from tkinter import * #main download part def download(link): obj = YouTube(link) dl = obj.streams.get_highest_resolution() print("Downloading in proccess") dl.download() print("Downloading completed!") #getting the link as string def get_class(): link...
1,051
406
print("testando") a = 2+2 b = 5 * 8 print (b-a)
49
30
import hashlib from functools import partial from pathlib import Path from typing import Union, Dict, Any, Tuple, Sequence import humanfriendly from pydantic import BaseModel, Extra, validator, root_validator from yaml import safe_load, safe_dump from .tools import Locker, DummyLocker, SizeTracker, DummySize, UsageTr...
3,583
1,157
from flask import ( Blueprint, flash, g, redirect, render_template, request, url_for,session ) from werkzeug.exceptions import abort from CTF import login from CTF.models import user bp = Blueprint('home', __name__) @bp.route('/') def index(): if 'id' in session: is_admin = 0 ...
693
243
""" A collection of public gene sets. """ from nest_py.core.data_types.tablelike_schema import TablelikeSchema COLLECTION_NAME = 'public_gene_sets' def generate_schema(): schema = TablelikeSchema(COLLECTION_NAME) schema.add_categoric_attribute('set_id', valid_values=None) schema.add_categoric_attribute('...
771
248
r"""Note. \forall{n \le 2}\ \xor_{i=0}^{2^n-1}{i} = 0 \xor_{0 \le i \lt 2^n, i \neq k (0 \le k \lt 2^n)}{i} = k """ import typing import sys # import numpy as np # import numba as nb def main() -> typing.NoReturn: m, k = map(int, input().split()) n = pow(2, m) if k >= n or m == k == 1: print(-...
690
311
# Merge Two Sorted Lists # Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def mergeTwoLists(self, list1, list2): # base cases for recursion if list1 is None: return list2 ...
572
182
from bottle import response, request def enable_cors(func): def _enable_cors(*args, **kwargs): # Set CORS headers response.headers['Access-Control-Allow-Origin'] = '*' response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS' response.headers['Access-Control-Allo...
565
167
# Entering the Basement def basement(): print(""" I will walk into the basement, there seems to be a robot there, working hard it seems. They don’t see the things the way I do, it exclaimed. I wander what it means, see what? Maybe I will approach it and find out. It seems to be working on some kind o...
2,367
627
# Codecademy's training document works with Markov_chains.py # Inna I. Ivanova training_doc1 = """ "Like A Virgin" Madonna Lyrics I made it through the wilderness Somehow I made it through Didn't know how lost I was until I found you I was beat, incomplete, I'd been had I was sad and blue, but you made me feel Yeah,...
1,221
395
import tempfile import xlsxwriter import re from django.shortcuts import render, redirect, get_object_or_404 from django.views import View from django.conf import settings from django.http import HttpResponse from django.contrib import messages from .models import QuestionSet, Question, ReplySet, Reply, Receiver from...
6,750
2,012
from main import app import unittest import pytest class TestToPerform(unittest.TestCase): def setUp(self): pass self.app=app.test_client() def test_page(self): response0=self.app.get("/",follow_redirects=True) print(response0) self.assertEqual(response0.status_...
1,494
495
import torch # def expm(vector): # if vector.shape[0] == 6: # return to_SE3(vector) # if vector.shape[0] == 4: # return to_SO3(vector) def t2pr(t): p = t[:,0:3,3] r = t[:,0:3,0:3] return (p,r) def t2p(t): device = t.device p = t[:,0:3,3] return p def pr2x(p,r): dev...
4,256
2,051
import openmdao.api as om from ...transcriptions.grid_data import GridData from ...options import options as dymos_options class TimeseriesOutputCompBase(om.ExplicitComponent): """ Class definition of the TimeseriesOutputCompBase. TimeseriesOutputComp collects variable values from the phase and provides...
1,903
455
# coding: utf-8 __author__ = 'Ruslan N. Kosarev' import sys from pathlib import Path from datetime import datetime from omegaconf import OmegaConf import random import numpy as np import tensorflow as tf from facenet import ioutils # directory for default configs default_config_dir = Path(__file__).parents[0].join...
7,359
2,455
from dockless_exploration_graphs import * if __name__ == '__main__': conn = read_only_connect_aws() # Geographic Overlap by Operator Over Time try: os.mkdir('./Load Graphs') except FileExistsError: pass load_path = './Load Graphs/' google_drive_location = '1LRJWj6wLBWvyBJbN93jXA...
1,861
582
from abc import ABCMeta, abstractmethod class LocalMembershipStateABC(metaclass=ABCMeta): @staticmethod @abstractmethod def has_members(): """ Determine if this state considers to have hosts interested in receiving data packets """ raise NotImplementedError class NoInfo(L...
914
241
from pyspark.sql import SparkSession spark = SparkSession \ .builder \ .appName("Python Spark regression example") \ .config("spark.some.config.option", "some-value") \ .getOrCreate() # import PySpark Audit functions from PySparkAudit import data_types, hist_plot, bar_plot, freq_items,feature_len fro...
744
237
# -*- coding: utf-8 -*- from __future__ import print_function import os import sys try: from setuptools import setup except ImportError: from distutils.core import setup if sys.version_info[:2] < (3, 4): import subprocess32 as subprocess else: import subprocess try: import pty # pylint: disabl...
2,554
822
#!/usr/bin/env python # # Author: Thamme Gowda [tg (at) isi (dot) edu] # Created: 4/4/20 import argparse from pathlib import Path from collections import defaultdict import mtdata from mtdata import log, __version__, cache_dir as CACHE_DIR, cached_index_file from mtdata.entry import DatasetId, LangPair from mtdata.ut...
9,118
3,123
from deap import base from deap import creator from deap import tools import random import numpy as np import matplotlib.pyplot as plt import seaborn as sns import elitism # problem constants DIMENSIONS = 2 BOUND_LOW, BOUND_HIGH = -5.0, 5.0 # Genetic Algorithm Constants POPULATION_SIZE = 300 P_CROSSOVER = 0.9 P_MUT...
3,767
1,357
from __future__ import unicode_literals from itertools import repeat from onmt.utils.logging import init_logger from onmt.utils.misc import split_corpus from onmt.translate.translator import build_translator import onmt.opts as opts from onmt.utils.parse import ArgumentParser import pandas as pd import numpy as np ...
20,025
5,823
# # @lc app=leetcode id=278 lang=python3 # # [278] First Bad Version # # https://leetcode.com/problems/first-bad-version/description/ # # algorithms # Easy (38.48%) # Likes: 2518 # Dislikes: 907 # Total Accepted: 609.3K # Total Submissions: 1.6M # Testcase Example: '5\n4' # # You are a product manager and curren...
2,051
730
expected_output = { "instance": { "default": { "vrf": { "vrf1": { "address_family": { "": { "default_vrf": "vrf1", "prefixes": { "0.0.0.0/0": { ...
3,311
858
from decimal import Decimal from decimal import getcontext from decimal import ROUND_FLOOR from decimal import ROUND_CEILING MIN_PRECISION = 32 MAX_PRECISION = 127 def ln(n): return Decimal(n).ln() def log2(n): return ln(n)/ln(2) def floor(d): return int(d.to_integral_exact(rounding=ROUND_FLOOR)) ...
946
462
from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User def SignUpForm(UserCreationForm): first_name = forms.CharField(max_length = 50, required = True) last_name = forms.CharField(max_length = 50, required = True) email = forms.EmailField(max_len...
496
161
from fake_useragent import UserAgent import requests,json accouts=json.loads(open("./accouts.json", mode='r').read()) ua = UserAgent() for i in accouts["sp"]: print("--------"+i["name"]+"----------") checkin_url=i["url"]["cu"] login_url=i["url"]["lu"] login_data={ "email":i["ac"]["u"], "passwd":i["ac"]["p"]...
711
286
# -*- coding: utf-8 -*- import unittest import os from io import StringIO, BytesIO import numpy as np import h5py from ribopy import create from ribopy.core.coverage import find_coverage from ribopy.core.region_counts import get_extended_boundaries,\ find_region_counts fro...
5,275
2,377
""" MDES Digital Enablement API These APIs are designed as RPC style stateless web services where each API endpoint represents an operation to be performed. All request and response payloads are sent in the JSON (JavaScript Object Notation) data-interchange format. Each endpoint in the API specifies the HTTP ...
18,128
4,593
import re def beforeTokenReplace(inputStr): inputStr = inputStr.replace('SSLv3_server_data.ssl_accept = & ssl3_accept;','SSLv3_server_data.ssl_accept = +0;') inputStr = inputStr.replace('void exit(int s)','void exitxxx(int s)') inputStr = inputStr.replace('100000','10') return inputStr def afterTokenReplace(t...
523
195
# flake8: noqa import pytest import hu_entity.spacy_wrapper @pytest.fixture(scope="module") def spacy_wrapper(): """EntityRecognizerServer takes ages to initialize, so define a single EntityRecognizerServer which will be reused in every test""" server = hu_entity.spacy_wrapper.SpacyWrapper(minimal_ers_mo...
6,377
2,180
import time import logging from cluster.cluster import DbCluster from monitor.master_db_handler import MasterDbHandler from monitor.standby_db_handler import StandbyDbHandler from cluster.cluster_node_role import DbRole from monitor.webserver import WebServer from utils import shell from threading import Lock class D...
5,974
1,691
#!/usr/bin/env python #coding: UTF-8 import os, glob, numpy, gdal from math import * class Escape(Exception): pass def nearest1D(self, X,xn): X = numpy.array(X) idx = (X - xn).argmin() distance = abs(X[idx] - xn) return idx, distance def nearest2D(self, XY, x,y): distances = (XY[:,0] - x)**2 + (X...
2,012
773
"""Your module main code should be placed here. """
52
15
import discord import mimetypes import requests import random from io import BytesIO from utils import permissions, http from discord.ext.commands import errors class RedditPost: """ Represents a single reddit post with the following attributes: (str) subreddit: the subreddit that the po...
5,668
1,795
import abc import torch as tc class Architecture(tc.nn.Module, metaclass=abc.ABCMeta): """ Computes features from an input. """
143
48
"""views """ from flask import render_template, request, flash, url_for, redirect, \ send_from_directory, session from functools import wraps from flask_login import current_user, login_user, login_required, logout_user import datajoint as dj import pandas as pd from loris import config from loris.app.app import ...
10,321
2,911
""" stanCode Breakout Project Adapted from Eric Roberts's Breakout by Sonja Johnson-Yu, Kylie Jue, Nick Bowman, and Jerry Liao This program set up a class to help construct a breakout game. """ from campy.graphics.gwindow import GWindow from campy.graphics.gobjects import GOval, GRect, GLabel from campy.gui.events.mou...
11,191
3,526
# coding=utf-8 # Copyright 2019 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
3,078
1,068
#from api.avrae.cogs5e.sheets.beyond import getJSON as beyond_getJSON from api.avrae.cogs5e.sheets.gsheet import getJSON_gsheet as gsheet_getJSON import json from api.dndutil import * def get_mod(score): modref = { '1':-5, '2-3':-4, '4-5':-3, '6-7':-2, '8-9':-1, '10-...
1,793
683
from datetime import datetime import http.client from io import BytesIO import importlib.util from typing import Optional from lumigo_tracer.libs.wrapt import wrap_function_wrapper from lumigo_tracer.parsing_utils import safe_get_list, recursive_json_join from lumigo_tracer.lumigo_utils import ( get_logger, lu...
10,742
3,137
import logging import sys from termcolor import colored if sys.platform == 'win32': from colorama import init init() COLORS = { 'DEBUG': 'green', 'INFO': 'yellow', 'WARNING': 'magenta', 'ERROR': 'red', } class ListHandler(logging.Handler): def __init__(self): super().__init__() self.logs = [] def e...
580
213
import utils from talkpages import WikiCorpusReader, WikiCorpus from alignment import Alignment TOPIC = 'sports' corpus_reader = WikiCorpusReader('../../data/controversial/') tsv_filename = corpus_reader.json_to_tsv('tokenized_posts/', topic_list=[TOPIC]) # tsv_filename = './tsv/WikiControversial-{}.tsv'.format(TOP...
2,692
984
n = s = c = mai = men = 0 perg = 's' while perg in 'sSSIMsim': n = int(input('Digite um número: ')) c += 1 s += n if men == 0: men = n if n > mai: mai = n if n < men: men = n perg = str(input('Quer continuar? [s/n] ')).strip() m = s/c print('Soma:',s,'\nQuant. números...
383
173
#!/usr/bin/env python3 exit(0)
31
15
import gym from smarts.core.agent import Agent from smarts.core.agent_interface import AgentInterface, AgentType from smarts.zoo.agent_spec import AgentSpec agent_id = "Agent-007" agent_spec = AgentSpec( interface=AgentInterface.from_type(AgentType.Laner), agent_params={"agent_function": lambda _: "keep_lane"}...
720
251
def test_udp_description(self): """ Comprobacion de que la descripcion asociada al protocolo coincide Returns: """ port = Ports.objects.get(Tag="ssh") udp = Udp.objects.get(id=port) self.assertEqual(udp.get_description(), "Conexion ssh")
267
95
"""Rampage """
15
9
import djangofy as dfy import os PATH = 'examples/example1/' PUBLISHED = PATH + 'published/' # path to published files! # Make url and sitemaps files names = [ 'page1', 'page2', 'page3' ] urls = [ 'some-exciting-article', 'another-exciting-article', 'you-must-read-this' ] dfy.make_urls(nam...
411
172
from django.apps import AppConfig class CeleryAnalyticsConfig(AppConfig): name = 'celeryanalytics' label = 'celeryanalytics' def ready(self): import celeryanalytics.signals
195
59
from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy import os import shutil import numpy as np import torch def mkdir(paths): if not isinstance(paths, (list, tuple)): paths = [paths] for path in paths: if not os.path.isdir(...
3,575
1,286
import warnings import numpy as np from scipy.linalg import pinvh def get_generator(random_state=None): """Get an instance of a numpy random number generator object. This instance uses `SFC64 <https://tinyurl.com/y2jtyly7>`_ bitgenerator, which is the fastest numpy currently has to offer as of version 1...
10,315
4,167
# ------------------------------ # 409. Longest Palindrome # # Description: # Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. # This is case sensitive, for example "Aa" is not considered a palindrome here. # Note: # Assum...
1,119
352
from contextvars import ContextVar from typing import Any, Dict _request_scope_context_storage: ContextVar[Dict[Any, Any]] = ContextVar("blacksheep_context") from .ctx import context # noqa: F401, E402
205
67
def sacar(saldo): montante = float(input("Quanto deseja sacar? ")) saldo = saldo - montante return saldo saldo = float(input("Informe o saldo total: ")) qtde = int(input("Quantos saques vc deseja? ")) for c in range(qtde): saldo = sacar(saldo) print("Saldo final: ", saldo)
313
132
import os _HOME_PATH = os.path.expanduser("~") # aws config AWS_PROFILE = os.environ.get("CATAPULT_AWS_PROFILE", "default") AWS_MFA_DEVICE = os.environ.get("CATAPULT_AWS_MFA_DEVICE") # git config GIT_REPO = os.environ.get("CATAPULT_GIT_REPO", "./") # catapult config CATAPULT_SESSION = os.environ.get( "CATAPULT_...
370
157
import setuptools import distutils.command.build from distutils.errors import DistutilsSetupError import distutils.sysconfig import distutils.spawn import hashlib import os import re import shutil import StringIO import sys import tarfile import tempfile import urllib2 import urlparse import zipfile # # Things that ne...
40,928
13,466
""" the module to generate Julia code この module は Python のコードを生成します。 ただしmain.pyを元に適当に書き換えたのでうまく生成できない場合があるかもしれません。 以下の関数を提供します。 - :func:`read_input` - :func:`write_output` - :func:`declare_constants` - :func:`formal_arguments` - :func:`actual_arguments` - :func:`return_type` - :func:`return_value` 加えて、ランダムケースの生成のため...
19,149
6,216
from time import sleep from unittest import TestCase from thornfield.cacher import Cacher from thornfield.caches.memory_cache import MemoryCache class TestMemoryCache(TestCase): def test_basic(self): cacher = Cacher(self._create_cache) @cacher.cached def foo(x): foo.call_coun...
1,451
479
def main(): pro1() pro2() # Problem 1: # # Create a Movie class with the following properties/attributes: movieName, rating, and yearReleased. # # Override the default str (to-String) method and implement the code that will print the value of all the properties/attributes of the Movie class # # # Assign a value...
1,852
536
__author__ = 'sergei' from model.group import Group from model.user import User import random def test_del_user_from_group(app, orm): if len(orm.get_contact_list()) == 0: app.user.add(User(firstname="Jeck", lastname="Antonio")) if len(orm.get_group_list()) == 0: app.group.create(Group(name="T...
1,267
480
import unittest from unittest.mock import MagicMock from balebot.models.base_models import Peer from balebot.models.client_requests import EditMessage from balebot.models.messages import TextMessage class TestEditMessage(unittest.TestCase): @classmethod def setUpClass(cls): peer = Peer(peer_type="Use...
741
244
# Typing imports from __future__ import annotations import math, random, pprint from ..bbUtil import dumbEmoji ##### UTIL ##### # Number of decimal places to calculate itemTLSpawnChanceForShopTL values to tl_resolution = 3 def truncToRes(num : float) -> float: """Truncate the passed float to tl_resolution deci...
12,883
4,627
from collections import defaultdict import dataclasses from datetime import date, datetime, timedelta, timezone from itertools import chain import pickle from typing import Any, Dict import pandas as pd from pandas.core.dtypes.common import is_datetime64_any_dtype from pandas.testing import assert_frame_equal import p...
47,272
16,995
#VILLEBot v1.0 #Author = Wiljam Peltomaa #Last updated = 21.04.2019 import PySimpleGUI as sg import pyautogui import pyperclip import string from time import sleep def main(): print('To stop the bot, drag the cursor to the top-left corner of your screen or press Ctrl-Alt-Del') texts = [] locati...
8,383
2,377
import os import unittest import logging from substrateinterface import SubstrateInterface, ContractMetadata, Keypair from substrateinterface.utils.ss58 import ss58_encode from patractinterface.unittest.env import SubstrateTestEnv from patractinterface.contracts.erc20 import ERC20 class ERC20TestCase(unittest.TestCa...
2,487
926
import bisect N,M=map(int,input().split()) X,Y=map(int,input().split()) A=list(map(int,input().split())) B=list(map(int,input().split())) ans=0 time=0 while time<=A[-1]: time=A[bisect.bisect_left(A,time)]+X if time<=B[-1]: time=B[bisect.bisect_left(B,time)]+Y ans+=1 else:break print(ans)
316
136
#!/usr/bin/env python # Copyright 2015-2016 Yelp 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 ...
33,295
11,209
import argparse import os import shlex import shutil from subprocess import Popen, PIPE from pyspark import SparkContext, SparkConf import pandas as pd import subprocess import boto3 import re global parser_result APPLICATION_FOLDER = "/mnt/app" GENOME_REFERENCES_FOLDER = "/mnt/ref" TEMP_OUTPUT_FOLDER = "/mnt/output"...
14,337
4,675
from requests_html import HTMLSession import pandas as pd import time #Render Dynamic Pages - Web Scraping Product Links with Python #Virvoitusjuomat = 1022 | sivuja n. 5 #Mehut = 1018 | sivuja n. 9 #Vedet = 1028 | sivuja n. 4 #Energiajuomat = 1038 | n. 2 category_code = 1008 page_count = 1 category_string = "" if ca...
3,198
1,172