id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3484448 | <gh_stars>1-10
# Generated by Django 2.2.6 on 2019-12-10 08:04
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Exam',
fiel... | StarcoderdataPython |
5133696 | from yacs.config import CfgNode as CN
__all__ = ['get_default_cfg']
_C = CN()
_C.OUTPUT_DIR = "results"
_C.DATASET = CN()
_C.DATASET.PATH = ''
_C.MODEL = CN()
_C.TRAIN = CN()
_C.TRAIN.BASE_LEARNING_RATE = 0.05
_C.TRAIN.LEARNING_DECAY_RATE = 0.1
_C.TRAIN.LEARNING_DECAY_STEPS = [1000, 2000]
_C.TRAIN.TRAIN_EPOCHS... | StarcoderdataPython |
32989 | <filename>packages/validate_and_forward/lambda_handler.py<gh_stars>1-10
import json
import os
import traceback
from datetime import datetime
from uuid import uuid4
import boto3
from aws.ssm import get_ssm_params
from database import Jobs
from gp_file_parser.parser import parse_gp_extract_file_s3
from jobs.statuses imp... | StarcoderdataPython |
6516856 | <reponame>hitotsunorb1/Zope
##############################################################################
#
# Copyright (c) 2004, 2005 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accom... | StarcoderdataPython |
6632999 | <filename>scrapeops_python_logger/utils/error_handling.py
import functools
from scrapeops_python_logger.exceptions import ScrapeOpsAPIResponseError
def exception_handler(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except ScrapeOpsAP... | StarcoderdataPython |
12807607 | from .naming import frozendict
class TypeCheck(object):
"""
Encapsulate the results of a type check pass.
"""
class Error(Exception):
pass
@staticmethod
def success():
return TypeCheck(True, "")
@staticmethod
def failure(msg):
return TypeCheck(False, msg)
def __init__(self, success,... | StarcoderdataPython |
5128329 | <filename>flybirds/core/driver/screen.py
# -*- coding: utf-8 -*-
"""
screen proxy
"""
from flybirds.core.global_context import GlobalContext
def screen_shot(path):
GlobalContext.screen.screen_shot(path)
def screen_link_to_behave(scenario, step_index, tag=None):
GlobalContext.screen.screen_link_to_behave(sce... | StarcoderdataPython |
6423649 | # ABC002a
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
print(max(tuple(map(int, input().split()))))
| StarcoderdataPython |
185167 | <gh_stars>1-10
"""Module to store EnforceTyping exceptions."""
class EnforcedTypingError(TypeError):
"""Class to raise errors relating to static typing decorator."""
| StarcoderdataPython |
6646847 | <gh_stars>0
"""
Checks database validity.
Checks if word.word and word.bad_variant are equal (case insensetive)
Checks if there is only one uppercase letter in word.word and word.bad_variant
"""
import unittest
from models import Session, Word
class WordsTest(unittest.TestCase):
def test_word_and_bad_variant_equ... | StarcoderdataPython |
5127881 | import os
import sys
import json
import webbrowser
import requests
from urllib import parse
GET_INFO = False
url = "https://api.bilibili.com/x/v2/dm/subtitle/draft/save"
bvid = "BV1qf4y1B7D3"
oid = "245340306"
if GET_INFO:
webbrowser.open_new_tab(f"http://api.bilibili.com/x/web-interface/view?bvid={bvid}")
... | StarcoderdataPython |
1818389 | <filename>website/webQuery.py<gh_stars>0
from flask import Flask, url_for, render_template, request, redirect
import sys
sys.path.append('../')
import retrival
sys.path.append('website')
import time
import urllib
app = Flask(__name__)
links = []
@app.route('/<nextQ>', methods=['POST', 'GET'])
def homeRedirect(nextQ)... | StarcoderdataPython |
3287882 | #!/usr/bin/env python3
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import matplotlib.pyplot as plt
from cartopy.io.img_tiles import OSM
imagery = OSM()
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=imagery.crs)
ax.set_extent([-119.0, -116, 32, 34], crs=ccrs.PlateCarree())
ax.gridlines... | StarcoderdataPython |
9792128 | <filename>snakeai/agent/test.py
class test():
def __init__(self):
self.flag = True
| StarcoderdataPython |
6684018 | <filename>mapper.py
from utils import get_env_vars
import yaml
import json
import os
class Mapper:
def __init__(self, env_vars, log) -> None:
self.log = log
self.mapping_file = env_vars['MAPPING_FILE']
self.mapping_folder = env_vars['MAPPING_FOLDER']
self.load()
def load(self)... | StarcoderdataPython |
9695459 | ##########################################################################
# MediPy - Copyright (C) Universite de Strasbourg
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
# for de... | StarcoderdataPython |
8132809 | <filename>Part-03-Understanding-Software-Crafting-Your-Own-Tools/models/edx-platform/scripts/xsslint/xsslint/django_linter.py
"""
Classes for Django Template Linting.
"""
import re
from xsslint.utils import Expression, StringLines
from xsslint.reporting import ExpressionRuleViolation
class TransExpression(Expression)... | StarcoderdataPython |
296744 | <reponame>chars32/edx_python
#Write a function that takes a two-dimensional list (list of lists) of numbers as argument and returns a list
#which includes the sum of each row. You can assume that the number of columns in each row is the same.
def sum_of_two_lists_row(list2d):
final_list = []
for list_numbers in li... | StarcoderdataPython |
1926137 | <gh_stars>0
# Copyright (c) 2018 Ansible, Inc.
# All Rights Reserved.
from ansiblelint import AnsibleLintRule
class TaskHasNameRule(AnsibleLintRule):
id = '502'
shortdesc = 'All tasks should be named'
description = 'All tasks should have a distinct name for readability ' + \
'and for --... | StarcoderdataPython |
259076 | <reponame>muglyon/https-github.com-muglyon-DCOP-Decentralised-Control-of-Intelligent-Devices
#! python3
# monitoring_area.py - Modelisation of a room
import operator
import abc
import constants as c
from random import randint
class MonitoringArea(object):
__metaclass__ = abc.ABCMeta
def __init__(self, id_... | StarcoderdataPython |
220233 | <filename>src/pycompiler/interpreter.py
#!/usr/bin/env python
##
# <NAME>
# dave at drogers dot us
# This software is for instructive purposes. Use at your own risk - not meant to be robust at all.
# Feel free to use anything, credit is appreciated if warranted.
##
import sys, os, StringIO
parent_dir = os.path.abspa... | StarcoderdataPython |
8090771 | <filename>python-client/swagger_client/models/com_github_appscode_stash_apis_stash_v1alpha1_recovery_spec.py
# coding: utf-8
"""
stash-server
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v0
Generated by:... | StarcoderdataPython |
9668258 | <reponame>GeorgeVelikov/Surffee<filename>surveys/views/annotation/operation_add_one.py<gh_stars>0
from django.core.exceptions import PermissionDenied
from django.shortcuts import redirect
from django.views.generic import UpdateView
from ...models.survey import Survey, Choice
from ...models.annotation import Annotation... | StarcoderdataPython |
3340539 | <gh_stars>0
version = "3.28"
| StarcoderdataPython |
3214514 | import argparse
import pandas as pd
from tqdm import tqdm
from PIL import Image
import numpy as np
from contextualized_topic_models.datasets.dataset import CTMDataset
from sklearn.metrics.pairwise import cosine_similarity
from utils import load_model
from sentence_transformers import SentenceTransformer, util
import pi... | StarcoderdataPython |
1804103 | <reponame>AndreaVoltan/MyKratos7.0
from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7
# Importing the Kratos Library
import KratosMultiphysics
# Import applications
import KratosMultiphysics.StructuralMechanicsApplication as Structu... | StarcoderdataPython |
5045887 | <reponame>yuchun1214/Working-Shift-Arrangement-System<gh_stars>1-10
import json
import os
import csv
from django.shortcuts import render
from django.template import loader
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.views.decorators.csrf import csrf_exempt
from django.conf import set... | StarcoderdataPython |
8017189 | <gh_stars>0
# FILE: vscp.py
#
# This file is part of the VSCP (https://www.vscp.org)
#
# The MIT License (MIT)
#
# Copyright (c) 2000-2017 <NAME>, <NAME>is AB <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softwar... | StarcoderdataPython |
3341763 | <gh_stars>10-100
"""Хромосомы и гены параметров модели."""
from poptimizer.evolve.evolve import Evolution
from poptimizer.evolve.forecaster import get_forecasts
| StarcoderdataPython |
8096695 | <filename>atemon/__init__.py
"""
Various packages provided by Atemon Technology Consultants.
Website: http://www.atemon.com
Git Hub: https://github.com/atemon
Twitter: https://twitter.com/atemonastery
Author: <NAME> <EMAIL>
Copyright 2016 Atemon Technology Consultants LLP
Each package may have different opensource ... | StarcoderdataPython |
12843335 | # -*- coding: utf-8 -*-
"""
This file is part of pyCMBS.
(c) 2012- <NAME>
For COPYING and LICENSE details, please refer to the LICENSE file
"""
"""
module to compile the required python extensions
This is for development purposes only! Later on
it might be integrated into the standard setup.py
"""
# http://docs.cyth... | StarcoderdataPython |
1632203 | <gh_stars>0
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from .models import *
import cloudinary
import cloudinary.uploader
import cloudinary.api
from django.http import JsonResponse
from rest_framework import status
from django.http import Http404
from rest_f... | StarcoderdataPython |
35750 | <reponame>GPXenergy/gpx_server_api<filename>smart_meter/apps.py
from django.apps import AppConfig
class SmartMeterConfig(AppConfig):
name = 'smart_meter'
| StarcoderdataPython |
9600190 | <gh_stars>0
#!/usr/bin/python3.7
__doc__ = """Small module to process data and take appropriate action
from programs that produce output on a line-by-line basis."""
import subprocess, sys, time, re, os, shlex
ansi_re = re.compile("\x1b\[[0-9;]*[mGKHF]")
def filter_ansi(string_):
return ansi_re.sub("", string_)... | StarcoderdataPython |
8189860 | """
Provides the ``SSHSession`` dictionary, which maps host
to :py:class:`paramiko.transport.Transport`.
"""
from __future__ import absolute_import
from .log import ArcError
SSHSession = {}
def ssh_connect(host, user, pkey, window_size = (2 << 15) - 1):
"""
Creates a :py:class:`paramiko.Transport` object an... | StarcoderdataPython |
6516569 | <reponame>Kaufi-Jonas/VaRA-Tool-Suite
"""Plot module for util functionality."""
import typing as tp
from pathlib import Path
import pandas as pd
from matplotlib.axes import Axes
from varats.mapping.commit_map import CommitMap
from varats.utils.git_util import FullCommitHash, ShortCommitHash
def find_missing_revisi... | StarcoderdataPython |
3324107 | <gh_stars>0
from itertools import groupby
import datetime
import os.path
import bisect
import iso8601
from flask import url_for
MIN_YEAR = 2006
ICONS = {
"member": "bill-introduced.png",
"committee": "committee-discussion.png",
"house": "house.png",
"president": "signed-by-president.png",
"unkno... | StarcoderdataPython |
11392261 | #! /usr/bin/env python
import argparse
import sys
import requests
import simplejson
import dict2xml
from bs4 import BeautifulSoup
class Json2xml(object):
# -------------------------------
##
# @Synopsis This class could read a json file
# from the filesystem or get a file from across
# the Intern... | StarcoderdataPython |
1969169 | <filename>experiments/rpi/dojo/dojo_display7.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import atexit
import time
import RPi.GPIO as GPIO
import spi
# assegurar que a função cleanup será chamada na saída do script
atexit.register(GPIO.cleanup)
# usar numeração lógica dos pinos
GPIO.setmode(GPIO.BCM)
DISPLAY =... | StarcoderdataPython |
1788722 | from . import connection
class KafkaProducerPipeline(object):
"""
Publish serialize item to configured topic
"""
def __init__(self, producer):
self.producer = producer
self.topic = None
def open_spider(self, spider):
if not hasattr(spider, 'produce_item_topic'):
... | StarcoderdataPython |
4991482 | from .. import hook, bar, manager
import base
from pythonwifi.iwlibs import Wireless, Iwstats
class Wlan(base._TextBox):
"""
Displays Wifi ssid and quality.
"""
defaults = manager.Defaults(
("font", "Arial", "Font"),
("fontsize", None, "Pixel size. Calculated if None."),
("p... | StarcoderdataPython |
5186617 | from algos.deepobfuscator import DeepObfuscator
from utils.metrics import MetricLoader
class EntropyLoss(_Loss):
def __init__(self, size_average=None, reduce=None, reduction='mean'):
super(EntropyLoss, self).__init__(size_average, reduce, reduction)
# input is probability distribution of output classe... | StarcoderdataPython |
169991 | from django.contrib.auth.models import User, Group
from django.http.response import Http404
from django.shortcuts import get_object_or_404
from rest_framework.parsers import MultiPartParser, FormParser, FileUploadParser, JSONParser
from rest_framework import generics, permissions, status, views
from rest_framework.res... | StarcoderdataPython |
8195186 | #!/usr/bin/env python
#
# Copyright 2010 Los Alamos National Security, LLC
# Written by <NAME> (CCS-2)
#
'''
Functions for running a simulation.
'''
_usage = '''
Usage: %s [options] input_file
where,
input_file : The input file. If the extension on the file name is
".xml", then the executable reads this file d... | StarcoderdataPython |
3203104 | import uuid
import django.contrib.postgres.indexes
import django.contrib.postgres.search
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("backend", "0001"),
]
operations = [
migrations.CreateModel(
... | StarcoderdataPython |
8101593 | '''=============================================================
c:/1work/Python/djcode/pjtk2/migration/get_project_dates.py
Created: 14 Jan 2015 15:43:57
DESCRIPTION:
This script was developed from get_spatial_data.py (and should be
merged with it to faciliate annual/frequent updates).
This scripts gets the start ... | StarcoderdataPython |
268999 | # Example running ManFit
import manfit as mf
import numpy as np
import matplotlib.pyplot as plt
# write function with parameters as parameters
t = np.linspace(0,5,100)
ydata = np.exp(-t/3)*np.sin(2*np.pi*0.7*t) + np.random.uniform(low=-0.5,high=0.5, size=len(t))
def sine(t, freq, tau):
return np.exp(-t/tau... | StarcoderdataPython |
3361456 | """
lambdata - a collection of data science helper functions
"""
import pandas as pd
import numpy as np
# sample code
ONE = pd.DataFrame(np.ones(10))
Zeros = pd.DataFrame(np.zeros(50))
| StarcoderdataPython |
310397 | <reponame>thitta/Someone.tw-Blog
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.test import TestCase, Client
from cms.models import Post, Collection
from cms.utils import reset_post_relations
USER1 = {"username": "john", "password": "<PASSWORD>"}
USER2... | StarcoderdataPython |
339275 | def f():
x = 5
return x
| StarcoderdataPython |
3536044 | import json
import requests
import os
from flask import (request,
jsonify,
make_response,
render_template,
Blueprint,
send_file,
url_for,
abort)
from logzero import logger
from c... | StarcoderdataPython |
3277001 | <reponame>coderzh/pywasm3
#!/usr/bin/env python3
import wasm3
import os, time
scriptpath = os.path.dirname(os.path.realpath(__file__))
wasm_fn = os.path.join(scriptpath, "./wasm/coremark-minimal.wasm")
print("Initializing Wasm3 engine...")
def clock_ms():
return int(round(time.time() * 1000))
env = wasm3.Envir... | StarcoderdataPython |
1839772 | <gh_stars>0
# -*- coding:utf-8 -*-
# author: Xinge
"""
SemKITTI dataloader
"""
import os
import numpy as np
import torch
import random
import time
import numba as nb
import yaml
from torch.utils import data
import pickle
REGISTERED_DATASET_CLASSES = {}
def register_dataset(cls, name=None):
global REGISTERED_DAT... | StarcoderdataPython |
8003746 | <gh_stars>0
n1 = int(input('Primeiro Número: '))
n2 = int(input('Segundo Número: '))
if n1 > n2:
print('Primeiro número é maior')
elif n2 > n1:
print('Segundo número é maior')
else:
print('ambos são iguais')
| StarcoderdataPython |
1962727 | """libpredweb"""
| StarcoderdataPython |
317502 | #!/usr/bin/env python
import sys
if 'develop' in sys.argv:
# use setuptools for develop, but nothing else
from setuptools import setup
else:
from distutils.core import setup
with open('README.rst') as file:
long_description = file.read()
with open('CHANGES') as file:
long_description += file.read... | StarcoderdataPython |
3277968 | import numpy as np
from scipy.optimize import minimize
from scipy.io import loadmat
from numpy.linalg import det, inv
from math import sqrt, pi
import scipy.io
import matplotlib.pyplot as plt
import pickle
import sys
def ldaLearn(X,y):
# Inputs
# X - a N x d matrix with each row corresponding to a trainin... | StarcoderdataPython |
1903500 | <filename>args_parser/hyunjungkim_01.py<gh_stars>0
import os
os.getcwd()
pass
| StarcoderdataPython |
9766781 | <gh_stars>1-10
import os
from .helpers import get_user
from shutil import copyfile
def enable_vhosts():
tmp = []
conf_path = "/usr/local/etc/httpd/httpd.conf"
with open(conf_path, 'r') as input_file:
for line in input_file.readlines():
if line == "#Include /usr/local/etc/httpd/extra/... | StarcoderdataPython |
6677435 | <filename>weights/tools/keras_model_tools.py
# Python script of tools for operations on Keras models
import argparse
import h5py
class KModelTools:
def __init__(self, h5_path=None):
self.h5_path = h5_path
self.f_h5 = h5py.File(h5_path)
def print_h5_wegiths(self):
for laye... | StarcoderdataPython |
1847242 | from os import terminal_size
from typing import Text
import cv2
import numpy as np
#? Drawing a circle by mouse click
def draw_circle(event, x, y, flags, param):
if event==cv2.EVENT_LBUTTONDOWN:
cv2.circle(image, (x,y), 30, (255, 0, 70), -1)
# create blank image and window
image = np.zeros(shape=(512,5... | StarcoderdataPython |
338159 | <filename>error_reporting/google/cloud/error_reporting/util.py
# Copyright 2016 Google LLC 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/l... | StarcoderdataPython |
9783887 | from typing import TYPE_CHECKING
from sqlalchemy import Column, Integer, String, ARRAY, Float, REAL
from sqlalchemy.orm import relationship
from sqlalchemy.sql.schema import ForeignKey
from app.db.base_class import Base
if TYPE_CHECKING:
from .embedding_model import Embedding_Model # noqa: F401
class Embeddin... | StarcoderdataPython |
9726143 | """
This is a WIP and a learning experience.
Flask Documentation: http://flask.pocoo.org/docs/0.12/patterns/fileuploads/
"""
print("BEGIN")
# TODO: Add security. Some password/token passed along with ALL requests. (mandate HTTPS!!!)
# NOTE: Server permissions should (SHALL) be set to mitigate issues/keep shenanigans ... | StarcoderdataPython |
9668886 | # The questions is askin us to find the articulation points
# We'll use modified DFS to detect ariculation points
time = 0
def criticalRouters(numRouters, numLinks, links):
# WRITE YOUR CODE HERE
adjList = dict()
for i in range(1,numRouters + 1):
adjList[i] = list()
for link in links:
... | StarcoderdataPython |
6427483 | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
import os
import unittest
import logging
from droidlet.dialog.dialogue_manager import DialogueManager
from droidlet.memory.dialogue_stack import DialogueStack
from droidlet.dialog.droidlet_nsp_model_wrapper import DroidletNSPModelWrapper
from agents.loco_mc_agen... | StarcoderdataPython |
11252652 | from setuptools import find_packages, setup
with open('README.md', 'r') as readme:
long_description = readme.read()
setup(
name='webshell',
version='1.0',
packages=find_packages(),
zip_safe=False,
install_requires=[
'flask',
],
author='<NAME>',
author_email='<EMAIL>',
d... | StarcoderdataPython |
1819232 | # Generated by Django 3.0.4 on 2020-03-12 11:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('localusers', '0004_auto_20200310_1649'),
('posts', '0002_auto_20200312_1113'),
]
operations = [
mig... | StarcoderdataPython |
3472852 | # coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.215
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from clients.ctm_api_client.conf... | StarcoderdataPython |
4810495 | from unittest import TestCase
from cloudshell.cli.service.node import Node, NodeOperations
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
class NodeImplementation(Node):
def step_down(self, *args, **kwargs):
pass
def step_up(self, *args, **kwargs... | StarcoderdataPython |
8051459 | # -*- coding: utf-8 -*-
#Версия Python 2.7
from cart_page import CartPage
from product_page import ProductPage
from selenium import webdriver
from start_page import StartPage
#Класс добавления продукта
class Aplication:
def __init__(self):
self.driver = webdriver.Chrome()
self.start_pg = StartPage(... | StarcoderdataPython |
9713962 | <reponame>BobbyZhouZijian/AI-Algo-Implmentations<filename>deep_learning/criterions/focal_loss.py
"""Implements Focal Loss"""
import torch
import torch.nn as nn
import torch.nn.functional as F
class FocalLoss(nn.Module):
def __init__(self):
super(FocalLoss, self).__init__()
def forward(self, x, targe... | StarcoderdataPython |
234923 | <reponame>vbillys/reading-group-serialization<filename>examples/python/ExampleIdlData/_ExampleIdlData.py
"""
Generated by Eclipse Cyclone DDS idlc Python Backend
Cyclone DDS IDL version: v0.9.0
Module: ExampleIdlData
IDL file: ExampleIdlData.idl
"""
from enum import auto
from typing import TYPE_CHECKING, Opti... | StarcoderdataPython |
4835498 | # Generated by Django 2.0.3 on 2018-05-16 13:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0010_auto_20180509_2126'),
]
operations = [
migrations.CreateModel(
name='Mail',
fields=[
('i... | StarcoderdataPython |
9619281 | #
# Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
#
""" This module supports writing Deephaven application mode Python scripts. """
from typing import Dict
import jpy
from deephaven import DHError
from deephaven._wrapper import JObjectWrapper, wrap_j_object, unwrap
_JApplicationContext = jpy.get_ty... | StarcoderdataPython |
11312463 | <reponame>QMSS-G5072-2021/SelinaDing
from SelinaDing import SelinaDing
def test_cipher():
result = cipher(text = 'ding', shift = 1, encrypt = True)
assert(result) == 'ejoh'
| StarcoderdataPython |
1993784 | <gh_stars>0
from pathlib import Path
import tensorflow as tf
import horovod.tensorflow.keras as hvd
hvd.init()
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
config.gpu_options.visible_device_list = str(hvd.local_rank())
tf.compat.v1.keras.backend.set_session(tf.compat.v1.Session(config=c... | StarcoderdataPython |
11317403 | <reponame>sprij/scrapy-rethinkdb<filename>tests/test_pipeline.py<gh_stars>1-10
import unittest
from mock import Mock, MagicMock, patch
from itertools import combinations_with_replacement
from scrapy_rethinkdb.pipeline import RethinkDBPipeline, NotConfigured, Item
class RethinkDBPipelineTest(unittest.TestCase):
... | StarcoderdataPython |
11311796 | # imports
import altair as alt
import requests
import streamlit as st
import urllib
import pandas as pd
# import the page-generating functions from your pages module.
from pages.predictions import predict_page
from pages.why_streamlit import why_streamlit_page
from pages.index import index_page
from pages.exploration ... | StarcoderdataPython |
4839515 | from WPTParser.JSONParser.DataExtracter import DataExtracter
class ObjectListDataExtracter(DataExtracter):
def __init__(self):
super().__init__()
def extract(self, obj_list: list, key: str):
try:
key = key.replace(' ', '')
dict_key, dict_value = key.split('=')
... | StarcoderdataPython |
304955 | from .info import QUERY as info
from .bypass import QUERY as bypass
from .decode_invoice import QUERY as decode_invoice
from .check_macaroon import QUERY as check_macaroon
QUERY = [
info,
bypass,
decode_invoice,
check_macaroon
] | StarcoderdataPython |
9649503 | import re
from unittest.mock import Mock, call, patch
import pytest
from civic_scraper.base.asset import Asset, AssetCollection
from .conftest import file_lines
@pytest.fixture
def asset_collection(asset_inputs):
return AssetCollection([Asset(**kwargs) for kwargs in asset_inputs])
def test_asset_methods():
... | StarcoderdataPython |
1747624 | from __future__ import annotations
import asyncio
import logging
from collections.abc import Callable, Coroutine
from typing import TYPE_CHECKING, Any, ClassVar, TypeVar
from ... import utils
from ...abc import BaseUser
from ...enums import IntEnum
from ...models import register
from ...protobufs import EMsg, GCMsg, ... | StarcoderdataPython |
3240752 | import logging
from typing import List
from PIL import Image
import numpy as np
try:
import face_recognition
_FACE_RECOGNITION_LOADED = True
except ImportError:
_FACE_RECOGNITION_LOADED = False
class FaceEmbedder:
def __init__(self, model: str = "large", num_jitters: int = 5):
logging.info("L... | StarcoderdataPython |
3434215 | import json
import responses
import re
import os
from rest_framework.test import APITestCase, APIClient
from rest_framework.reverse import reverse
from rest_framework import status
from rest_framework.authtoken.models import Token
from django.contrib.auth import get_user_model
from django.utils import timezone
from ... | StarcoderdataPython |
6515709 | from itertools import product
import numpy as np
from numpy.testing import assert_allclose
import pandas as pd
import pytest
from linearmodels.iv import IV2SLS
from linearmodels.panel.model import FirstDifferenceOLS
from linearmodels.tests.panel._utility import (
access_attributes,
assert_frame_similar,
a... | StarcoderdataPython |
6400620 | <filename>component/tiles/__init__.py
from sepal_ui.frontend.styles import *
from ..widget.custom_widgets import *
from ..frontend.styles import *
from .alert_map import *
from .parameters import *
from .tiles import *
from .ui import *
| StarcoderdataPython |
265974 | <reponame>ioreshnikov/tamizdat<filename>tests/test_website.py
from unittest import TestCase
from unittest.mock import patch, MagicMock
from tamizdat.models import make_database, Book, File
from tamizdat.website import Website
def read_saved_page(book_id):
filename = "tests/assets/{}.html".format(book_id)
wit... | StarcoderdataPython |
9611656 | # Standard Library
import uuid
# Django
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser
from django.http import HttpResponse
from django.utils.functional import cached_property
# Third Party Libraries
import pytest
from allauth.account.forms import EmailAwarePasswor... | StarcoderdataPython |
11246277 | <reponame>pyhf/pyhf-benchmark<filename>src/pyhf_benchmark/manager.py
import time
from pathlib import Path
from .plot import plot, plot_comb
from .stats import SystemStats
class RunManager(object):
def __init__(self, meta=None):
self._stat = []
self._meta = meta
self._start_time = time.time... | StarcoderdataPython |
11206881 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from setuptools import setup
setup(
name="myutils",
version="1.0",
author='<NAME>',
author_email='<EMAIL>',
license='BSD-2-Clause',
long_description='Libraries that could be used in every project.',
description='Utils',
url='https://githu... | StarcoderdataPython |
1893928 | <gh_stars>0
##Program for converting RIS files into BibTex database
import re
import glob
def readInData(fiName):
fi = open(str(fiName))
fiObj = fi.read()
fi.close()
return fiObj
def readInCrossRef():
refDic = {}
fi = open("KeyForCrossRef.txt")
fiObj = fi.read()
fi.close()
for ... | StarcoderdataPython |
9743494 |
# -*- coding: utf-8 -*-
'''
File name: code\mccarthy_91_function\sol_555.py
Author: <NAME>
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #555 :: McCarthy 91 function
#
# For more information see:
# https://projecteuler.net/problem=555
# Problem Statement
'''... | StarcoderdataPython |
8165489 | from .gziptcp import *
from .gziptcpssl import *
from .plaintcp import *
from .plaintcpssl import *
from .plainudp import *
from .protocolerror import *
__all__ = [
*gziptcp.__all__,
*gziptcpssl.__all__,
*plaintcp.__all__,
*plaintcpssl.__all__,
*plainudp.__all__,
*protocolerror.__all__,
]
| StarcoderdataPython |
6619341 | from django.contrib import admin
import models
admin.site.register(models.Entry)
admin.site.register(models.Category)
| StarcoderdataPython |
3295484 | <filename>tests/data/cve/feed.py
GET_CVE_SYNC_METADATA = {
"CVE_data_type": "CVE",
"CVE_data_format": "MITRE",
"CVE_data_version": "4.0",
"CVE_data_numberOfCVEs": "6769",
"CVE_data_timestamp": "2022-02-23T08:01Z",
"CVE_Items": [{
"cve": {
"data_type": "CVE",
"data... | StarcoderdataPython |
1935245 | <filename>pySDC/implementations/controller_classes/error_estimator.py
import numpy as np
from scipy.special import factorial
from pySDC.implementations.datatype_classes.mesh import mesh, imex_mesh
from pySDC.core.Errors import DataError
class _ErrorEstimatorBase:
"""
This class should be the parent of all e... | StarcoderdataPython |
8164513 | <filename>src/ftd/api/maya.py<gh_stars>1-10
# pylint: disable=invalid-name, redefined-builtin, protected-access
"""Object-oriented API for Autodesk Maya."""
from __future__ import absolute_import, division
import abc
import logging
import math
import sys
import types
from maya import cmds
from maya.api import OpenMay... | StarcoderdataPython |
12834545 | <reponame>vincenttran-msft/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this s... | StarcoderdataPython |
217685 | from pychebfun import *
import numpy as np
import matplotlib.pyplot as plt
# Construct a Python function f and the vector of points at which we want
# to plot it.
def f(x):
return np.sin(6*x) + np.sin(30*np.exp(x))
x = np.linspace(-1,1,1000)
# Plot f on the above points
plt.plot(x,f(x),'k',linewidth=10,alpha=0... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.