text
string
size
int64
token_count
int64
# -*- coding: utf-8 -*- """ Created on Mon May 18 14:30:15 2015 @author: Alexander """ import unittest import PropensityScoreMatching as PSM import pandas as pd import numpy as np import os LOCAL_DIR = os.path.dirname(__file__) FILENAMES = [os.path.join('results', 'nsw_all_random1_pscoresimple.csv'), os....
12,270
4,475
# Copyright 2015 VMware, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
12,285
3,941
import keras from keras.models import Model, model_from_json import numpy as np import json def denormalize(y, exp, highest, lowest): y *= highest y += lowest y /= 10 ** exp return y with open("model.json", "r") as model_fp: model_json = model_fp.read() with open("norm_param.json", "r") as norm_f...
1,613
564
from random import randint FELD_BREITE = 15 FELD_HOEHE = 10 ANZAHL_MINEN = randint( int(FELD_BREITE * FELD_HOEHE * 0.1), int(FELD_BREITE * FELD_HOEHE * 0.2) ) WIDTH = FELD_BREITE * 20 HEIGHT = FELD_HOEHE * 20 feld = [] def minen_verteilen(anzahl): for i in range(FELD_BREITE): fe...
2,204
918
# -*- coding: utf-8 -*- from io import BytesIO import base64 from django import template from django.utils.safestring import mark_safe # We need a registration instance in order to configure everything with Django register = template.Library() @register.filter(name="matplotlib_figure", is_safe=True) def matplotlib...
1,853
580
#!/usr/bin/python3 ## author: jinchoiseoul@gmail.com from math import inf def single_bit_ceil(n): ''' @return largest `1<<m` satisfying `2**m >= n` Note: 1<<m == 2**m ''' if n==0: return 0 p = 1 while p < n: p <<= 1 assert p >= n return p def single_bit_floor(n): ''' @r...
1,621
626
from __main__ import ( app, session, redirect, render_template, request, jsonify, uuid4, USERS, ) from json import ( dumps, ) # https://stackoverflow.com/questions/11994325/how-to-divide-flask-app-into-multiple-py-files ### LOGIN ### @app.route("/login") def login(): if "user" ...
2,637
793
import tensorflow as tf from My_NN.My_Net.Attention_Decoder import Attention_Decoder batch_size = 64 num_char_classes = 27 img = tf.placeholder(tf.float32,[64,16,16,728]) lstm_cell = tf.contrib.rnn.LSTMCell( 256, state_is_tuple=True,) zero_label = tf.zeros([batch_size, num_char_classe...
772
256
#!/usr/bin/python3 import re import urllib from urllib import parse import subprocess url = "https://www.google.ie/search?q=play+arijit+singh+songs&oq=play+arijit+singh+songs&aqs=chrome..69i57.16305j0j4&sourceid=chrome&es_sm=119&ie=UTF-8" p = parse.urlparse(url) if (re.match("^www.google..*", p.hostname)): query =...
619
278
from astropy import cosmology as cosmo from autogalaxy.cosmology.wrap import FlatLambdaCDM from autogalaxy.cosmology.wrap import FlatwCDM class Planck15Om0(FlatLambdaCDM): def __init__(self, Om0: float = 0.3075): planck15 = cosmo.Planck15 super().__init__( H0=planck15.H0...
937
399
"""Support code for distutils test cases.""" import os import shutil import tempfile from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL from distutils import log from distutils.dist import Distribution from distutils.cmd import Command class LoggingSilencer(object): def setUp(self): super(LoggingS...
3,210
955
# coding=utf-8 python3.6 # ================================================================ # Copyright (C) 2019 * Ltd. All rights reserved. # license='MIT License' # Author : haibingshuai  # Created date: 2019/10/29 18:05 # Description : # ===============================================================...
2,250
814
# 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 agreed to in writing, ...
1,975
666
# Copyright 2019, Oath Inc. # Licensed under the terms of the Apache 2.0 license. # See LICENSE file in http://github.com/yahoo/prototrain for terms. import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import logging logging.getLogger('tensorflow').disabled = True import sys import json import tensorflow as tf import...
1,843
548
from ...base import BaseAPIClass class Color(BaseAPIClass): """Represents the java.awt.Color class.""" def __init__(self, r: int, g: int, b: int): """Initialize the color in RGB format.""" self._set_color('r', r) self._set_color('g', g) self._set_color('b', b) def _set_color(self, name, value): if 0 <=...
865
446
import numpy as np from scipy.spatial import HalfspaceIntersection, ConvexHull from pano import pano_connect_points def np_coorx2u(coorx, coorW=1024): return ((coorx + 0.5) / coorW - 0.5) * 2 * np.pi def np_coory2v(coory, coorH=512): return -((coory + 0.5) / coorH - 0.5) * np.pi def np_coor2xy(coor, z=50...
6,377
2,768
from simple_ddl_parser import DDLParser def test_json_dump_arg(): ddl = """ CREATE TABLE list_bucket_single (key STRING, value STRING) SKEWED BY (key) ON (1,5,6) STORED AS DIRECTORIES; """ parse_results = DDLParser(ddl).run(output_mode="hql", json_dump=True) expected = ( '[{"columns": ...
1,167
399
"""Utility functions regarding property and parameter interfaces __author__ = Sasha Ouellet (www.sashaouellet.com) __version__ = 1.0.0 __date__ = 12/10/17 """ import hou def initRopNotificationProperty(node): """Given a ROP node, replaces the execute button with an identical button that launches a notification aft...
3,341
1,197
"""Intro to Python - Part 1 - Hands-On Exercise.""" import math import random # TODO: Write a print statement that displays both the type and value of `pi` pi = math.pi print(pi) # TODO: Write a conditional to print out if `i` is less than or greater than 50 i = random.randint(0, 100) if i<50 : print("i is le...
891
320
# coding: utf-8 """Tasks to put repositories on the ISO. This modules provides several services: - build a unique container image for all the build tasks - downloading packages and repositories - building local packages from sources - building local repositories from local packages Note that for now, it only works ...
14,066
4,605
class Context(object): def __init__(self, cross_table=[], objects=[], attributes=[]): """Create a context from cross table and list of objects, list of attributes cross_table - the list of bool lists objects - the list of objects attributes - the list of attributes ...
9,387
2,631
#!/usr/bin/env python3 import dotenv, os, datetime, time, traceback, sys, json, requests, uuid # Load environment variables dotenv.load_dotenv() API_KEY = os.getenv('XNG_MASTER_API_KEY') XNG_USER = os.getenv('XNG_APP_USER') XNG_PASS = os.getenv('XNG_APP_PASSWORD') WEB_TRACKING_KEY = os.getenv('XNG_WEB_TRACKING_KEY') ...
13,464
4,123
import os.path as op from traitlets import Unicode, TraitError, List from keras.models import Model from h5py import File as H5File class File(Unicode): """Trait representing a file.""" def validate(self, obj, value): super(File, self).validate(obj, value) if value: if not op.isfi...
1,743
466
from coincurve import PublicKey import structlog from raiden.utils import sha3, publickey_to_address log = structlog.get_logger(__name__) # pylint: disable=invalid-name def recover_publickey(messagedata, signature, hasher=sha3): if len(signature) != 65: raise ValueError('invalid signature') signa...
1,738
541
__author__ = 'Ahmed' def _add_extra_to_name(file_name): file_name = file_name.split('.') file_name[0] += '_extra' return '.'.join(file_name) FILES_DIR = '/home/vagrant/workspace/ArgoBench/ArgoJsonRDBMS/' ARGO_FILENAME = 'nobench_data_argo.json' GENERIC_FILENAME = 'nobench_data.json' MONGO_FILENAME = 'nob...
898
397
#!/usr/bin/env python import os import string import sys import pickle import shlex import subprocess from optparse import OptionParser from os.path import expanduser, abspath, dirname, join import ConfigParser Config = ConfigParser.ConfigParser() Config.read('benchmark.cfg') def parse_args(): """ Argument parsi...
4,423
1,327
# # ------------------------------------------------------------------------- # Copyright (c) 2019 AT&T Intellectual Property # # 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 # # ...
3,856
1,165
from __future__ import division from __future__ import print_function import argparse import time import random import copy import tensorflow as tf import numpy as np from matplotlib import pyplot as plt from ptb_reader import ptb_raw_data from custom_lstm import CustomLSTMCell, CustomMultiRNNCell # Adapted from htt...
9,993
4,579
""" Common namespace of statistical functions """ # flake8: noqa from pandas.stats.moments import *
102
33
from django.forms import ModelForm from django import forms from .models import Historias from ..diagnosticos.models import Diagnosticos from ..anamnesis.models import Anamnesis from ..antecedentes_personales.models import AntecedentesPersonales from ..habitos.models import Habitos from ..antecedentes_familiares.model...
2,159
627
"""Contains functions used for DOS module""" def DOS(dim): import numpy as np Es = np.linspace(-2, 10, 600) m_e = 0.8 * 9.11e-31 #kg hbar = 1.054e-34 # m^2kg/s if dim == 3: gE = 1/(2*np.pi**2)*(2*m_e/hbar**2)**(3/2)*np.sqrt(abs(Es)) if dim == 2: gE= m_e/(np.pi*hbar**2)*np...
3,846
1,906
from django.db import models class City(models.Model): name = models.CharField(max_length=25) def __str__(self): # show the actual city name on the dashboard return self.name class Meta: # show the plural of city as cities instead of cities verbose_name_plural = 'cities' ''' This will create a table ...
666
218
import glob import subprocess import torch from os import path as osp paths = glob.glob('experiments/pretrained_models/*.pth') for idx, path in enumerate(paths): print(f'{idx+1:03d}: Processing {path}') net = torch.load(path, map_location=torch.device('cpu')) basename = osp.basename(path) if 'params' ...
1,207
392
#!/usr/bin/env python3 import logging import os import butterfly_bot.cogs import discord from discord.ext import commands from discord_slash import SlashCommand from dotenv import load_dotenv from version import get_bot_version load_dotenv() logging.basicConfig(level=logging.INFO) logger = logging.getLogger("adonis_...
975
353
""" This script will create 10 random file sized between 64KB to 20 MB and upload it to specified versioned container. Install boto package on machine to run this script. """ import boto.s3.connection import boto import os from random import randint access_key = '<s3 access key>' secret_key = '<s3 secret key>' conn ...
1,053
399
from django.db import models from constants import * from bidding_round.bidding_round_helper import get_start_date_third_party, get_end_date_third_party, \ get_publication_date_third_party, get_end_date_staff, get_start_date_staff, get_publication_date_staff, \ get_start_date_moderator, get_end_date_moderator, ...
2,632
785
import os import shutil import tempfile tmpdir = os.path.join(tempfile.gettempdir(), "modelforge-tests") shutil.rmtree(tmpdir, ignore_errors=True) VENDOR = os.path.relpath(tmpdir, os.getcwd()) BACKEND = "gcs" BACKEND_ARGS = "bucket=models.cdn.srcd.run,credentials=" ALWAYS_SIGNOFF = True
289
117
from django.core.urlresolvers import reverse from django.test import TestCase from django.contrib.auth import get_user_model from apps.web.models import (Competition, CompetitionParticipant, ParticipantStatus,) User = get_user_model() class CompetitionSecret...
2,925
931
import gzip import json from typing import Any, Dict from unittest import mock from queuery_client.response import Response, ResponseBody class MockResponse: def __init__(self, content: bytes, status_code: int) -> None: self.content = content self.status_code = status_code def json(self) -> ...
1,929
606
### Auto-generated colormap tables, taken from Matplotlib ### import numpy as np from numpy import array color_map_luts = {} ### RdBu ### color_map_luts['RdBu'] = \ ( array([ 0.40392157, 0.4154556 , 0.42698963, 0.43852365, 0.45005768, 0.4615917 , 0.47312573, 0.48465976, 0.49619378, 0.50772781, ...
585,710
506,096
#!/usr/bin/python from flask import Flask, json, request, render_template, \ jsonify, redirect, url_for from flask import make_response from app import app, db, models import app as app_globals import uuid from flask.ext.sqlalchemy import SQLAlchemy from models import PhysicalMachines, VirtualMachine, Volume import os...
12,555
5,237
__author__ = 'Jason' import unittest import icalendar import icalendar.cal import icalendar.parser_tools import icalendar.parser import icalendar.prop import cal_tools.ijconvert import json import yaml class IJConvertTest(unittest.TestCase): def test_empty_vcalendar(self): # Arrange. expected_r...
3,668
1,341
from unittest.mock import patch import click from click.testing import CliRunner from rubicon_ml.cli import cli def mock_click_output(**server_args): click.echo("Running the mock server") @patch("rubicon_ml.ui.dashboard.Dashboard.run_server") @patch("rubicon_ml.ui.dashboard.Dashboard.__init__") def test_cli(m...
642
217
#!/usr/bin/env python # TODO: # Importer un fichier ou un groupe de fichiers dans un zip, et renvoyer un document RDF # qui en represente l'analyse. # Et meme: Creer une session dans laquelle on va stocker les fichiers utilisateurs en isolation, # un peu comme un dossier FTP, qui sera un environnement associe a un u...
415
127
import os import sys from setuptools import setup VERSION = '1.3' if sys.argv[-1] == 'publish': if os.system("pip freeze | grep wheel"): print("wheel not installed.\nUse `pip install wheel`.\nExiting.") sys.exit() if os.system("pip freeze | grep twine"): print("twine not installed.\nUs...
2,381
754
"""Tests for the Shapley effects. This module contains all tests for th Shapley effects. """ import chaospy as cp import numpy as np import pandas as pd from numpy.testing import assert_array_almost_equal as aaae from econsa.shapley import _r_condmvn from econsa.shapley import get_shapley def test_get_shapley_exac...
3,561
1,433
valor = float(input('Valor da casa: ')) salario = float(input('Salário: ')) meses = int(input('Meses para pagar:')) parcela = valor/meses if parcela > (salario*0.30): print('---Empréstimo negado---') else: print('---Empréstimo aceito---')
247
96
class MagicDictionary: def __init__(self): """ Initialize your data structure here. """ from collections import defaultdict self.var = defaultdict(set) def buildDict(self, dict): """ Build a dictionary through a list of words :type dict: List[str...
961
281
""" 13) Faça um algoritmo que calcule a média ponderada das notas de 3 provas. A primeira e a segunda prova têm peso 1 e a terceira tem peso 2. Ao final, mostrar a média do aluno e indicar se o aluno foi aprovado ou reprovado. A nota para aprovação deve ser igual ou superior a 60 pontos. """ nota_prova01 = float(input...
1,110
444
# set representation to bit representation and then return answer # to read input form file a,arr= [],[] start,end = 4,5 with open('Naive Algo\Input\demo2') as file: for line in file: line = line.strip() for c in line: if c != ' ': # print(int(c)) a.appen...
1,796
684
import numpy as np import scipy.sparse as sp def nonzero_mean(X, axis=0): """Compute the mean of non-zero values in a given matrix. Parameters ---------- X: array_like axis: int Returns ------- np.ndarray """ if sp.issparse(X): if axis == 0: X = X.tocsc()...
3,275
1,095
import cv2 import mediapipe as mp import matplotlib.pyplot as plt import matplotlib import numpy as np import pandas as pd import time mp_drawing = mp.solutions.drawing_utils mp_holistic = mp.solutions.holistic count = 0 alldata = [] fps_time = 0 pose_tubuh = ['NOSE', 'LEFT_EYE_INNER', 'LEFT_EYE', 'LE...
5,733
2,246
import tensorflow as tf from tensorflow.keras.activations import sigmoid from tensorflow.keras.layers import Dense, Flatten from easyrec import blocks class FNN(tf.keras.Model): """ Factorization-machine supported Neural Network (FNN). Reference: Weinan Zhang. Deep Learning over Multi-field Categorical D...
1,881
580
import requests import json import sys if __name__ == "__main__": try: REGIONS_NAMES = json.load(open("regions.json", "r")) except Exception as e: print(e) URL = "https://api.cloudping.co/averages" r = requests.get(URL) regions = [] b_selected = False for reg in r.json(): regions.append(reg["region...
1,340
581
""" A simple example for Reinforcement Learning using table lookup Q-learning method. An agent "o" is on the left of a 1 dimensional world, the treasure is on the rightmost location. Run this program and to see how the agent will improve its strategy of finding the treasure. The initial position is random in my versio...
1,828
645
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from telemetry.page import page as page_module from telemetry import story _PAGE_TAGS_LIST = [ # Audio codecs: 'pcm', 'mp3', 'aac', 'vorb...
14,082
5,129
# Copyright 2018 The Fuego 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 or agreed to in wr...
5,262
1,602
import os import sys import cv2 import glob import numpy as np def img2mp4(paths, pathOut, fps): frame_array = [] for idx, path in enumerate(paths): ff = np.fromfile(path, np.uint8) img = cv2.imdecode(ff,1) height, width, layers = img.shape size = (width, height) frame_array.append(img) out...
922
401
import unittest import attr from ndk.objects.command import Email as SendByEmail from ndk.objects.contact import Contact, Email from ndk.objects.timeperiod import TwentyFourSeven from ndk.options import contact as options from ndk.stack import Stack # import HostNotifications, ServiceNotifications class ContactTest...
1,834
489
# -*- coding: utf-8 -*- # Scrapy settings for eccrawler project # # For simplicity, this file contains only the most important settings by # default. All the other settings are documented here: # # http://doc.scrapy.org/en/latest/topics/settings.html # BOT_NAME = 'eccrawler' SPIDER_MODULES = ['eccrawler.spiders'...
659
244
from django.urls import path from .views import QAView, AnswerView from . import views urlpatterns = [ path('answer/<int:question_id>/', AnswerView.as_view(), name="answer"), path('moderation/', QAView.as_view(), name="moderation"), path('answer/all/', views.allQuestions, name='all'), path('ans...
397
138
# -*- coding: utf-8 -*- import subprocess from flask import current_app def try_optimize_svg(original: str) -> str: if not current_app.config['SVG_OPTIMIZE_ENABLE']: return original args = [ current_app.config['SVGO_PATH'], '--input', '-', '--output', '-', '--config', ...
1,119
316
from yaml import FullLoader, load __all__ = ( 'config', ) def config(): with open(f'config.yml') as file: return load(file, Loader=FullLoader)
161
56
from __future__ import division inner_phil_str = """\ scanbox_windows = 101 51 51 #.type = ints(size_min=1, size_max=3, value_min=10) # future: variable number of window passes .type = ints(size=3, value_min=10) .help = "Integer scanbox sizes for calculating background," "for cycles 1,2, ...
6,297
2,251
""" Desenvolva um programa que leia o primeiro termo e a razão de uma PA. No final, mostre os 10 primeiros termos dessa progressão. Get up on the floor Dancin' all night long Get up on the floor Dancin' till the break of dawn Get up on the floor Dancin' till the break of dawn ...
533
196
import numpy from PIL import Image charScale = "MNBKVFT|;:." #List of characters from light to dark by apparant shading def imgToAscii(imgPath): #Read image img = Image.open(imgPath, "r") #Reduce image size scaleSize = (300, int(img.size[1] * (150/img.size[0]))) #Double width as characters are taller than the...
1,284
467
# Copyright 2019-2020 Stanislav Pidhorskyi # # 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 i...
16,564
6,441
import pytest def test_token__decode_web_token__1(token): """Raises ValueError on invalid token.""" with pytest.raises(ValueError) as err: token.decode({'token': 'asdf'}, 'jwt-application-public', 'asdf') assert 'Not enough segments' == str(err.value) def test_token__decode_web_token__2(token): ...
2,402
803
# Convertendo Km/h para milhas km_h = float(input('Entre com a distancia em KM/h: ')) milhas = km_h / 1.62 print(milhas)
121
54
from imports import * def gen_coords_c(N, M): # generate graphene's coordinates a0 = 142.1 s3 = (3.) ** 0.5 coords = [] full_topo = {} x0 = s3 * a0 / 2. x1 = 0. for m in range(M): y0 = 0. y1 = a0 / 2. y2 = a0 * 1.5 y3 = a0 * 2. z = 0. for n ...
11,619
5,103
#!/usr/bin/env python '''This script generates, runs, and then deletes a Makefile which will compile a Python script into a standalone executable which is statically linked to the Python runtime. To use this script, first generate a static Python library (see the parent directory's README.md). Usage: python s...
3,497
1,206
#!/usr/bin/python # -*- encoding: utf-8; py-indent-offset: 4 -*- # +------------------------------------------------------------------+ # | ____ _ _ __ __ _ __ | # | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ /...
12,691
4,175
# Generated by Django 2.0.6 on 2018-06-18 18:20 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('routes', '0002_auto_20180618_1417'), ] operations = [ migrations.AddField( model_name='destinat...
484
174
from tempfile import gettempdir import os import os.path as osp import sqlite3 import pytest from permadict import Permadict @pytest.fixture def db_filename(): filename = osp.join(gettempdir(), "database.sqlite") yield filename try: os.remove(filename) except: # noqa pass @pytest.ma...
3,512
1,348
from .CheckersLogic import Board import numpy as np class CheckersGame(): """ This class specifies the base Game class. To define your own game, subclass this class and implement the functions below. This works when the game is two-player, adversarial and turn-based. Use 1 for player1 and -1 for pl...
6,262
1,804
import unittest <<<<<<< HEAD from restbed import core class CoreTest(unittest.TestCase): def test_core_api(self): pass if __name__ == '__main__': unittest.main() ======= >>>>>>> origin
204
73
import os import json from flask import Flask, render_template, request, redirect, url_for, Response from db import Tweet app = Flask(__name__) @app.route('/', methods=['GET']) def index(): return render_template('index.html') @app.route('/services/tweets', methods=['GET']) def get_tweets(): page = int(request.a...
792
298
import pywikibot, re, os, time, sys, json import toolforge from datetime import date, datetime, timedelta, timezone from pytz import timezone conn = toolforge.connect('ruwiki_p','analytics') #connLabs = toolforge.connect_tools('s53143__mis_lists_p') #cursor1 = connLabs.cursor() cats = [{"id":7641522,"len":21...
9,736
4,786
from enum import Enum class Level(Enum): L_UNKNOWN = 0 L_1M = 1 L_5M = 2 L_30M = 3 L_DAY = 4 L_WEEK = 5 L_MONTH = 6 L_SEASON = 7 L_YEAR = 8 class Direction(Enum): UNKNOWN = 0 UP = 1 DOWN = 2
241
130
""" # 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...
3,684
990
import unittest from uk_postcode_validator.client import PostCodeClient, ValidationError class PostCodeTest(unittest.TestCase): def test_invalid_postcode_validation_fails(self): client = PostCodeClient() with self.assertRaises(ValidationError) as e: client.validate('695001') def t...
1,088
347
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved. # Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team. # 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 ...
7,764
2,604
class TranslateFilePolicy(): allowed_formats = ['txt'] def is_allowed(self, filename): split = filename.split('.') format_ = split[1] return (format_ in self.allowed_formats)
207
61
import time import requests from django.conf import settings from fcm_django.models import FCMDevice from api_utils.views import (sms_notifier, successResponse, ) # import the logging library import logging from firebase_admin.messaging import Message, Notification logger = logging.getLogger(__name__) """Get an ins...
2,061
651
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def isPalindrome(self, head: ListNode) -> bool: node = head n = 0 ans = [] while(node != None): n += 1 ...
509
158
# # Copyright (c) 2021 Airbyte, Inc., all rights reserved. # from typing import Any, List, Mapping, Tuple from airbyte_cdk.models import SyncMode from airbyte_cdk.sources import AbstractSource from airbyte_cdk.sources.streams import Stream from airbyte_cdk.sources.streams.http.auth import TokenAuthenticator from sour...
2,274
619
{ 'target_defaults': { 'conditions': [ ['OS=="win"', { 'defines': [ '_WIN32_WINNT=0x0600', ], }], ], 'msbuild_settings': { 'ClCompile': { 'WarningLevel': 'Level3', 'Optimization': 'Full', 'FunctionLevelLinking': 'true', }, 'Li...
1,776
639
from models import * from run import db import sys import math import hashlib import time '''DATABASE INSERTION/UPDATE''' #Adds driver to database def addDriver(id, oLat, oLon, dLat, dLon, date): url = makeURL(id) driver = Driver(id, oLat, oLon, dLat, dLon, date, url) db.session.add(driver) save() #Adds passe...
7,709
2,669
""" Screen classes used by the app """ from logging import getLogger from os.path import join from typing import Any, Dict from kivy.lang import Builder from kivy.uix.boxlayout import BoxLayout from kivymd.uix.screen import MDScreen from naturtag.constants import KV_SRC_DIR HOME_SCREEN = 'image_selection' # TODO: Lo...
1,597
527
from django.shortcuts import get_object_or_404 from rest_framework import generics from rest_framework.response import Response from rest_framework import status from cajas.movement.models.movement_provisioning import MovementProvisioning from cajas.boxes.api.serializers.provisioning_serializer import ProvisioningSer...
1,064
303
# -*- coding: utf-8 -*- from __future__ import unicode_literals import pytest from django.core.exceptions import ImproperlyConfigured from django.core.files.uploadedfile import InMemoryUploadedFile from django.core.files.uploadedfile import SimpleUploadedFile from django.core.files.uploadedfile import TemporaryUpload...
2,962
983
# # PySNMP MIB module Fore-Red-Port-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Fore-Red-Port-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 19:03:47 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Ma...
4,914
1,996
from deepcarskit.quick_start.quick_start import run, objective_function, load_data_and_model
94
30
# Copyright (c) 2020 - for information on the respective copyright owner # see the NOTICE file and/or the repository https://github.com/boschresearch/blackboxopt # # SPDX-License-Identifier: Apache-2.0 """Tests that can be imported and used to test optimizer implementations against this packages blackbox optimizer int...
7,656
2,197
# Generated by Django 3.0.5 on 2020-08-07 00:21 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('registry', '0015_supplement_name'), ] operations = [ migrations.AddField( model_name='signal', name='color', ...
392
132
#!/usr/bin/python3 import json import base64 import xmltodict as xd import qrcode from termcolor import colored, cprint import binascii import sys import tarfile import io import pprint as pp import subprocess import urllib import os filenameSwitcher = {".gz": "data/data/org.fedorahosted.freeotp/./shared_prefs/tokens...
3,108
1,119
from random import randint class Enemy: def resetStats(self): self.stats['health'] = randint(60, 90) self.remaining_health = self.stats['health'] self.stats['strength'] = randint(60, 90) self.stats['defence'] = randint(40, 60) self.stats['speed'] = randint(40, 60) s...
390
148
from __future__ import absolute_import, division, print_function import warnings import ispyb warnings.warn( "ispyb.exceptions is deprecated and will be removed in the next release. Use the exceptions underneath ispyb. instead.", DeprecationWarning, ) ISPyBException = ispyb.ISPyBException ISPyBConnectionExc...
501
156
import sys import math import string import random import logging import numpy as np def sigmoid(x): return 1/ (1+ math.exp(-x)) def tanh(x): return 2 * sigmoid(2*x) -1 def generate_word(length): VOWELS = "aeiou" CONSONANTS = "".join(set(string.ascii_lowercase) - set(VOWELS)) word = "" for i ...
2,565
925
#!/usr/bin/env python from __future__ import division, absolute_import, print_function # # License # This file is part of the JAMS Python package, distributed under the MIT # License. The JAMS Python package originates from the former UFZ Python library, # Department of Computational Hydrosystems, Helmholtz Centre for ...
73,341
53,836