id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
1631688
from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import CreateView from django.core.urlresolvers import reverse_lazy from .forms import ThoughtForm class CreateThought(LoginRequiredMixin,CreateView): form_class = ThoughtForm success_url = reverse_lazy('users:dashboard') ...
StarcoderdataPython
170878
from abc import ABC, abstractmethod from typing import Optional from common.domain.game import Player class PlayerCacheInterface(ABC): @abstractmethod def add_player(self, player: Player) -> bool: pass @abstractmethod def update_player(self, game: Player) -> bool: pass @abstract...
StarcoderdataPython
1762188
<reponame>ConnectedSystems/pyapprox import matplotlib.pyplot as plt import pymc3 as pm import numpy as np import theano import theano.tensor as tt from scipy.optimize import approx_fprime from pyapprox.variables import get_distribution_info class GaussianLogLike(object): r""" A Gaussian log-likelihood functio...
StarcoderdataPython
1621098
#!/usr/bin/python # -*- coding: utf-8 -*- """ This module is part of the opsi PackageBuilder see: https://forum.opsi.org/viewforum.php?f=22 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without ...
StarcoderdataPython
1648212
<gh_stars>0 import os import requests def fetch(server, verbose=0): r = requests.get(f'{server}/viz/api/fetch').content if verbose: print('Fetched Sample') return r def set_iterator(server, value, verbose=0): requests.get(f'{server}/viz/api/set?iterator={value}') if verbose: print(...
StarcoderdataPython
39677
from output.models.saxon_data.id.id008_xsd.id008 import ( Doc, Node, PseudoId, PseudoIdref, ) __all__ = [ "Doc", "Node", "PseudoId", "PseudoIdref", ]
StarcoderdataPython
1726584
from pyrsistent import pmap class ConfusionTable(object): def __init__(self, class_name, true_positive, true_negative, false_positive, false_negative, format_fn): self.__class_name = class_name self.__true_positive = true_positive self.__true_negative = true_negative ...
StarcoderdataPython
1723937
<reponame>artyompal/kaggle_quick_draw #!/usr/bin/python3.6 """ Takes prediction as a series of numpy arrays, generates a submission csv file. """ import os, sys from typing import * from glob import glob import re, inspect import numpy as np, pandas as pd from tqdm import tqdm NpArray = Any def dprint(*args: Any) -...
StarcoderdataPython
3392634
from auth.infrastructure.password import Password def test_password_generate_password(): password = '<PASSWORD>' hashed_password = Password.hash_password(password) assert hashed_password assert isinstance(hashed_password, str) assert hashed_password != password def test_password_validate_passw...
StarcoderdataPython
1788517
<reponame>ctoth/shooter from logging import getLogger logger = getLogger('map_loader') import collections import os import yaml import game_object import items import map import npc import template import weapon OBJECT_TYPES = { i.__name__: i for i in ( game_object.GameObject, weapon.ProjectileWeapo...
StarcoderdataPython
1704535
<filename>tests/test_cli.py import os import re import sys import pytest from vrun import cli from vrun.oscompat import WIN @pytest.fixture() def cwd_is_empty(monkeypatch): curpath = os.path.dirname(os.path.realpath(__file__)) cwd = os.path.join(curpath, 'configtest', 'empty') monkeypatch.setattr(os, 'g...
StarcoderdataPython
150003
<filename>core/urls.py from django.urls import path from .views import HomeView, StatisticsView, NdtvView, QtvView app_name = 'core' urlpatterns = [ path('', HomeView.as_view(), name="home"), path('ndtv/', NdtvView.as_view(), name="ndtv"), path('qtv/', QtvView.as_view(), name="qtv"), path(...
StarcoderdataPython
3254123
<reponame>MollyMmm/tidy_page import sys from bs4 import BeautifulSoup,Comment def clean_tag(doc): for tag in doc.find_all(["style", "script","form", "textarea", "input", "iframe", "select","frame", "link"]): tag.extract() comments = doc.findAll(text=lambda text:isinstance(text, Comment)) [comment.e...
StarcoderdataPython
4814907
<reponame>Exabyte-io/api-client import mock from exabyte_api_client.utils.http import Connection from requests.exceptions import HTTPError from tests.unit import EndpointBaseUnitTest class HTTPBaseUnitTest(EndpointBaseUnitTest): """ Class for testing functionality implemented inside HTTPBase module. """ ...
StarcoderdataPython
116859
# -*- coding: utf-8 -*- """ Created on Sat Sep 22 19:01:05 2018 Tensorflow implementation of the iris dataset classification @author: Vishal """ #Using a linear classifier import tensorflow.contrib.learn as tf from sklearn import datasets, metrics iris = datasets.load_iris() clf = tf.TensorFlowLinearClassifier(n_cla...
StarcoderdataPython
1708184
<reponame>lmcgnlzt/modeflip from modeflip.utils.config import get_configuration from modeflip.utils.mongo import MongoManager from modeflip.models.statistics import * local_config = get_configuration('production') get_database = MongoManager(local_config, force_load=True) config_db = get_database('mf_config') sc = St...
StarcoderdataPython
1792989
from syned.storage_ring.light_source import LightSource from syned.storage_ring.electron_beam import ElectronBeam from syned.storage_ring.magnetic_structure import MagneticStructure from rafry.beamline.decorators import LightSourceDecorator from rafryshadow3.raytracer.shadow3_beam import Shadow3Beam class Shadow3Li...
StarcoderdataPython
3341255
import time class Timer: def __init__(self, timeout): self.timeout = timeout self.start = time.time() def done(self): return time.time() - self.start > self.timeout def on_timer_done(self, callback): self.callback = callback if __name__ == "__main__": ### First try ...
StarcoderdataPython
100659
<filename>tests/test_utils.py import unittest from cloudr.utils import change_path_prefix class TestUtils(unittest.TestCase): def test_change_path_prefix(self): self.assertEqual(change_path_prefix('/123', '/', '/'), '/123') self.assertEqual(change_path_prefix('/123/234', '/123', '/123'), '/123/23...
StarcoderdataPython
1669628
<gh_stars>10-100 import os import re import sys def ReadFileAsLines(filename): """Reads a file, removing blank lines and lines that start with #""" file = open(filename, "r") raw_lines = file.readlines() file.close() lines = [] for line in raw_lines: line = line.strip() if len(l...
StarcoderdataPython
1717761
from flask import Flask, render_template import datetime, time tiempo= int(time.mktime(datetime.datetime.now().timetuple())) import datetime app = Flask('testapp') #images = Images(app) variables= [20,15,1520188605,1520188272,1520188622,1520188315,1520188831,1520188643,50,35] @app.route('/') def estacion():...
StarcoderdataPython
1739645
import typing # noqa: F401 from kubernetes import client # noqa: F401 from kuber import kube_api as _kube_api # noqa: F401 from kuber import definitions as _kuber_definitions # noqa: F401 from kuber import _types # noqa: F401 from kuber.v1_21.meta_v1 import Condition # noqa: F401 from kuber.v1_21.meta_v1 import...
StarcoderdataPython
20639
<gh_stars>10-100 import argparse import sys from multiprocessing import cpu_count, Process, Queue import json import logging from datetime import datetime from elasticsearch import Elasticsearch from elasticsearch.helpers import bulk, scan import hashlib from helpers.certparser import process_cert from helpers.hostpa...
StarcoderdataPython
69618
<reponame>crazynayan/firestore-test import os from typing import List from unittest import TestCase os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "google-cloud.json" from firestore_ci import FirestoreDocument from firestore_ci.firestore_ci import FirestoreCIError class User(FirestoreDocument): def __init__(se...
StarcoderdataPython
117196
<reponame>haman80/PlasmaPy<filename>plasmapy/diagnostics/thomson.py """ Defines the Thomson scattering analysis module as part of `plasmapy.diagnostics`. """ __all__ = [ "spectral_density", "spectral_density_model", ] __lite_funcs__ = ["spectral_density_lite"] import astropy.constants as const import astropy....
StarcoderdataPython
102114
<reponame>JKesslerPhD/FIPInjectionLogger # Generated by Django 3.0.6 on 2020-09-14 23:34 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('InjectionLog', '0035_auto_20200720_2327'), ] operations = [ migrations.AlterField( mode...
StarcoderdataPython
164146
<filename>tests/components/test_demo.py """The tests for the Demo component.""" import asyncio import json import os import pytest from homeassistant.setup import async_setup_component from homeassistant.components import demo, device_tracker from homeassistant.remote import JSONEncoder @pytest.fixture(autouse=True...
StarcoderdataPython
3204279
<filename>OpenCV/canny_edge.py import cv2 import numpy as np from matplotlib import pyplot as plt video = cv2.VideoCapture(0) while True: ret, frame = video.read() frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) frame = cv2.GaussianBlur(frame, (3, 3), 0) edges = cv2.Canny(frame, 50, 75) thres, edge...
StarcoderdataPython
30432
""" This module contains a pytorch dataset for learning peptide embeddings. In particular, each "instance" of the dataset comprises two peptide sequences, as well as the sNebula similarity between them. The sNebula distance reflects the BLOSSUM similarity transformed from 0 to 1. """ import logging logger = logging.ge...
StarcoderdataPython
1777258
<reponame>theletterf/signalfx-python-tracing<filename>tests/integration/requests_/test_instrumented_session.py # Copyright (C) 2018 SignalFx. All rights reserved. import threading import requests import pytest from opentracing.mocktracer import MockTracer from opentracing.ext import tags as ext_tags from requests.sess...
StarcoderdataPython
150410
<gh_stars>0 from kubragen import KubraGen from kubragen.consts import PROVIDER_GOOGLE, PROVIDERSVC_GOOGLE_GKE, PROVIDER_K3D, PROVIDERSVC_GENERIC from kubragen.options import Options from kubragen.output import OutputProject, OD_FileTemplate, OutputFile_ShellScript, OutputFile_Kubernetes, \ OutputDriver_Print, Outpu...
StarcoderdataPython
146359
import logging import logging.handlers import multiprocessing as mp from .gpio import Gpio from .sound import Sound from .Communicator import Communicator from .Workers import Workers from .StateMachine import StateMachine from .events.ErrorEvent import ErrorEvent from .events.Event import Event from .dis...
StarcoderdataPython
3213607
"""Module which extends the scenepic Video type.""" # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from ._scenepic import Video def load_from_buffer(self, data: bytes, ext: str): """Load video from a pre-existing data buffer and extension. Args: self (Video): self referenc...
StarcoderdataPython
52779
# # BSD 3-Clause License # # Copyright (c) 2022 University of Wisconsin - Madison # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyrig...
StarcoderdataPython
1688950
import json import os import keras import matplotlib.pyplot as plt import numpy as np import pandas as pd import requests from keras.layers import Dropout, Dense, LSTM, TimeDistributed from keras.models import Sequential from sklearn.preprocessing import normalize, MinMaxScaler """ Created by <NAME> on 7/25/18. ...
StarcoderdataPython
1691174
<filename>chapter2/insertion_sort.py #!/usr/local/bin/python def insertion_sort(a): for j in range(1,len(a)): i=j-1 key=a[j] while a[i]>key and i>0: a[i+1]=a[i] i=i-1 a[i+1]=key print a return a if __name__=='__main__': insertion_sort([1,3,2,6,8,9]) insertion_sort([-1,-5,2,-5,7]...
StarcoderdataPython
3211098
import logging from FLIR.conservator.conservator import Conservator logging.basicConfig(level="INFO") conservator = Conservator.default() # Conservator collection path remote_path = f"/CLI Examples/Upload Many Videos" # Local path. This example will upload the file at this path 10 times. local_path = "~/datasets/fl...
StarcoderdataPython
3235592
from __future__ import annotations from collections import deque from itertools import count from typing import get_type_hints, Any, Callable, Iterable, Iterator, Optional, Sequence, Type, TypeVar, Union from numpy.typing import ArrayLike import numpy as np class Momentum: """ Provides an unbiased momentum i....
StarcoderdataPython
110933
import context # Remove this import if running with pip installed version. from pypsqueak.api import qReg, qOp from pypsqueak.gates import X, Z, I, ROT_Y, CNOT from pypsqueak.noise import b_flip_map import numpy as np import sys if len(sys.argv) > 1 and int(sys.argv[1]) > 0: n_trials = int(sys.argv[1]) else: ...
StarcoderdataPython
1726004
<reponame>codello/Motor-ODM<gh_stars>10-100 """BSON encoders for common python types. This module contains a collection of :class:`bson.codec_options.TypeEncoder` subclasses for common python types such as sets. Note that these encoders are provided as a convenience but are not used automatically. If you want to use s...
StarcoderdataPython
188156
<gh_stars>10-100 from __future__ import absolute_import __author__ = 'katharine' import code import readline import rlcompleter import libpebble2.protocol from .base import PebbleCommand class ReplCommand(PebbleCommand): """Launches a python prompt with a 'pebble' object already connected.""" command = 're...
StarcoderdataPython
4803263
from django.shortcuts import render from notes.models import Note def index(request): context = { # Get all of the notes in the database, in descending order. # Instead of SQL, this is how Django provides a cross-database # query engine. 'notes': Note.objects.all().order_by('-date'...
StarcoderdataPython
4802752
<filename>tests/__init__.py """initialisaion of package."""
StarcoderdataPython
127115
import os, glob import subprocess from os import listdir from os.path import isfile, join import time import traceback import shutil import numpy as np import csv import time def checkForUpdate(count, lastUpdate): sn = os.environ['SERVERNUM'] hdfs = os.environ['HDFS'] updateCount = -1 print("UPDATE CHE...
StarcoderdataPython
3343544
from scripts import load, html_to_text import os import string import re def get_stop_words(): stop_words = [] with open("../stopwords/stopwords.txt") as infile: for line in infile: stop_words.append(line.split("\n")[0]) return stop_words def remove_stop_words(querytext, stop_words): ...
StarcoderdataPython
122672
#!/usr/bin/env python3 class MessageBroadcast: def __init__(self, friend_graph, start_person): self.friend_graph = friend_graph self.start_person = start_person self.people_without_message = list(friend_graph.keys()) self.step_number = 0 self.new_people_with_message_in_last...
StarcoderdataPython
145861
""" Lambda function backing cloudformation certificate resource Post-minification, this module must be less than 4KiB. """ import time import boto3 import hashlib import json import copy import logging from botocore.vendored import requests l = logging.getLogger() l.setLevel(logging.INFO) def send(event): l.i...
StarcoderdataPython
107292
class dotGuideline_t(object): # no doc Curve = None Id = None Spacing = None
StarcoderdataPython
1612652
# Copyright (c) 2013 Mirantis Inc. # Copyright (c) 2015 eNovance # # 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 appli...
StarcoderdataPython
3298185
graph = dict() graph['A'] = ['B', 'S'] graph['B'] = ['A'] graph['S'] = ['A','G','C'] graph['D'] = ['C'] graph['G'] = ['S','F','H'] graph['H'] = ['G','E'] graph['E'] = ['C','H'] graph['F'] = ['C','G'] graph['C'] = ['D','S','E','F'] def depth_first_search(graph, root): visited_vertices = list() ...
StarcoderdataPython
1771307
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- # # The MIT License (MIT) # # Copyright (C) 2018 - <NAME> <<EMAIL>> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, inclu...
StarcoderdataPython
1751904
import constants.global_constants as const import tkinter as tk class ScrollableCanvasC(tk.Canvas): """ - Canvas with scrollbars. - The scrollbars pack themselves. - DO NOT use pack/grid/place for f_main_frame or it will nto scroll. - Place widgets inside f_main_frame, not directly inside the can...
StarcoderdataPython
149866
<filename>mercury/fog_model/edcs/edc/pu/pu.py<gh_stars>1-10 from mercury.logger import logger as logging, logging_overhead from collections import defaultdict from mercury.config.edcs import ProcessingUnitConfig from mercury.msg.edcs import ProcessingUnitHotStandBy, ProcessingUnitServiceRequest, \ ProcessingUnitSer...
StarcoderdataPython
48254
<reponame>mikbukow/launchpad from flask import Blueprint explorer = Blueprint('explorer', __name__, template_folder='templates') @explorer.route('/') def index(): return 'Explorer index' @explorer.route('/test') def test(): return 'Explorer test'
StarcoderdataPython
3319940
<reponame>vensentzhou/support_resistance_line import pandas as pd from support_resistance_line import SupportResistanceLine def test(): raw_data = [ # daily close of 000905.SH for 1 year from 20190901 to 20200901 [5008.2958, 5044.1805, 5093.2662, 5138.4051, 5154.6378, 5263.4594, 5245.305], [5217....
StarcoderdataPython
87265
"""Transaction unit.""" class TransactionUnit: """Transaction unit.""" def __init__( self: "TransactionUnit", txid: str, fee: str, weight: str, parents: str ) -> None: """Initialize transaction unit. Args: txid (str): Txn ID fee (str): fee of txn ...
StarcoderdataPython
4839998
from crawler.scrapers.beautifulsoup_wrapper import BeautifulSoupWrapper class BaseRecipeParser: crawler_delay = 0 def __init__(self, recipe_url): self.recipe_url = recipe_url self.soup = BeautifulSoupWrapper(recipe_url, delay=self.crawler_delay)
StarcoderdataPython
3230667
<reponame>MomsFriendlyRobotCompany/yasl #!/usr/bin/env python from __future__ import print_function, division from math import sin, pi from yasl import Spark if __name__ == "__main__": sp = Spark() data = [0,3,6,8.5,7,5,2,8,-8,1] # print(sp.vbar(data)) print(u'max: {:.2f} min: {:.2f} [{}]'.format(max(...
StarcoderdataPython
4826187
import folium import pandas as pd import requests import io from datetime import timedelta, date def daterange(start_date, end_date): for n in range(int ((end_date - start_date).days)): yield start_date + timedelta(n) def go_back(end_date, days): for n in range(0,days): yield end_date - timedel...
StarcoderdataPython
4827962
import matplotlib matplotlib.use('Agg') # graphics backend for hardcopy from pylab import * from JSAnimation import IPython_display import JSAnimation_frametools as J plotdir = '_plots' # to store png files for each figure J.make_plotdir(plotdir, clobber=True) # ok to clobber if it already exists x = linspace(0.,...
StarcoderdataPython
1730664
<filename>solutions/01_07.py<gh_stars>0 class ManualLinearClassifier: def __init__(self, decision_points): self.decision_points = decision_points def fit(self, X, y): dummy_feature = np.ones(shape=(self.decision_points.shape[0], 1)) self.intercept_ = -1 self.coefs_ = np.linalg.s...
StarcoderdataPython
3289037
<reponame>cloud322/HelloPython def sayHello(): print('hihi')
StarcoderdataPython
75396
<filename>DiscordBot.py import discord import requests import json import time import youtube_dl import os import random from discord import client from discord.ext import commands from discord import Intents from discord import FFmpegPCMAudio dababyImages = ["dababy1.jpg", "dababy2.jpg", "dababy3.jpg", "dababy4.jpg"]...
StarcoderdataPython
1785436
<reponame>bruot/django-vosi from django.conf.urls import url, include from vosi import views app_name = 'example2' urlpatterns = [ url(r'^availability/$', views.availability, name='availability'), url(r'^capabilities/$', views.capabilities, name='capabilities'), ]
StarcoderdataPython
136892
from fnmatch import fnmatch import regex as re from dbcog.models.enum_types import AwokenSkills from dbcog.models.monster_model import MonsterModel from dbcog.token_mappings import AWAKENING_TOKENS, AWOKEN_SKILL_MAP, BOOL_MONSTER_ATTRIBUTE_ALIASES, \ BOOL_MONSTER_ATTRIBUTE_NAMES, \ NUMERIC_MONSTER_ATTRIBUTE_A...
StarcoderdataPython
1609549
<reponame>gormaar/AdventOfCode2019 file = open("input.txt").read() count = 0 horizontal = "" vertical = 0 image_array = [] layers = int(file) image_array2 = [] for i in file: for j in for i in file: if count != 25: horizontal += i count += 1 elif count == 25: count = 0 verti...
StarcoderdataPython
1716007
from huffman import HuffmanEncoder from binary_tools import BitBuffer class Compressor: def Name(self): return 'letters' def Compress(self, words): charRoot = self._HuffmanCode(words) charCode = charRoot.MakeEncoding() buf = self._Encode(words, charCode) source = "Char=...
StarcoderdataPython
3309999
import torch import torch.nn as nn import torch.nn.functional as F import math class FlowLayer(nn.Module): def __init__(self, channels=1, bottleneck=32, params=[1, 1, 1, 1, 1], n_iter=10): super(FlowLayer, self).__init__() self.bottleneck = nn.Conv3d(channels, bottleneck, stride=1, padding=0, bia...
StarcoderdataPython
4653
# coding: utf-8 import math import dateutil import dateutil.parser import json from ChartBars import Chart from ChartUpdaterByCCWebsocket import ChartUpdaterByCoincheckWS from Util import BitcoinUtil def adjust_price_to_tick(price, tick): return price - math.fmod(price, tick) def adjust_amount_to_tick(amount, t...
StarcoderdataPython
191530
import json import urllib2 import urllib import json import traceback import hashlib import time import random import datetime from core import database from core import config from core import sanitize from modules import signature from bson.objectid import ObjectId class status_user...
StarcoderdataPython
50199
<filename>audioengine/model/finetuning/wav2vec2/helper/load_preprocessed_data.py from pathlib import Path from audioengine.model.finetuning.wav2vec2.helper.argument_parser import argument_parser from audioengine.model.finetuning.wav2vec2.helper.parquetdataset import ParquetDataset def load_datasets(data_args): tr...
StarcoderdataPython
3331894
#!/usr/bin/env python3 import argparse import base64 import codecs import time import json import broadlink from broadlink.exceptions import ReadError, StorageError TICK = 32.84 TIMEOUT = 5 IR_TOKEN = 0x26 def auto_int(x): return int(x, 0) def to_microseconds(bytes): result = [] # print bytes[0] # 0...
StarcoderdataPython
1757038
<gh_stars>1-10 import base64 from typing import List from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.ui import Select from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdrive...
StarcoderdataPython
54027
""" Sorting algorithms """ def insert_sort(list_num): """ Insertion sort Start from second element Save it alongside with it's index Run from previous element to first one While checking if value should be moved In the end, put saved value after last moved index ...
StarcoderdataPython
1680919
import tempfile import requests import time import pytest import time import os import io import tarfile import glob import uuid from datetime import datetime from ae5_tools.api import AEUserSession, AEUnexpectedResponseError, AEException from .utils import _get_vars, _compare_tarfiles class AttrDict(dict): def...
StarcoderdataPython
3243207
<filename>scripts/builtin.py<gh_stars>10-100 import sys import markdown import os class Predicate: def __init__(self, templates, short, description): self.templates = templates self.short = short self.description = description if "(" in self.templates[0]: split = self.templates[0].split("(") self.indi...
StarcoderdataPython
83392
import logging from datetime import datetime from django.conf import settings from django.core.management import BaseCommand from gdpr.forget import delete_user_data from users.models.user import User log = logging.getLogger(__name__) class Command(BaseCommand): help = "Cron job to actually delete users" ...
StarcoderdataPython
43070
<filename>cfc_app/bill_detail.py<gh_stars>10-100 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Bill details for extract_files Written by <NAME>, IBM, 2020 Licensed under Apache 2.0, see LICENSE for details """ # System imports import datetime as DT import logging import re import sys from urllib.parse import url...
StarcoderdataPython
1648627
from selenium.webdriver.common.by import ( By ) from selenium.webdriver.support import ( expected_conditions as EC ) from selenium.webdriver.support.ui import ( WebDriverWait ) def get_element_by_css_selector(driver, tag, value): ''' Get a specified element by tag and attribute value. ''' is...
StarcoderdataPython
3288482
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown copyright. The Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are me...
StarcoderdataPython
3291656
import datetime from multiply_ui.server.resources.workflows import MultiplyMonitor class MultiplyAdaptedIterative8(MultiplyMonitor): def __init__(self, parameters): MultiplyMonitor.__init__(self, parameters, types=[('test_script_1.py', 2),...
StarcoderdataPython
3299841
<gh_stars>1-10 """ Blockchain RPCs More info: https://developer.bitcoin.org/reference/rpc/ """ import json from bitcaviar.__helpers import __run def get_best_block_hash(bitcoin): """ Get the hash of the best (tip) block in the most-work fully-validated chain More info: https://developer.bitcoin.org/refer...
StarcoderdataPython
17515
def retorno(): resp=input('Deseja executar o programa novamente?[s/n] ') if(resp=='S' or resp=='s'): verificar() else: print('Processo finalizado com sucesso!') pass def cabecalho(titulo): print('-'*30) print(' '*9+titulo+' '*15) print('-'*30) pass def mensage...
StarcoderdataPython
1628666
import logging LOG = logging.getLogger(__name__)
StarcoderdataPython
3245357
<reponame>pedrohov/rpi-localization-mapping import json, sys, time, math; import RPi.GPIO as GPIO; from pathlib import Path; sys.path.insert(0, str(Path().absolute()) + '/sensors/'); GPIO.setwarnings(False); from controller import *; from infrared import *; from odometer import *; from sonar impo...
StarcoderdataPython
3283358
<reponame>cperreault11/snorkel-extraction from __future__ import absolute_import from .noise_aware_model import TFNoiseAwareModel from .rnn import reRNN, TagRNN, TextRNN, DocRNN from .logistic_regression import LogisticRegression, SparseLogisticRegression
StarcoderdataPython
1729361
<reponame>nkpydev/Python-Learning<filename>EXAMPLES/Selenium/webdriver-chrome-example.py<gh_stars>0 #--- Selenium Specific Imports ---# from selenium import webdriver from selenium.webdriver import Chrome #--- Generic Imports ---# import time if __name__ == '__main__': url = 'http://google.com' browser...
StarcoderdataPython
3272185
<filename>docs/conf.py """Configure details for documentation with sphinx.""" from datetime import date import sphinx_bootstrap_theme # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ "sphinx.ext.gith...
StarcoderdataPython
3239908
<reponame>Czembri/contentAgregator from bs4 import BeautifulSoup, NavigableString, Tag import requests from datetime import datetime from contentagregator import db from contentagregator.config import SCRAP_URLS class Scrap: today = datetime.utcnow() def __init__(self, tag, tag_class, name): self.tag ...
StarcoderdataPython
1638760
import torch import torch.nn as nn import torch.nn.functional as F class FastText(nn.Module): def __init__(self, input_dim, embedding_dim, output_dim): super().__init__() self.embedding = nn.Embedding(vocab_size, embedding_dim) self.fc = nn.Linear(embedding_dim, output_dim) def forwar...
StarcoderdataPython
1644082
from ..css_matcher import scan, split_value, TokenType from .utils import push_range, SelectItemModel class CSSSection: __slots__ = ('start', 'end', 'body_start', 'body_end', 'properties') def __init__(self, start: int, end: int, body_start: int, body_end: int, properties: list=None): self.start = sta...
StarcoderdataPython
3249544
# # General-purpose Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall # model for 1st, 2nd and 3rd generation solar cells. # Copyright (C) 2008-2022 <NAME> r.c.i.m<EMAIL>enzie at googlemail.com # # https://www.gpvdm.com # # This program is free software; you can redistribute it and/...
StarcoderdataPython
1759888
<reponame>dldevinc/django-spectrum # Generated by Django 2.2.18 on 2021-02-12 12:53 from django.db import migrations, models import spectrum.fields class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Example', ...
StarcoderdataPython
3255141
<filename>Unit Converter.py<gh_stars>0 # Converts various units between one another. The user enters the type of unit being entered, the type # of unit they want to convert to and then the value. The program will then make the conversion #* Celcius to F = * 9 / 5 + 32 #* F to C = - 32 * 5 / 9 #* GBP to USD = *...
StarcoderdataPython
65510
<reponame>alanphys/pYadiv """ ======================================== Show a dicom image or sequence of images ======================================== Show a dicom image or sequence of images using Pyside and QT5. Usage: python3 DivPy.pyw dicom_filename Or drag and drop from your file manager. """ # author : <NAME...
StarcoderdataPython
1687175
def test_cat_dataset(cat_dataset): assert(cat_dataset is not None)
StarcoderdataPython
1741890
import os.path as P import subprocess as S from string import Template from typing import Dict, List import pkg_resources from hare_mp.store import ValueProvider from hare_mp.types import DList, Maybe, NodeDesc, Text, Protocol DHALL_PATH = '/opt/seagate/cortx/hare/share/cfgen/dhall' DHALL_EXE = '/opt/seagate/cortx/h...
StarcoderdataPython
78943
<reponame>HQSquantumsimulations/ActiveSpaceFinder # Copyright 2020 HQS Quantum Simulations GmbH # <NAME>, <NAME>. # <EMAIL> # # 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....
StarcoderdataPython
1772932
<reponame>bethwelkip/Persona_Galleria # Generated by Django 3.1.3 on 2020-11-15 12:38 import cloudinary.models from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Create...
StarcoderdataPython
3273993
class Solution: def findComplement(self, num: int) -> int: p = 1 while p < num: p = (p << 1) + 1 return num ^ p
StarcoderdataPython