text
string
size
int64
token_count
int64
# Copyright (c) Meta Platforms, Inc import os import sys from setuptools import find_packages, setup REQUIRED_MAJOR = 3 REQUIRED_MINOR = 7 TEST_REQUIRES = ["numpy", "pytest", "pytest-cov", "scipy"] DEV_REQUIRES = TEST_REQUIRES + [ "black", "flake8", "flake8-bugbear", "mypy", "toml", "usort"...
2,335
823
from __future__ import absolute_import from __future__ import division from __future__ import print_function import nn import tensorflow as tf from tensorflow.python.client import device_lib from numpy import min, max def model_fn(features, labels, mode, params): """Model function for airynet network""" def...
12,923
3,974
from flask import Blueprint bp = Blueprint('db_analysis', __name__, template_folder='templates', static_folder='static', static_url_path='/db_analysis/static' ) from retrobiocat_web.app.db_analysis.routes import bioinformatics, ssn
310
84
#!/usr/bin/env python3.9 """Tasks file used by the *invoke* command. This simplifies some common development tasks. Run these tasks with the `invoke` tool. """ from __future__ import annotations import sys import os import shutil import getpass from glob import glob from pathlib import Path import keyring import s...
10,249
3,574
from Jumpscale import j from io import BytesIO import binascii def main(self): """ kosmos -p 'j.servers.gedis.test("threebot_redis_registration")' """ ####THREEBOT REGISTRATION phonebook = j.threebot.package.phonebook.client_get() if j.sal.nettools.tcpPortConnectionTest("www.google.com", 44...
3,846
1,238
#!/usr/bin/env python2 # -*- coding:utf-8 -*- import os import argparse import glob from functools import partial import fontforge import psMat import source opt_parser= argparse.ArgumentParser() opt_parser.add_argument("--cjkv_info", type= str, help= u"the path of cjkv_info") opt_parser.add_argument("--region"...
2,803
1,012
import logging import pandas as pd from homeassistant.components.alarm_control_panel import ( AlarmControlPanel ) from homeassistant.core import callback from homeassistant.util import convert from .ringalarmdevice import RingAlarmDevice from .constants import * from homeassistant.const import ( STATE_ALARM_...
3,692
1,062
from sys import stdin, stdout, stderr import traceback import time from player import Player from field.field import Field class Game: def __init__(self): self.time_per_move = -1 self.timebank = -1 self.last_update = None self.max_rounds = -1 self.round = 0 self.pl...
4,224
1,195
from os import path from config.ConfigPaths import ConfigPaths class ConfigSices: """ Sices platform useful URLs """ LOGIN_URL = 'https://monitoramento.sicessolar.com.br/login' ANALYTICS_PAGE = 'https://monitoramento.sicessolar.com.br/analytics?und={code}' """ Sices platform default directories...
552
186
import click import random from pyfiglet import Figlet from termcolor import colored, cprint import imagenet @click.command() @click.option("--count", default=10, help="Yield number of codenames.") def codename_gen(count): """Enjoy the codenames 🍺""" imagenet_cls = imagenet.imagenet1000_labels() f = Figle...
757
290
import logging import json from abc import ABCMeta, abstractmethod from django.contrib import auth from django.contrib.auth import update_session_auth_hash, password_validation from django.contrib.auth.tokens import default_token_generator from django.core.exceptions import ValidationError, PermissionDenied from djang...
14,882
5,338
from libra_client.canoser import DelegateT, BytesT # Size of a X25519 private key PRIVATE_KEY_SIZE = 32 # Size of a X25519 public key PUBLIC_KEY_SIZE = 32 # Size of a X25519 shared secret SHARED_SECRET_SIZE = 32 class PrivateKey(DelegateT): delegate_type = BytesT(PRIVATE_KEY_SIZE) class PublicKey(DelegateT): ...
362
150
from plenum.common.constants import DOMAIN_LEDGER_ID from plenum.server.client_authn import CoreAuthNr from plenum.test.plugin.demo_plugin import AUCTION_LEDGER_ID from plenum.test.plugin.demo_plugin.batch_handlers.auction_batch_handler import AuctionBatchHandler from plenum.test.plugin.demo_plugin.config import get_co...
3,303
976
#+ echo=False import numpy from biobakery_workflows import utilities, visualizations, files from anadama2 import PweaveDocument document=PweaveDocument() # get the variables for this document generation task vars = document.get_vars() # determine the document format pdf_format = True if vars["format"] == "pdf" ...
5,213
1,973
# Code behind module for Shapefile_Demo.ipynb ################################ ## ## Import Statments ## ################################ # Import standard Python modules import sys import datacube import numpy as np import fiona import xarray as xr from rasterio.features import geometry_mask import shapely from sha...
1,604
418
linelist = [line for line in open('Day 02.input').readlines()] hor = 0 dep = 0 for line in linelist: mov, amount = line.split(' ') if mov == 'forward': hor += int(amount) else: dep += int(amount) * (-1 if mov == 'up' else 1) print(hor * dep)
272
103
''' This example provides three examples of a simple plot of 1-D data. 1. a publication-ready single column figure, which is printed to png (600 dpi), pdf, and svg 2. a presentation-ready figure on a black background Four steps are involved in each figure: - load/generate the data - construct a 1d plot (figure, axis,...
1,879
634
from __future__ import division from __future__ import print_function from pathlib import Path import sys project_path = Path(__file__).resolve().parents[1] sys.path.append(str(project_path)) from keras.layers import Dense, Activation, Dropout from keras.models import Model, Sequential from keras.regularize...
2,306
781
import sys import json import time import requests if len(sys.argv) < 3: raise Exception("No endpoint specified. ") endpoint = sys.argv[1] headers = { 'Host': sys.argv[2] } with open('input.json') as file: sample_file = json.load(file) inputs = sample_file["instances"] # Split inputs into chunks of size ...
832
276
import io import zlib import numpy as np def maybe_compress(str, compress): return zlib.compress(str) if compress else str def maybe_decompress(str, decompress): return zlib.decompress(str) if decompress else str def serialize_numpy(arr: np.ndarray, compress: bool = False) -> str: """Serializes numpy...
1,272
376
import hubspot.crm.extensions.videoconferencing as api_client from ....discovery_base import DiscoveryBase class Discovery(DiscoveryBase): @property def settings_api(self) -> api_client.SettingsApi: return self._configure_api_client(api_client, "SettingsApi")
278
83
from __future__ import division import logging import mxnet as mx import numpy as np from mxnet import autograd as ag, nd from mxnet import gluon from tqdm import tqdm from common.evaluate import evaluate from common.parser import TrainingParser from common.utils import average_results, format_results, get_context, ...
10,910
3,542
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import xml.etree.ElementTree as ET tree = ET.parse(sys.argv[1]) old_doc = tree.getroot() tree = ET.parse(sys.argv[2]) new_doc = tree.getroot() f = file(sys.argv[3], "wb") tab = 0 old_classes = {} def write_string(_f, text, newline=True): for t in rang...
6,187
2,070
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2017-03-29 19:12 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('contentcuration', '0058_auto_20170223_1636'), ('contentcuration', '0057_assessmentitem_delete...
357
145
from predict import predict if __name__ == "__main__": # predict() print("A ")
91
30
from is_core.main import DjangoUiRestCore from fperms_iscore.mixins import PermCoreMixin class PermDjangoUiRestCore(PermCoreMixin, DjangoUiRestCore): abstract = True
174
62
from math import cos, acos, pi, sqrt, sin class City: def __init__(self, name, lat, lon, temp): self.name = name self.lat = lat self.lon = lon self.temp = temp def describe(self): print("Die Koordinaten von %s sind %f Lat und %f Lon. Die Temperatur beträgt %.1f Grad Celc...
1,269
452
from django.apps import AppConfig class AuditingConfig(AppConfig): name = "zoo.auditing"
95
31
import click from .definition_group.apply import apply from .definition_group.diff import diff from .definition_group.generate import generate from .definition_group.create import create # from .definition_group.lint import lint @click.group(short_help="Manage API definition configuration") @click.pass_context def d...
593
158
#!/usr/bin/env python # -*- coding: utf-8 -*- """Simple color picker program.""" BANNER = """ .::::::::::::::::::::::::::::::::::::::::::::::::. .. .... .. .. ...... ... .. ...
1,761
558
"""An example of using colors module.""" import asyncio from typing import Text import cuia class ColorfulExample(cuia.Store): """A store class that shows how to use colors.""" def __str__(self) -> Text: """Show me some colors.""" res = "Colors (backgrounds):\n\n" res += "\033[40mBl...
1,176
482
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, unicode_literals from flask import current_app from . import connectors, check_respons, pager_dict from .objects.channel import Channel def get_base_url(): return current_app.config['BASE_URL'] + '/channels/' def create(exten): con = c...
2,571
790
from linkedlist import LinkedList from node import Node class IRes: def __init__(self, result, node): self.result = result self.node = node def print_nodes(n): while(n != None): print(n.data) n = n.next def tail_and_size(n): ctr = 0 while n.next: ctr += 1 ...
1,637
620
from flask import jsonify, request, g, url_for, current_app from app_core import db from app_core.api import api from app_core.api.decorators import permission_required from app_core.models import Post, Permission, Comment @api.route('/comments/') def get_comments(): page = request.args.get('page', 1, type=int) ...
2,307
792
#!/usr/bin/env python """ File Description: File used for definition of State Class. """ # ****************************************** Libraries to be imported ****************************************** # from copy import deepcopy # ****************************************** Class Declaration Start *****...
2,557
689
from ckantoolkit import get_or_bust, side_effect_free, ObjectNotFound from ckanext.scheming.helpers import ( scheming_dataset_schemas, scheming_get_dataset_schema, scheming_group_schemas, scheming_get_group_schema, scheming_organization_schemas, scheming_get_organization_schema, ) @side_effect_free d...
2,240
708
#!/usr/bin/python import json from urllib import urlopen # http://api.nytimes.com/svc/search/v2/articlesearch.json?fq=Obama&FACET_FIELD=day_of_week&BEGIN_DATE=19000101 # &API-KEY=5772CD9A42F195C96DA0E930A7182688:14:68439177 # The original link is above. What happens is because we don't specify an end date, the panda a...
2,700
1,086
from typing import List from yearmonth.yearmonth import YearMonth import pydantic class MyModel(pydantic.BaseModel): ym: YearMonth def test_pydantic_validators(): MyModel(ym=(2021, 1)) MyModel(ym='2021-01') MyModel(ym=('2021', '01')) def test_pydantic_schema(): schema = MyModel.schema() ...
694
264
import tkinter.messagebox from tkinter import * from tkinter import ttk from tkinter import filedialog import threading from pygame import mixer from mutagen.mp3 import MP3 import os import easygui import time import playlist_window as pw import Main as main #from PIL import ImageTk,Image def redirect(pa...
353
115
import os import sys import jinja2 import yaml with open(".information.yml") as fp: information = yaml.safe_load(fp) loader = jinja2.FileSystemLoader(searchpath="") environment = jinja2.Environment(loader=loader, keep_trailing_newline=True) template = environment.get_template(sys.argv[1]) result = template.rend...
569
193
# AUTHOR: Louis Tsiattalou # DESCRIPTION: Init for Tests.
58
24
#!/usr/bin/python ################################################################################ import numpy import os import cPickle as pickle import scipy.misc import scipy.sparse import scipy.sparse.linalg import scipy.special import sys import time class Struct: def __init__(self, **keywords): self.__dict_...
29,541
13,873
from holobot.framework.lifecycle import LifecycleManagerInterface from holobot.sdk import KernelInterface from holobot.sdk.database import DatabaseManagerInterface from holobot.sdk.integration import IntegrationInterface from holobot.sdk.ioc.decorators import injectable from holobot.sdk.logging import LogInterface from...
2,343
620
from netdisc.snmp import snmpbase
34
13
#!/usr/bin/python # (c) 2018, NetApp, Inc # GNU General Public License v3.0+ # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], ...
13,063
3,676
def convert_sample_to_shot_wow(sample, with_knowledge=True): prefix = "Dialogue:\n" assert len(sample["dialogue"]) == len(sample["meta"]) for turn, meta in zip(sample["dialogue"],sample["meta"]): prefix += f"User: {turn[0]}" +"\n" if with_knowledge: if len(meta)>0: ...
1,200
393
# Generated by Django 3.2.9 on 2021-11-27 12:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('notice', '0002_auto_20211127_0236'), ] operations = [ migrations.AlterField( model_name='event', name='priority', ...
487
188
""" Settings """ from yaa_settings import AppSettings class PrivacySettings(AppSettings): # Name of the model attribute for a privacy definition GDPR_PRIVACY_CLASS_NAME = "PrivacyMeta" # Name of the model attribute for the privacy definition instance GDPR_PRIVACY_INSTANCE_NAME = "_privacy_meta" ...
650
215
import pytest import requests def aslist_cronly(value): """ Split the input on lines if it's a valid string type""" if isinstance(value, str): value = filter(None, [x.strip() for x in value.splitlines()]) return list(value) def aslist(value, flatten=True): """ Return a list of strings, separ...
2,382
807
import pytest import data_pipeline.db.factory as dbfactory import data_pipeline.constants.const as const from data_pipeline.db.exceptions import UnsupportedDbTypeError @pytest.mark.parametrize("dbtype, expect_class", [ (const.ORACLE, "OracleDb"), (const.MSSQL, "MssqlDb"), (const.POSTGRES, "PostgresDb"), ...
635
228
import math import re from data_extraction.scraper import Scraper class SozialeinsatzScraper(Scraper): """Scrapes the website www.sozialeinsatz.de.""" base_url = 'https://www.sozialeinsatz.de' debug = True def parse(self, response, url): """Handles the soupified response of a detail page in...
5,142
1,489
""" Implements the base Parser as a Context Manager. """ from abc import ABCMeta, abstractmethod class Parser: """ Base abstract class for a parser. Further parsers should inherit from this and override the abstract parse() method. """ __metaclass__ = ABCMeta def __init__(self, filename)...
1,671
428
from __future__ import print_function # from tqdm import tqdm import argparse import glob import os import pickle import boto3 import numpy as np import pandas as pd import encoding import kg # tqdm.pandas() # pandarallel.initialize(progress_bar=True) # bucket = os.environ.get("BUCKET_NAME", " ") # raw_data_folder ...
10,223
3,908
""" Utils ======= Contains multipurpose utilities for serializing objects and obtaining arguments from the command line. .. Copyright: Copyright 2019 Wirepas Ltd under Apache License, Version 2.0. See file LICENSE for full license details. """ import binascii import datetime impor...
5,054
1,389
from pysph.base.tree.tree import Tree from pysph.base.tree.helpers import ParticleArrayWrapper, get_helper, \ make_vec_dict, ctype_to_dtype, get_vector_dtype from compyle.opencl import profile_kernel, DeviceWGSException, get_queue, \ named_profile, get_context from compyle.array import Array from pytools import...
25,733
8,389
# encoding: utf8 import numpy as np import pandas as pd from collections import OrderedDict from senti_analysis import config from senti_analysis import constants from senti_analysis.preprocess import (load_tokenizer, load_sentences, encode_sentence, label_transform) def load_...
2,815
971
from dataclasses import dataclass @dataclass class StatsGroup: displayName: str = None
93
28
from skeleton_says import say skeleton_saying_hello = r""" ------- ( Hello ) ------- \ \ .-. \(o.o) |=| __|__ //.=|=.\\ // .=|=. \\ \\ .=|=. // \\(_=_)// (:| |:) || || () () || || || || l42 ==' '== """ def test_say_command_says_hello() -> None: assert say....
358
155
"""Tests for accounts tasks.""" from datetime import datetime from unittest import TestCase from django.conf import settings from django.utils.timezone import now from mock import patch from model_mommy import mommy from open_connect.accounts.models import Invite from open_connect.accounts.tasks import ( render_a...
1,710
517
# Test cases that are expected to fail, e.g. unimplemented features or bug-fixes. # Remove from list when fixed. xfail = { "namespace_keywords", # 70 "googletypes_struct", # 9 "googletypes_value", # 9 "import_capitalized_package", "example", # This is the example in the readme. Not a test. } se...
944
290
from django.conf import settings from django.urls import include, path, re_path from django.contrib import admin from ariadne_django.views import GraphQLView from wagtail.admin import urls as wagtailadmin_urls from wagtail.core import urls as wagtail_urls from wagtail.documents import urls as wagtaildocs_urls from p...
1,476
466
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `certifiable.core.certify_timestamp` method.""" import datetime import unittest from decimal import Decimal from certifiable import CertifierTypeError from certifiable.core import certify_timestamp class CoreCertifyTimestampTestCase(unittest.TestCase): ...
1,311
379
#!/usr/bin/env python # -*- coding: utf-8 -*- # -*- Python -*- """ \file com_replace_idl_examplefile.py \brief Python example implementations generated from com_replace.idl \date $Date$ """ import omniORB from omniORB import CORBA, PortableServer import _GlobalIDL, _GlobalIDL__POA class ComReplace_i (_GlobalID...
1,477
499
from io import open from typing import List from pyknp import KNP, BList def read_knp_result_file(filename: str) -> List[BList]: """Read a KNP result file. Args: filename: A filename. Returns: A list of :class:`pyknp.knp.blist.BList` objects. """ knp = KNP() blists = [] ...
588
190
from cv2 import fastNlMeansDenoisingColored from cv2 import cvtColor from cv2 import bitwise_not,threshold,getRotationMatrix2D from cv2 import warpAffine,filter2D,imread from cv2 import THRESH_BINARY,COLOR_BGR2GRAY,THRESH_OTSU from cv2 import INTER_CUBIC,BORDER_REPLICATE,minAreaRect from numpy import column_stack,array...
2,272
784
import yaml import matplotlib.pyplot as plt import math from jsonmerge import merge from datetime import datetime import plotly as ply import pandas as pd import plotly.express as px TRANSFORM = False PLOT_MEMORY = True NB_INSTRUCTIONS = 1000 f_value_props = { # [Color, MinOffset, MaxOffset] "total_collateral...
5,944
2,336
class Settings: BOT_KEY = "" HOST_NAME = "127.0.0.1" USER_NAME = "root" USER_PASS = "Andrey171200" SQL_NAME = "moneysaver"
143
70
from otree.api import * c = Currency doc = """ Simple Consent App Players may only continue after clicking the consent button. """ class Constants(BaseConstants): name_in_url = 'consent' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): p...
525
180
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Copyright 2019-2020 Airinnova AB and the FramAT authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ...
1,192
382
from test.base import BaseTestCase, user_payload import json class TestAuth(BaseTestCase): def test_authenticate(self): response = self.client.post('/auth', data=json.dumps(user_payload), content_type='application/json') response_data = json.loads(response.data) self.assert200(response) self.assertEqual(re...
587
199
import os import fnmatch from pathlib import Path from jinja2 import Template from .Metadata import Metadata class JSGenerator: def __init__(self, j): """ """ self._j = j self._generated = False def _check_process_file(self, path): bname = os.path.basename(path) ...
5,918
1,804
""" HyperOne HyperOne API # noqa: E501 The version of the OpenAPI document: 0.1.0 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 from h1.api_client import ApiClient, Endpoint as _Endpoint from h1.model_utils import ( # noqa: F401 check_allowe...
76,810
18,593
from collections import defaultdict from typing import List, Tuple from aocd import get_data, submit DAY = 5 YEAR = 2021 def part1(data: str) -> str: segments = read(data) covered = defaultdict(int) for segment in segments: x1, y1, x2, y2 = segment if x1 != x2 and y1 != y2: c...
2,059
770
import random class Solution: def findKthLargest(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ if nums is None or len(nums)==0: return nums nums = self.quickSort(nums,0,len(nums)-1,k) return nums[k-1] ...
1,108
449
{ "targets": [ { "target_name": "binding", "sources": [ "native\\winhttpBindings.cpp" ], "include_dirs": [ "<!@(node -p \"require('node-addon-api').include\")" ], "libraries": [ "WinHTTP.lib", "-DelayLoad:node.exe" ], "msbuild_settings": { "ClCompile"...
383
189
import glob import numpy as np #import cv2 from PIL import Image #import os.path class ImgReader: def __init__(self): pass @staticmethod def read_directory(dir_path, file_format=None): try: images = [np.asarray(Image.open(img_path).convert('L'), dtype=np.uint8) ...
2,122
721
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
3,351
1,035
import os import sys import shutil import random import stat import string import logging from git import Repo try: # macOS BASE_CLONE_LOCATION = os.path.join(os.path.dirname(sys.modules['__main__'].__file__), "current_clone") except: # Windows BASE_CLONE_LOCATION = os.path.join(os.getcwd(), "current_clone") ...
1,455
499
from unittest import TestCase import json import odmlib.odm_1_3_2.model as ODM class TestFormDef(TestCase): def setUp(self) -> None: attrs = self.set_formdef_attributes() self.formdef = ODM.FormDef(**attrs) def test_add_description(self): tt1 = ODM.TranslatedText(_content="this is the...
6,671
2,332
from src.Utilities import cmd_logger from src.Utilities import metadata_worker from src.Utilities import misc from src.Utilities import runner
143
38
import calendar import logging from collections import namedtuple from datetime import datetime, timedelta from db_eplusout_reader.constants import RP, TS, A, D, H, M from db_eplusout_reader.exceptions import LeapYearMismatch, StartDayMismatch EsoTimestamp = namedtuple("EsoTimestamp", "month day hour end_minute") d...
9,062
2,805
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="parentopticon", version="0.0.1", author="Eli Ribble", author_email="junk@theribbles.org", description="A system for controlling kids access to computers.", long_description=long_description, long_descript...
772
326
import cv2 import numpy as np import matplotlib.pyplot as plt from findpoint import FindPoint class LineDetector: def __init__(self,img): self.frame = None self.leftx = None self.rightx = None # self.output = None self.frame = 0 self.frame_list = [] self.fi...
11,701
4,099
from django.db import models from django.db.models import Q from django.utils import timezone class BroadcastManager(models.Manager): """ Manager class to show only active broadcast messages """ def active(self): """Return only active messages""" return super(BroadcastManager, self).f...
767
209
# -*- coding: utf-8 -*- # 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
11,114
3,077
# Units tests to directly cover both task wrapper modules - # not possible with pytest parametrization import pytest import sys from collections import defaultdict from peeringdb import _tasks_sequential TASKS_MODS = [_tasks_sequential] # pre-async compat. import if sys.version_info >= (3, 5): from peeringdb imp...
1,728
565
""" Problem: The maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers (containing at least one positive number) which has the largest sum. Solution: The recurrence relation that we solve at each step is the following - Let S[i] = be the max value contigous ...
1,074
423
from user_portrait import SaveUserProfile from action_profile_recall import save_inverted_table, SaveUserRecall from movie_recall import SaveMovieRecall from movie_portrait import save_topic_weights_normal, save_predata, save_textrank, save_cut_words, save_tfidf, \ save_topK_idf_textrank, save_topK_tfidf_textrank, ...
3,215
1,389
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # # pyre-strict from typing import Union import libcst import libcst.matchers as m from libcst import parse_expression from libcst.codemod imp...
1,962
543
from typing import Dict, Union from nasa_fevo.Cache import Cache from datetime import datetime CACHE_EXPIRATION_TIMER_MINUTES = 10 # very simple in-memory cache # meant for small # of items class InMemoryCache(Cache): def __init__(self): self.store: Dict[str, object] = {} def get(self, key: str) -> ...
1,309
410
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 27 20:45:40 2020 @author: P.A. Perez-Toro """ #%%Libraries import argparse from utils import create_fold,str2bool import csv from tqdm import tqdm import os import gc import numpy as np import pandas as pd from WEBERT import BERT, BETO, SciBERT #...
5,079
1,703
# Zaimplementować funkcję n_sums(n: int) -> listint, która zwróci wszystkie n-cyfrowe liczby o takich samych sumach na indeksach parzystych i nieparzystych. Przykładowo, dla 3 cyfr będą to liczby m.in. 198, 220, 891, 990 def n_sums(n: int): print(n_sums(3))
264
121
"""Helper to convert Python data structures into XML. Used so we can return intuitive data from resource methods which are usable as JSON but can also be returned as XML. """ import re from xml.sax.saxutils import escape as xml_escape # Regular expression matching all the illegal XML characters. RE_ILLEGAL_XML = re.co...
2,327
825
import re import simplejson as json from django.core.urlresolvers import reverse from django.db.models import Q, Min, F, Sum from django.db import connection from django.conf import settings from django.db.models.functions import Concat from django.views.decorators.csrf import csrf_exempt from django.shortcuts import...
45,700
15,685
# ==================================================================================================================== # # _____ _ _ ____ _ ___ _ _ _ _ _ # # _ __ _ |_ _|__ ___ | (_)_ __ __ _ / ___| | |_ _| / \ | |__ _...
13,671
4,085
import base64 import json import logging import os from decimal import Decimal import boto3 """ environment variables: export AWS_ENDPOINT=http://localhost:4566 export TABLE_NAME=table_xy # for direct local execution: export AWS_DEFAULT_REGION=localhost export AWS_ACCESS_KEY_ID=access_key_id e...
1,601
557
# ------------------------------------------------------------------------------- # Name: sfp_psbdmp # Purpose: Query psbdmp.cc for potentially hacked e-mail addresses. # # Author: Steve Micallef <steve@binarypool.com> # # Created: 21/11/2016 # Copyright: (c) Steve Micallef # Licence: MIT # ...
3,816
1,161
import os import re import socket from dotenv import load_dotenv from dcr.scenario_utils.common_utils import execute_command_and_raise_on_error from dcr.scenario_utils.models import get_vm_data_from_env def test_agent_version(): stdout, _ = execute_command_and_raise_on_error(['waagent', '-version'], timeout=30)...
3,216
1,038
#!/usr/bin/env python3 # # This file includes mainly a class "randomEpisode" that: # - draws localization of vehicle # - draws number of rocks # - draws position of each rock # - save in a json file # Author: Michele # Project: SmartLoader - Innovation import json import random from ge...
9,033
2,856
#!/usr/bin/env python # Copyright (c) 2009-2016 Simon van Heeringen <simon.vanheeringen@gmail.com> # # This module is free software. You can redistribute it and/or modify it under # the terms of the MIT License, see the file COPYING included with this # distribution. from gimmemotifs.motif import pwmfile_to_motifs ...
587
218