text
string
size
int64
token_count
int64
# -*- coding: utf-8 -*- # auxilium # -------- # Python project for an automated test and deploy toolkit. # # Author: sonntagsgesicht # Version: 0.2.8, copyright Friday, 14 January 2022 # Website: https://github.com/sonntagsgesicht/auxilium # License: Apache License 2.0 (see LICENSE file) from logging import log...
3,948
1,359
import re import subprocess import shutil import sys import json import argparse from typing import List, NamedTuple, Optional, Sequence PATTERN_IMPORT_TIME = re.compile(r"^import time:\s+(\d+) \|\s+(\d+) \|(\s+.*)") class InvalidInput(Exception): pass class Import(dict): def __init__(self, name: str, t_s...
7,875
2,468
# Copyright 2017--2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License # is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" fi...
6,631
2,215
import csv import collections import pandas as pd from random import shuffle from tqdm import tqdm def get_all_tokens_conll(conll_file): """ Reads a CoNLL-2011 file and returns all tokens with their annotations in a dataframe including the original sentence identifiers from OntoNotes """ all_toke...
8,194
2,405
from setuptools import find_packages, setup import re VERSIONFILE = "{{ cookiecutter.project_name }}/__init__.py" with open(VERSIONFILE, "rt") as versionfle: verstrline = versionfle.read() version_re = r"^__version__ = ['\"]([^'\"]*)['\"]" mo = re.search(version_re, verstrline, re.M) if mo: ver_str = mo.group(...
800
264
# -*- coding: utf-8 -*- from square.api_helper import APIHelper from square.http.api_response import ApiResponse from square.api.base_api import BaseApi class CardsApi(BaseApi): """A Controller to access Endpoints in the square API.""" def __init__(self, config, auth_managers, call_back=None): super...
8,759
2,241
import os from setuptools import setup try: import concurrent.futures except ImportError: CONCURRENT_FUTURES_PRESENT = False else: CONCURRENT_FUTURES_PRESENT = True def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name="threadedprocess", version="0....
1,564
467
# -*- coding: utf-8 -*- # Copyright (c) 2020, Apple Inc. All rights reserved. # # Use of this source code is governed by a BSD-3-clause license that can be # found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause import numpy as np from coremltools.converters.mil.mil import Builder as mb...
2,592
827
from simcse import SimCSE from esimcse import ESimCSE from promptbert import PromptBERT from sbert import SBERT from cosent import CoSent from config import Params from log import logger import torch from transformers import AutoTokenizer class SimCSERetrieval(object): def __init__(self, pretrained_model_path, si...
13,749
3,988
# -*- coding: utf-8 -*- """ Check which users apply to receive certain notifications. Send notifications via APNs to those users. """ import asyncio import json from datetime import datetime from math import floor from pathlib import Path from typing import List, Optional, Tuple import arrow # type: ignore impor...
15,885
4,371
from collections import OrderedDict import pandas as pd from bokeh.charts import Horizon, output_file, show # read in some stock data from the Yahoo Finance API AAPL = pd.read_csv( "http://ichart.yahoo.com/table.csv?s=AAPL&a=0&b=1&c=2000&d=0&e=1&f=2010", parse_dates=['Date']) MSFT = pd.read_csv( "http://...
821
379
# from __future__ import print_function import pymzn import time from pprint import pprint from collections import OrderedDict import openrouteservice from openrouteservice.geocode import pelias_search from openrouteservice.distance_matrix import distance_matrix client = openrouteservice.Client(key='') # routes = cli...
4,023
1,278
import random import requests import time HOSTS = [ 'us-east-1', 'us-west-1', 'eu-west-1', ] VEHICLES = [ 'bike', 'scooter', 'car', ] if __name__ == "__main__": print(f"starting load generator") time.sleep(15) print('done sleeping') while True: host = HOSTS[random.rand...
597
241
import os from pprint import pprint from msrest.authentication import CognitiveServicesCredentials from azure.cognitiveservices.vision.contentmoderator import ContentModeratorClient from azure.cognitiveservices.vision.contentmoderator.models import ( Evaluate, OCR, FoundFaces ) ''' This quickstart uses Content Modera...
3,148
938
from django.contrib import admin from . import models class ReadOnlyAdminMixin(): def get_readonly_fields(self, request, obj=None): return list(set( [field.name for field in self.opts.local_fields] + [field.name for field in self.opts.local_many_to_many] )) class ReadOnl...
1,498
458
from decimal import Decimal def Binominal(n: int, k: int) -> int: if k > n: return 0 result = 1 if k > n - k: k = n - k i = 1 while i <= k: result *= n result //= i n -= 1 i += 1 return result def pvalue(a: int, b: int, c: int, d: in...
1,779
680
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 31 04:01:49 2018 @author: abhilasha """ #Team: GuardiansOfGalaxy from PIL import Image, ImageEnhance def enhance_signature(img): bw = ImageEnhance.Color(img).enhance(0.0) bright = ImageEnhance.Brightness(bw).enhance(2.2) contrast = ImageEnha...
1,528
684
from main.customdecorators import check_honeypot_conditional from django.core.files.uploadedfile import InMemoryUploadedFile from django.http.response import HttpResponseRedirect, JsonResponse from rest_framework.decorators import action from api.models import ObjectType from django.core.cache import cache from crowdso...
23,802
6,336
# Copyright 2019 NEC Corporation # # 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...
2,232
777
import chutil as module def test_versions(): pass
56
18
"""Generates pre-signed uri's for blob handling.""" from boto3 import client import os s3_client = client('s3') def create_uri(repo_name, resource_oid, upload=False, expires_in=300): """Create a download uri for the given oid and repo.""" action = 'get_object' if upload: action = 'put_object' ...
932
301
# coding=utf8 import logging import os import random import re import numpy as np import tensorflow as tf from seq2seq_conversation_model import seq2seq_model from seq2seq_conversation_model import data_utils from seq2seq_conversation_model import tokenizer from seq2seq_conversation_model.seq2seq_conversation_model imp...
4,919
1,653
import unittest import pygame from chip8_pygame_integration.config import get_config, KeyBind, to_text DEFAULT = [KeyBind(pygame.K_o, pygame.KMOD_CTRL, 'some_command')] class ConfigLoadTest(unittest.TestCase): def setUp(self): self.default = None def test_empty_pattern_returns_empty_array(self): ...
5,986
2,164
''' Preorder Binary Tree For a given Binary Tree of integers, print the pre-order traversal. Input Format: The first and the only line of input will contain the nodes data, all separated by a single space. Since -1 is used as an indication whether the left or right node data exist for root, it will not be a part of t...
1,934
647
''' Super classes for Page object Serve as a base template for page automating functions with selenium ''' from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from utils.best_buy.locators import Locators from utils.best_buy import urls ...
1,693
510
#!/usr/bin/env python3 """ This script has been tested on various custom google forms and other various forms with few alteratios .. Google forms which does include the input type "token" attribute are found to be safer than those who don't. Any form contains various fields. 1. input text fields 2. radio 3. checkb...
2,419
773
# -*- coding: utf-8 -*- try: # py3 from urllib.parse import urljoin, quote except ImportError: # py2 from urlparse import urljoin from urllib import quote from lektor.pluginsystem import Plugin from furl import furl class RootRelativePathPlugin(Plugin): name = u'root-relative-path' descr...
1,306
403
# -*- coding: utf-8 -*- from odoo import http from odoo.http import request import jenkins class JenkinsController(http.Controller): @http.route('/web/jenkins/jobs', type='json', auth='user') def jenkins_get_jobs(self, **kw): params = request.env['ir.config_parameter'] jenkins_url = params....
1,375
432
import cv2 import numpy as np import pyzbar.pyzbar as pyzbar import sys import time import pybase64 # Starting the webcam capt = cv2.VideoCapture(0) names = [] # Creating Attendees file fob = open('attendees.txt', 'a+') def enterData(z): if z in names: pass else: nam...
996
383
import torch.nn as nn import torch.nn.functional as F import torch from numpy.random import normal from math import sqrt import argparse channel_dim = 3 ndf = 64 class GlobalConvBlock(nn.Module): def __init__(self, in_dim, out_dim, kernel_size): super(GlobalConvBlock, self).__init__() pad0 = (ker...
19,562
7,863
import dataset import logging from telegram.ext import Updater, CommandHandler, MessageHandler, Filters from .config import TOKEN, DB_URI from .commands import HANDLERS logging.basicConfig() def save_message(message, db): replied = None if message.reply_to_message is not None: replied = message.rep...
2,155
740
from slugify import slugify from app.db.errors import EntityDoesNotExist from app.db.repositories.articles import ArticlesRepository from app.models.domain.articles import Article from app.models.domain.users import User async def check_article_exists(articles_repo: ArticlesRepository, slug: str) -> bool: try: ...
647
193
from pymp3decoder import Decoder import contextlib import os import math import pyaudio CHUNK_SIZE = 4096 def take_chunk(content): """ Split a buffer of data into chunks """ num_blocks = int(math.ceil(1.0*len(content)/CHUNK_SIZE)) for start in range(num_blocks): yield content[CHUNK_SIZE*start:...
1,240
391
import telegram.ext import messsages as msg import functions as f import matplotlib.pyplot as plt import traceback import os import os.path from os import path def start(update, context): nombre = update.message.chat.first_name mensaje = "Bienvenido {}, para conocer lo que puedo hacer utiliza el comando /Help...
2,232
719
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Jayesh Kariya <jayeshk@saltstack.com>` ''' # Import Python libs from __future__ import absolute_import, unicode_literals, print_function # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.unit import skipIf, TestCase...
2,706
761
""" 499. Word Count (Map Reduce) https://www.lintcode.com/problem/word-count-map-reduce/description """ class WordCount: # @param {str} line a text, for example "Bye Bye see you next" def mapper(self, _, line): # Write your code here # Please use 'yield key, value' word_lists = line.spl...
613
191
# -*- coding: UTF-8 -*- import numpy as np import pandas as pd def countnum(): dates = pd.date_range(start="2019-01-01", end="2019-05-31", freq='M') # print(dates) # print(dates[0]) # print(type(dates[0])) col1 = [i for i in range(1, len(dates) + 1)] # print(col1) col2 = [i + 1 for i in ra...
1,205
521
# -*- coding: utf-8 -*- # Licensed under a 3-clause BSD style license - see LICENSE.rst from __future__ import (absolute_import, division, print_function, unicode_literals) import base64 import os import zlib from .environment import get_environment from . import util def iter_results_paths...
6,513
1,841
import math import json import re import os class Color: GREEN = '\033[92m' BLUE = '\033[94m' RED = '\033[91m' # noinspection SpellCheckingInspection ENDC = '\033[0m' @staticmethod def print(color, text): print('{}{}{}'.format(color, text, Color.ENDC)) def shannon_entropy(data): ...
1,188
424
import matplotlib.pyplot as plt import numpy as np import pandas as pd from typing import Tuple def clean_df_headers(df: pd.DataFrame) -> pd.DataFrame: """Remove leading and trailing spaces in DataFrame headers.""" headers = pd.Series(df.columns) new_headers = [header.strip() for header in headers] ...
2,342
856
''' Created on Mar 20, 2016 ''' import numpy import numbers from fuel.datasets.hdf5 import H5PYDataset from fuel.utils import Subset class VMap(object): def __init__(self, vmap_dset): dtype = vmap_dset.dtype dtype_unicode = [('key', 'U%d' % (dtype[0].itemsize/4,)), ('val',...
8,036
2,350
import glob import os import setuptools with open("README.md", "r") as fh: long_description = fh.read() templates = [] directories = glob.glob("govuk_frontend_wtf/templates/*.html") for directory in directories: templates.append(os.path.relpath(os.path.dirname(directory), "govuk_frontend_wtf") + "/*.html") ...
1,444
469
import os import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from common.tflogs2pandas import tflog2pandas, many_logs2pandas from common.gym_interface import template bodies = [300] all_seeds = list(range(20)) all_stackframe = [0,4] cache_filename = "output_data/tmp/plot0" try: df = pd.rea...
2,930
1,047
#!/usr/bin/python # mac_convertor.py - Converts mac address from various formats to other formats from macvert.web import app if __name__ == '__main__': app.run()
167
56
""" Loads dotenv variables Classes: None Functions: None Misc variables: DATABASE_KEY (str) -- The key for the database DATABASE_PASSWORD (str) -- The password for the database DATABASE_URL (str) -- The url for the database """ import os from dotenv import load_dotenv, find_dotenv load_dotenv(find_dotenv()) DATABA...
461
157
class Solution: def mergeTrees(self, t1, t2): """ :type t1: TreeNode :type t2: TreeNode :rtype: TreeNode """ # This method changes the existing tree instead of returning a new one if t1 and t2: t1.val += t2.val t1.left = self.mergeTrees...
462
150
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch from archai.nas.model import Model from archai.nas.macro_builder import MacroBuilder from archai.common.common import common_init def test_darts_zero_model(): conf = common_init(config_filepath='confs/algos/darts.yaml')...
1,094
402
import logging import datetime class DatasetReports(object): def __init__(self, dataverse_api=None, dataverse_database=None, config=None): if dataverse_api is None: print('Dataverse API required to create dataset reports.') return if dataverse_database is None: p...
13,461
3,262
# from abc import ABCMeta import metapy class WebClassifier(object): """ This module is abstract module which needs to be called by inherit """ __metaclass__ = ABCMeta def __init__(self, configFile): """ Initialized basic of classifier like fwd index, index :param configFile: """ #metapy.log_to_stde...
1,377
464
from src.access import EventPublishAccess from generate_access_data import generate_access_data def test_publish_event_access(): sessions = generate_access_data() event = sessions['user'].events.get('test') useraccess = EventPublishAccess(sessions['user'], event) manageraccess = EventPublishAccess(ses...
609
166
import json import aiohttp from copy import deepcopy class Resource(object): """ A base class for API resources """ # """List of allowed methods, allowed values are # ```['GET', 'PUT', 'POST', 'DELETE']``""" # ALLOWED_METHODS = [] def __init__(self, url, auth): """ :param...
4,296
1,200
from manim2.imports import * ########## #force_skipping #revert_to_original_skipping_status ########## class Slider(NumberLine): CONFIG = { "color" : WHITE, "x_min" : -1, "x_max" : 1, "unit_size" : 2, "center_value" : 0, "number_scale_val" : 0.75, "label_sc...
115,464
39,779
from link_extractor import run_enumeration from colorama import Fore from utils.headers import HEADERS from time import sleep import requests import database import re import json from bs4 import BeautifulSoup import colorama print(Fore.GREEN + '-----------------------------------' + Fore.RESET, Fore.RED) print('尸闩㇄尸㠪...
871
288
import xarray import numpy from enstools.scores import DisplacementAmplitudeScore def test_embed_image(): """ test of embed_image from match_pyramide_ic """ # create test image test_im = xarray.DataArray(numpy.random.randn(5, 3)) # new array should have shape (8, 4) result = DisplacementA...
4,994
1,956
# Generated by Django 3.1.2 on 2020-10-28 14:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shopit', '0023_availablefilterselectoptions_value'), ] operations = [ migrations.RemoveField( model_name='productinfo', ...
833
244
from event2019.day13.computer_v4 import Computer_v4 ######## # PART 1 computer = Computer_v4([]) computer.load_code("event2019/day19/input.txt") def get_value(x, y): out = [] computer.reload_code() computer.run([x, y], out) return out[0] def get_area(side = 50): area = [] min_x, width = 0...
1,804
621
from django import forms from django.contrib.auth import authenticate from django.contrib.auth.forms import UserCreationForm from .models import FileoUser User = FileoUser() class UserLoginForm(forms.ModelForm): password = forms.CharField(label='Password', widget=forms.PasswordInput) class Meta: mode...
849
232
from setuptools import setup from pathlib import Path from lightkube.models import __version__ setup( name='lightkube-models', version=__version__, description='Models and Resources for lightkube module', long_description=Path("README.md").read_text(), long_description_content_type="text/markdown...
959
285
""" *Upper-West Capital 4* ⠨ The upper-west capital four gi. """ from dataclasses import dataclass from ....._gi import Gi from ....capital import CapitalGi from ...._gi import StrismicGi from ....west import WesternGi from ...._number import FourGi from ..._gi import UpperGi __all__ = ["UpperWestCapital4...
465
162
import enum from typing import Any, Dict from jashin.dictattr import * def test_dictattr() -> None: class Test: field1 = ItemAttr[str]() field2 = ItemAttr[str](name="field_2") field3 = ItemAttr[str](default="default_field3") def __dictattr_get__(self) -> Dict[str, Any]: ...
5,626
2,362
n = int(input()) m = int(input()) r = m for i in range(n): a, b = map(int, input().split()) m += a m -= b if m < 0: print(0) exit() r = max(r, m) print(r)
191
84
#!/usr/bin/env python # Copyright 2017-2020 IBM Corp. 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 require...
66,679
20,452
import uuid from django.contrib.auth.models import AbstractUser from django.db import models """ The user model that represents a user participating in the game. Implemented using the built-in Django user model: AbstractUser. """ class User(AbstractUser): """ The User class that represents a user that has crea...
1,849
491
import numpy as np import tensorflow as tf class SlidingWindowGenerator: def __init__(self, input_width, label_width, shift, train_df, val_df, test_df, label_columns=None): # Store raw data with dataframe type self.train_df = train_df self.val_df = val_df ...
4,743
1,352
# Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB), and the INTEL Visual Computing Lab. # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. import datetime import sys from contextlib import contextmanage...
1,737
554
# Käydään läpi mitä opimme viime viikolla (ja myös jotakin uutta) # Jos jokin asia mietityttää, kysy vain rohkeasti apua! ##### INFO ##### # Viime viikon tärkeimmät asiat olivat: # 1. print-komento # 2. muuttujan käyttö # 3. kilpikonnan käyttäminen piirtämiseen # Ohelmointi vaatii usein tiedon etsimistä muista lähtei...
3,002
1,377
""" FileName [ train.py ] PackageName [ PFFNet ] Synopsis [ Train the model ] Usage: >>> python train.py --normalized --cuda """ import argparse import os import shutil from datetime import date import matplotlib import numpy as np import pandas as pd import torch import torchvision import torchvi...
32,807
10,546
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: core.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflecti...
45,373
15,697
name = " alberT" one = name.rsplit() print("one:", one) two = name.index('al', 0) print("two:", two) three = name.index('T', -1) print("three:", three) four = name.replace('l', 'p') print("four:", four) five = name.split('l') print("five:", five) six = name.upper() print("six:", six) seven = name.lower() print("...
546
231
from cms.extensions import PageExtension from cms.extensions.extension_pool import extension_pool from django.utils.translation import ugettext as _ from filer.fields.image import FilerImageField class SimplePageExtension(PageExtension): """ A generic website page. """ image = FilerImageField(verbose_...
384
106
n = int(input()) s = [[0] * 10 for _ in range(n + 1)] s[1] = [0] + [1] * 9 mod = 1000 ** 3 for i in range(2, n + 1): for j in range(0, 9 + 1): if j >= 1: s[i][j] += s[i - 1][j - 1] if j <= 8: s[i][j] += s[i - 1][j + 1] print(sum(s[n]) % mod)
290
157
### INITIALIZE VPYTHON # ----------------------------------------------------------------------- from __future__ import division from visual import * from physutil import * from visual.graph import * ### SETUP ELEMENTS FOR GRAPHING, SIMULATION, VISUALIZATION, TIMING # -------------------------------------------------...
3,021
962
from django.db import models class Parking(models.Model): def __str__(self): return f'Парковочное место №{self.id}' class Reservation(models.Model): parking_space = models.ForeignKey(Parking, on_delete=models.CASCADE, related_name='reservations', verbose_name='...
727
244
# -*- coding: utf-8 -*- """RandOm Convolutional KErnel Transform (ROCKET).""" __author__ = "Matthew Middlehurst" __all__ = ["ROCKETClassifier"] import numpy as np from sklearn.linear_model import RidgeClassifierCV from sklearn.pipeline import make_pipeline from sklearn.utils.multiclass import class_distribution from...
4,875
1,481
import re from . import tables from .instr import Instruction from .instr.nop import * from .instr.alu import * from .instr.bcd import * from .instr.bit import * from .instr.flag import * from .instr.mov import * from .instr.smov import * from .instr.ld_st import * from .instr.stack import * from .instr.jmp import * f...
9,922
5,509
# import calculate # import calculate as cal # from calculate import diff as df # from calculate import * # print(cal.pi) # pi = 3.1415 # print(diff(5,2)) # print(pi) # print(calculate.pi) # print(calculate.sum(3)) # print(calculate.div(2,1)) # print(abs(-23.21)) # print(math.ceil(5.23)) # print(dir(math)) # # print(...
797
297
from abc import ABCMeta, abstractmethod import numpy as np __all__ = ['Law', 'Bin', 'Poi', 'Gau'] class Law(metaclass=ABCMeta): @staticmethod @abstractmethod def sample(n, d): pass @staticmethod @abstractmethod def loglikely(n, d, k): pass @staticmethod def likeli...
901
374
import re from .base import Widget class Canvas(Widget): def create(self): self._action('create Canvas') def set_on_draw(self, handler): self._set_value('on_draw', handler) def set_context(self, context): self._set_value('context', context) def line_width(self, width=2.0): ...
3,172
1,103
class RpnCalcError(Exception): """Calculator Generic Exception""" pass class StackDepletedError(RpnCalcError): """ Stack is out of items """ pass
164
52
from unittest import TestCase from schemer import Schema, Array, ValidationException from dusty.schemas.base_schema_class import DustySchema, DustySpecs from ...testcases import DustyTestCase class TestDustySchemaClass(TestCase): def setUp(self): self.base_schema = Schema({'street': {'type': basestring},...
3,815
1,272
from abc import ABCMeta, abstractmethod, abstractproperty from datetime import datetime, date class Item(metaclass=ABCMeta): def __init__(self, code, name, quantity, cost, offer): self.item_code=code self.item_name=name self.quantity_on_hand=quantity self.cost_price=cost sel...
5,470
1,786
#!/usr/bin/env python3 host = 'mongodb' port = 27017 ssl_ca_cert='/run/secrets/rootCA.pem' ssl_certfile='/run/secrets/tls_cert.pem' ssl_keyfile='/run/secrets/tls_key.pem' # don't turn these signal into exceptions, just die. # necessary for integrating into bash script pipelines seamlessly. import signal signal.signal(...
1,116
384
from flask import Flask, send_from_directory, request, Response, render_template, jsonify from test import demo import subprocess import os app = Flask(__name__, static_folder='static') @app.route('/') def home(): return "hello world" @app.route('/detector') def detector(): return send_from_directory(app.s...
1,087
335
""" The weak_script annotation needs to be here instead of inside torch/jit/ so it can be used in other places in torch/ (namely torch.nn) without running into circular dependency problems """ import weakref import inspect try: import builtins # PY3 except Exception: import __builtin__ as builtins # PY2 # T...
5,985
1,765
import re, requests def parse_page(url): headers = { 'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36" } response = requests.get(url, headers=headers) text = response.content.decode("utf-8") contents = re.finda...
706
284
from benchmark_query import BenchmarkQuery from clear import ClearViews, ClearQuery, ClearPublic from compare_query import CompareQuery from database import Database from setup import SetupPublic, SetupViews, SetupQuery from timing import Timing # remove all possible side effects of a query def clear_query(db: Databa...
4,267
1,247
__all__ = ['plot_cum_error_dist'] import numpy as np # import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.patches as patches from mpl_toolkits.axes_grid.inset_locator import inset_axes import itertools from . import palettes # colors = itertools.cycle(npl.palettes.color_palette(palette="sweet",...
3,787
1,325
b=input() print("A" if b=="T" else "T" if b=="A" else "G" if b=="C" else "C")
77
37
"""Setup specifications for gitignore project.""" from os import path from setuptools import setup here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup( name="wikipit", ...
847
273
import aiohttp import time import ujson import asyncio import prettyprinter import numpy as np import pandas as pd from geode.dispatcher import AsyncDispatcher prettyprinter.install_extras(include=['dataclasses']) pd.set_option('display.float_format', '{:.4f}'.format) async def main(): client = await AsyncDispa...
1,469
547
from selenium import webdriver browser = webdriver.Firefox() browser.get('http://localhost:8000') try: assert 'Django' in browser.title finally: browser.close()
171
56
from django.contrib.auth.models import User from rest_framework import viewsets from rest_framework import permissions from rest_framework.response import Response from blog.models import Post from blog.serializers import PostSerializer from blog.serializers import UserSerializer from blog.permissions import IsAuthor...
963
255
""" This script is a component of Piminder's back-end controller. Specifically, it is a helper utility to be used to intialize a database for the user and message tables. Author: Zac Adam-MacEwen (zadammac@kenshosec.com) An Arcana Labs utility. Produced under license. Full license and documentation to be found at: htt...
4,270
1,322
# -*- coding: utf-8 -*- # # Copyright 2017 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compli...
7,455
2,331
# -*- coding: utf-8 -*- """ --- Description --- Module: Logger.py Abstract: A module for logging Modified: threemeninaboat3247 2018/04/30 --- End --- """ # Standard library imports import logging logger = logging.getLogger('Kuchinawa Log') # ログレベルの設定 logger.setLevel(1...
624
266
""" Copyright 2012, 2013 UW Information Technology, University of Washington 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 r...
5,933
1,718
import pandas as pd import numpy as np from model.helper_functions import build_playlist_features print('Reading data into memory') pid_list = np.genfromtxt('../data/train_pids.csv', skip_header=1, dtype=int) playlistfile = '../data/playlists.csv' playlist_df = pd.read_csv(playlistfile) trackfile = '../data/songs_1000...
1,745
628
# routes Blueprint from flask import Blueprint, jsonify, request, redirect, render_template from flask_cors import CORS from os import environ # initializing the blueprint main = Blueprint('main', __name__) CORS(main, resources={r'*': {'origins': '*'}}) @main.after_request def after_request(response): ...
731
218
from django.test import TestCase from agenda.models import Compromisso from model_mommy import mommy class CompromissoModelTest(TestCase): def setUp(self): self.instance = mommy.make('Compromisso') def test_string_representation(self): self.assertEqual(str(self.instance), self.instance.titu...
497
157
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2022 Valory AG # Copyright 2018-2020 Fetch.AI Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # ...
1,868
572