id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6630052 | <reponame>autra/mapproxy<filename>mapproxy/source/wms.py
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... | StarcoderdataPython |
229067 | """
MIT License
Copyright (c) 2017 <NAME>
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, including without limitation the rights
to use, copy, modify, merge, publish, distri... | StarcoderdataPython |
330363 | <filename>isolateparser/resultparser/__init__.py
from .breseq_folder_parser import BreseqFolderParser, IsolateTableColumns, get_sample_name
| StarcoderdataPython |
9735516 | '''
Created on Aug 13, 2020
@author: <NAME>
'''
import os
import torch
import torch.optim as optim
import torch.nn as nn
import torch.cuda as cuda
import functools
import argparse
from torch.utils.data import DataLoader
from torch.autograd import Variable
from torchvision.utils import save_image
imp... | StarcoderdataPython |
8071814 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.validators import RegexValidator
gtin_re = r'^[0-9]{6,8}$|^[0-9]{10}$|^[0-9]{12}$|^[0-9]{13}$|^[0-9]{14,}$'
validate_gtin = \
RegexValidator(gtin_re, 'Please enter a valid GTIN/ISBN/EAN/UPC code.')
| StarcoderdataPython |
1664826 | #
# 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
# "License"); you may not... | StarcoderdataPython |
11388432 | """ Usage of RichMenu Manager """
from richmenu import RichMenu, RichMenuManager
# Setup RichMenuManager
channel_access_token = "YOUR_CHANNEL_ACCESS_TOKEN"
rmm = RichMenuManager(channel_access_token)
# Setup RichMenu to register
rm = RichMenu(name="Test menu", chat_bar_text="Open this menu")
rm.add_area(0, 0, 1250, 8... | StarcoderdataPython |
108422 | #!/usr/bin/env python3
"""
Equivalent kubectl commands are much less readable:
k get ds -n kube-system kube-flannel-ds -oyaml
k get ds -n kube-system kube-flannel-ds -o=custom-columns=IFACE:.spec.template.spec.containers[0].args
# Not sure of the next one:
kubectl patch ds -n kube-system kube-flannel-ds -p '{"spec":{"... | StarcoderdataPython |
172225 | # -*- coding: utf-8 -*-
#
# Dell EMC OpenManage Ansible Modules
# Version 3.0.0
# Copyright (C) 2020-2021 Dell Inc. or its subsidiaries. All Rights Reserved.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
from __future__ import (absolute_import, division, print_functio... | StarcoderdataPython |
1695429 | #!/usr/bin/env python
import rospy
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import Twist
def scan_callback(msg):
global g_range_ahead
g_range_ahead = msg.ranges[0]
if g_range_ahead > 10:
g_range_ahead = 10
g_range_ahead = 1
driving_forward = False
scan_sub = rospy.Subscriber... | StarcoderdataPython |
6442743 | <filename>hermes/hermes/email_engine/__init__.py
import ssl
import smtplib
from gaea.log import logger
from gaea.config import CONFIG
from hermes.constants import SENDER, TO
class EmailEngine:
open_connections = {}
def close(self, emails=None):
if emails is None:
emails = list(self.open... | StarcoderdataPython |
307574 | from .core import *
__version__ = '0.0.7'
| StarcoderdataPython |
9685481 | def cat_mouse(x: str) -> str:
return 'Escaped!' if x.count('.') >= 4 else 'Caught!'
| StarcoderdataPython |
5018948 | from django import template
from django.core.exceptions import ViewDoesNotExist
from django.core.urlresolvers import NoReverseMatch
from django.template.defaulttags import url as django_url
register = template.Library()
class LocalSiteURLNode(template.Node):
def __init__(self, url_node):
self.url_node =... | StarcoderdataPython |
6608817 | import launch
from launch.actions import RegisterEventHandler
from launch.event_handlers.on_process_exit import OnProcessExit
from launch.events.process.process_exited import ProcessExited
from launch.launch_context import LaunchContext
from launch.actions import RegisterEventHandler
import launch_ros
class bcolors:
... | StarcoderdataPython |
4847885 | <reponame>sined-rahkuk/math-examples-generator<filename>example.py
import sys
import random
import argparse
DEFAULT_DIV_AMOUNT = 10
DEFAULT_MUL_AMOUNT = 10
DEFAULT_FIRST_RANK = 3
DEFAULT_SECOND_RANK = 2
class Example:
def __init__(self, first_dig_rank, sec_dig_rank, operation_char='x'):
self.first_dig_r... | StarcoderdataPython |
3576480 | <filename>xapi_bridge/converter.py
"""Convert tracking log entries to xAPI statements."""
import logging
from xapi_bridge import exceptions, settings
from xapi_bridge.statements import base, course, problem, video, vertical_block, attachment
logger = logging.getLogger(__name__)
TRACKING_EVENTS_TO_XAPI_STATEMENT_M... | StarcoderdataPython |
9731496 | <filename>locations/spiders/hm.py
import scrapy
from locations.items import GeojsonPointItem
import itertools
def chunks(l, n):
for i in range(0, len(l), n):
yield l[i : i + n]
def partition(l, n):
return list(chunks(l, n))
def process_hours(opening_hours):
ret_hours = []
for hours_str in ... | StarcoderdataPython |
6513482 | <filename>tests/dispatch/__init__.py<gh_stars>100-1000
"""Unit-tests for the dispatch project
"""
| StarcoderdataPython |
6520001 | import os, sys
import unittest
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../..'))
from test_environment_device import WuTest
from configuration import *
class TestDiscovery(unittest.TestCase):
def setUp(self):
self.test = WuTest(False, False)
def test_basic_discoveryAPI(s... | StarcoderdataPython |
314550 | from kivy.uix.textinput import TextInput
class MaskaredText(TextInput):
symbol = "0123456789/"
use_symbol = True
mask = "##/##/####"
use_mask = True
def insert_text(self, string, from_undo=False):
text_size = len(self.text)
mask_size = len(self.mask)
if self.use_symbol:
... | StarcoderdataPython |
8163830 | <reponame>euan-forrester/photo-recommender-poc
import flickrapi
import logging
import requests
from django.core.cache import cache
from django.conf import settings
class FlickrApiWrapper:
"""
Wraps around the flickrapi package: adds in retries to calls that fail, and external cacheing via memcached
"""
... | StarcoderdataPython |
263246 | import os
import dialogflow_v2beta1 as dialogflow
from google.api_core.exceptions import InvalidArgument
import random
import json
import packages.covid_endpoint
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = './configfiles/private_key.json'
class DialogFlowWrapper:
def __init__(self):
self.DIALOGFLOW_PR... | StarcoderdataPython |
4938092 | # V1 : DEV
# V2
class Solution:
def __init__(self, w):
"""
:type w: List[int]
"""
self.preSum = [0] * len(w)
self.preSum[0] = w[0]
for i in range(1, len(w)):
self.preSum[i] = self.preSum[i - 1] + w[i]
def pickIndex(self):
"""
:rty... | StarcoderdataPython |
3267440 | import pickle
def read_dataset(eval_path):
difficult_words = []
pos_tags = []
with open(eval_path, 'r', encoding='utf-8') as reader:
while True:
line = reader.readline()
if not line:
break
row = line.strip().split('\t')
difficult_word,... | StarcoderdataPython |
5009739 | import pytest
@pytest.fixture(scope="module")
def smtp_connection():
from uaa_bot.notifier import smtplib
| StarcoderdataPython |
3420398 | import numpy.testing as npt
import pytest
from scipy.special import logsumexp
import numpy as np
from ..lemm import LEMM_Parameters, GLEMM_Parameters, GLEMM_Parameters_Untied
class Test_Parameters:
def test_lemm_parameters(self):
M = 10
m = 4
n = 2
logp = np.random.standard_norma... | StarcoderdataPython |
6602521 | <gh_stars>1-10
'''
Settings for Tornado app go here
'''
import os
from tornado.httpserver import HTTPServer
from tornado.options import define, options
from tornado.web import Application,StaticFileHandler
from tornado.ioloop import IOLoop
from ri5c.views import GraphView
define('port', default=8000, help='port to li... | StarcoderdataPython |
1907299 | import os
import pathlib
from flask_babelex import lazy_gettext
from psycopg2.errorcodes import CHECK_VIOLATION, UNIQUE_VIOLATION
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.base import NO_CHANGE, object_state
def strings_are_equal_ignoring_case(string1: str, string2: str):
return string1 and s... | StarcoderdataPython |
369871 | #!/usr/bin/env python
from tinyrenderer.core import engine
import tinymath as tm
import tinyutils as tu
import numpy as np
from OpenGL.GL import *
if __name__ == '__main__' :
app = engine.Application()
cameraProjData = engine.CameraProjData()
cameraProjData.projection = engine.CameraProjection.PERSPECTI... | StarcoderdataPython |
1751619 | <gh_stars>0
'''
Manage projects for an instance of the Data Migration Service.
'''
from ... pyaz_utils import _call_az
from . import task
def create(location, name, resource_group, service_name, source_platform, target_platform, tags=None):
'''
Create a migration project which can contain multiple tasks.
... | StarcoderdataPython |
3346727 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('pfss', '0011_creaturegroup_allowedextratype'),
]
operations = [
migrations.AddField(
model_name='creatureextraty... | StarcoderdataPython |
6613671 | from sklearn.datasets import make_regression
from matplotlib import pyplot as plt
import numpy as np
from sklearn.linear_model import LinearRegression
# Functions
def gram_schmidt(a):
q = []
for i in range(len(a)):
#orthogonalization
q_tilde = a[i]
for j in range(len(q)):
q_... | StarcoderdataPython |
3365671 | <reponame>flexiooss/hotballoon-shed<gh_stars>0
import shutil
from pathlib import Path
from cmd.Directories import Directories
from cmd.Tasks.Task import Task
from cmd.Tasks.Tasks import Tasks
from cmd.package.modules.Module import Module
from cmd.package.modules.ModulesHandler import ModulesHandler
class CleanSource... | StarcoderdataPython |
11272841 | from .helper import PillowTestCase
from PIL import Image, PSDraw
import os
import sys
class TestPsDraw(PillowTestCase):
def _create_document(self, ps):
im = Image.open("Tests/images/hopper.ppm")
title = "hopper"
box = (1*72, 2*72, 7*72, 10*72) # in points
ps.begin_document(titl... | StarcoderdataPython |
3373201 | <gh_stars>0
# https://www.hackerrank.com/challenges/alphabet-rangoli/problem
def print_rangoli(size):
s = ""
for i in range(size):
s += chr(97 + i)
for i in range(size - 1, -size, -1):
line = s[: abs(i) : -1] + s[abs(i) :]
print("-".join(line).center(4 * n - 3, "-"))
| StarcoderdataPython |
6563741 | <filename>src/dct/camera/stream.py
import cv2
import numpy as np
import threading
import time
import queue
import uuid
import logging
from dct.util.silverstone import DeepRacerCar
class StreamConsumer:
def __init__(self):
self.queue = queue.Queue()
def notify(self, frame):
self.queue.put(fra... | StarcoderdataPython |
12818056 | <reponame>LaudateCorpus1/squest<filename>service_catalog/templatetags/version.py
from django import template
register = template.Library()
@register.simple_tag
def app_version():
"""
Return Squest version as listed in `__version__` in `init.py` of settings package
"""
from django.conf import settings... | StarcoderdataPython |
5018991 | <filename>ridurre/random_pruning.py
from typing import Callable, Optional, List
import numpy as np
from keras import models, layers
from ridurre import base_filter_pruning
class RandomFilterPruning(base_filter_pruning.BasePruning):
def __init__(self,
removal_factor: float,
mode... | StarcoderdataPython |
5002967 | <gh_stars>0
import os
from setuptools import setup
from pip.req import parse_requirements
from blockchain_proofs import __version__
install_reqs = parse_requirements('requirements.txt', session=False)
requirements = [str(ir.req) for ir in install_reqs]
with open('README.rst') as readme:
long_description = readme.... | StarcoderdataPython |
11348845 | # -*- coding: utf-8 -*-
"""
Created on Fri Mar 19 14:23:32 2021
@author: gualandi
"""
import numpy as np
from pyomo.environ import ConcreteModel, Var, Objective, Constraint, SolverFactory
from pyomo.environ import Binary, RangeSet, NonNegativeReals
def ParseData(filename):
fh = open(filename, 'r', encoding="ut... | StarcoderdataPython |
8160793 | # -*- coding:utf-8 -*-
class FactoryMixin:
@classmethod
def as_factory(cls, *args, **kwargs):
"""
This class method creates a factory from a class reference (``cls``) and its arguments. It is then used by the solvers which need to be able to instantiate any object like solutions or ... | StarcoderdataPython |
32668 | <filename>lintcode/0008-rotate-string.py
# Description
# 中文
# English
# Given a string(Given in the way of char array) and an offset, rotate the string by offset in place. (rotate from left to right)
# offset >= 0
# the length of str >= 0
# Have you met this question in a real interview?
# Example
# Example 1:
# I... | StarcoderdataPython |
8139230 | <reponame>0xflotus/Bashfuscator
from bashfuscator.core.mutators.command_obfuscator import CommandObfuscator
from bashfuscator.core.mutators.command_obfuscator import Stub
class CaseSwapper(CommandObfuscator):
def __init__(self):
super().__init__(
name="Case Swapper",
description="F... | StarcoderdataPython |
1748763 | <reponame>picam360/picam360tegra
import sys
from Adafruit_MotorHAT import Adafruit_MotorHAT
driver = Adafruit_MotorHAT(i2c_bus=1)
motor1 = driver.getMotor(1)
motor2 = driver.getMotor(2)
dir_forward = Adafruit_MotorHAT.BACKWARD
dir_backward = Adafruit_MotorHAT.FORWARD
duty = 40
speed = int(duty*255/100)
for line in sy... | StarcoderdataPython |
3467207 | <filename>conanfile.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
import os
class LibRdKafkaConan(ConanFile):
name = "librdkafka"
version = "0.11.6"
description = "The Apache Kafka C/C++ client library"
url = "https://github.com/raulbocanegra/li... | StarcoderdataPython |
6663751 | <reponame>hydroshare/hsmodels<gh_stars>0
import uuid
from typing import List
from pydantic import AnyUrl, BaseModel, Field, root_validator, validator
from rdflib.term import Identifier as RDFIdentifier
from hsmodels.namespaces import CITOTERMS, DC, DCTERMS, HSRESOURCE, HSTERMS, ORE, RDF
from hsmodels.schemas.rdf.fiel... | StarcoderdataPython |
8045266 | #! /usr/bin/python3 -i
# coding=utf-8
import os
PACKAGE_DIR=os.path.abspath(os.path.dirname(__file__))
CHAPAS2UD=os.path.join(PACKAGE_DIR,"chapas2ud")
UNIDIC2IPADIC=os.path.join(PACKAGE_DIR,"unidic2ipadic")
import numpy
from spacy.language import Language
from spacy.symbols import LANG,NORM,LEMMA,POS,TAG,DEP,HEAD,ENT... | StarcoderdataPython |
379093 | import gym
import argparse
# from gym.envs.mujoco import HalfCheetahEnv
from rlkit.envs.navigation2d.navigation2d import Navigation2d
from rlkit.envs.mujoco.ant import AntEnv
from rlkit.envs.mujoco.half_cheetah import HalfCheetahEnv
import torch
import rlkit.torch.pytorch_util as ptu
from rlkit.torch.sac.msdads.msdads... | StarcoderdataPython |
11390832 | import pathlib
import helpers
import numpy as np
import pytest
import meshio
@pytest.mark.parametrize(
"mesh",
[
# helpers.empty_mesh,
helpers.tri_mesh
],
)
def test_wkt(mesh):
def writer(*args, **kwargs):
return meshio.wkt.write(*args, **kwargs)
helpers.write_read(write... | StarcoderdataPython |
9693286 | from .node_client import NodeCommClient
from .popup_manager import PopupManager
from .service_proxy import ServiceProxy
from .editor_client import cli, EditorClient
from .popup_manager import get_popup_manager
from .logger import log
from . import logger
__all__ = [
'cli',
'EditorClient',
'logger',
'log... | StarcoderdataPython |
4820982 | <gh_stars>0
from collections import namedtuple
Point = namedtuple('Point', 'x, y')
points_of_a_triangle = (
Point(x=1, y=3),
Point(x=4, y=5),
Point(x=3, y=0)
)
for x_coordinate, y_coordinate in points_of_a_triangle:
print(f'X Coordinate {x_coordinate}')
print(f'Y Coordinate {y_coordinate}')
p... | StarcoderdataPython |
6403009 | <reponame>David-Lor/twitterscraper<filename>twitterscraper/tests/test_twitter.py
import datetime
import datetimerange
import pytest
from twitterscraper.services import TwitterAPIClient, TwitterNitterClient
from twitterscraper.models import TwitterTweet
from twitterscraper.settings import load_settings
from twitterscr... | StarcoderdataPython |
11331929 | import configparser
import os
import logging
class Config(object):
""" Class to manage accessing and writing a configuration
"""
config_file_name = "made.config"
section_wp = 'work_products'
section_inputs = 'inputs'
section_project = 'project'
section_pipeline = 'pipeline'
def __ini... | StarcoderdataPython |
5167471 | <reponame>mkudlej/3scale-tests
"""
Rewrite /spec/functional_specs/do_not_send_openresty_version_spec.rb
When requesting non existing endpoint openresty version should not be sent
in the response body or in the response header
"""
import backoff
import pytest
from testsuite import rawobj
@pytest.fixture(scope="module... | StarcoderdataPython |
11211703 | <reponame>lsst-camera-dh/IandT-jobs
#!/usr/bin/env python
"""
Producer script for BOT_acq_recovery harnessed job.
Given an acq_run number, specified in the lcatr.cfg file, this job
will collect the symlinks to the frames from all of the retry attempts
in the BOT_acq job's working directories for that run and copy the
... | StarcoderdataPython |
5173564 | <gh_stars>0
"""
Basic LSTM.
"""
import torch
import torch.nn as nn
from src.models.base_torch_model import BaseTorchModel
class LSTM(BaseTorchModel):
"""
Basic LSTM.
"""
def __init__(self, config, vocab) -> None:
"""
[summary]
:param config: [description]
:type conf... | StarcoderdataPython |
1743145 | # -*- coding: utf-8 -*-
"""
pybitcoin
~~~~~
:copyright: (c) 2014-2016 by Halfmoon Labs, Inc.
:license: MIT, see LICENSE for more details.
"""
import opcodes
from .network import broadcast_transaction, send_to_address, get_unspents, \
embed_data_in_blockchain, make_send_to_address_tx, make_op_retu... | StarcoderdataPython |
5161108 | <reponame>RevansChen/online-judge
# Python - 3.6.0
string_to_number = int
| StarcoderdataPython |
1868821 | <filename>model/ipopt_predict.py
import sys
import os
ARGLIST = sys.argv
ARGLEN = len(ARGLIST)
derp = "(options) output_file_name integration_steps\n -h for options\n -u for usage and disclaimers\n"
options = " -P path : specify a standard PATH (including end /) for all files assuming standard name... | StarcoderdataPython |
9682990 | <reponame>bendavis/gehome<filename>gehomesdk/erd/values/laundry/tumble_status.py
import enum
@enum.unique
class TumbleStatus(enum.Enum):
NOT_AVAILABLE = "N/A"
ENABLE = "Enabled"
DISABLE = "Disabled"
| StarcoderdataPython |
6529988 | <reponame>aollio/toys
#!/usr/bin/env python3
import time
import multiprocessing
__author__ = '<NAME>'
__email__ = '<EMAIL>'
def say(message):
for i in range(3):
print(message)
time.sleep(1)
def main():
pool = multiprocessing.Pool(processes=4)
for i in range(3):
msg = 'hello %s'... | StarcoderdataPython |
9716510 | # Copyright 2013 Rackspace Hosting
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | StarcoderdataPython |
1776396 | <reponame>nxphi47/eye_gesture_app_wth
#!/usr/bin/env python
from __future__ import print_function
import tensorflow as tf
from keras.layers.merge import Concatenate, Add, Dot, Multiply
import glob
import os
from PIL import Image
import numpy as np
from keras import backend as K
from keras.layers import Input, Activatio... | StarcoderdataPython |
8065334 | # python game with pygame : Jumping stickman
import pygame
import sys
# step1 : set screen, fps
# step2 : show stickman, jump stickman
# step3 : show tree, move tree
pygame.init()
pygame.display.set_caption('Jumping stickman')
MAX_WIDTH = 800
MAX_HEIGHT =1000
def main():
# set screen, fps
s... | StarcoderdataPython |
4865174 | # MIT License
# Copyright (c) Facebook, Inc. and its affiliates.
# 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, including without limitation the rights
# to use, copy... | StarcoderdataPython |
9716532 | import abc
class BaseRestriction(abc.ABC):
"""
Base class for all restrictions.
"""
def __init__(self, penalty=0):
self.penalty = penalty
def __repr__(self):
cls = self.__class__.__name__
return f"{cls}(penalty={self.penalty})"
def __eq__(self, other):
self_c... | StarcoderdataPython |
9766558 | import datetime
from collections import deque
from typing import List, Deque
import redis
from redisolar.dao.base import MetricDaoBase
from redisolar.dao.redis.base import RedisDaoBase
from redisolar.models import Measurement
from redisolar.models import MeterReading
from redisolar.models import MetricUnit
from redis... | StarcoderdataPython |
3573753 | <gh_stars>0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Imports
from keras.optimizers import SGD
#model, X, Y_oh, x_ph=x_ph, y_ph=y_ph, sess=sess,
# model_path='./saved_model/lenet_dogscats',nb_epochs=NB_EPOCHS,
# nb_batches=NB... | StarcoderdataPython |
3376905 | from os.path import join
from torchvision import transforms
from datasets import DatasetFromFolder as data_loader
from datasets_real import DatasetFromFolder as data_loader_real
from torch.utils.data import DataLoader
def transform():
return transforms.Compose([
# ColorJitter(hue=0.3, brightness=0.3, satu... | StarcoderdataPython |
120087 | <reponame>oil-rope/oil-and-rope
from ..viewsets.registration import ProfileViewSet, UserViewSet
from .routers import OilAndRopeDefaultRouter
router = OilAndRopeDefaultRouter()
router.register(prefix=r'user', viewset=UserViewSet, basename='user')
router.register(prefix=r'profile', viewset=ProfileViewSet, basename='prof... | StarcoderdataPython |
8147391 | import logging
import traceback
import sys
from typing import List
from aiotinydb import AIOTinyDB, AIOJSONStorage
from aiotinydb.middleware import CachingMiddleware
from discord.ext import commands
from utils.singleton import singleton
@singleton
class Bot:
logger = logging.getLogger("bot")
def __init__(
... | StarcoderdataPython |
9639099 | # -*- coding: utf-8 -*-
"""Templates for common tasks in ML and statistics."""
import numpy as np
from functools import partial
from .core import plot, bar, hist
import math
prob_hist = partial(
hist,
ylab="Observation Count (Valid)",
xlab="Probability Bucket",
bins=np.arange(0, 1.01, 0.05),
)
prob_h... | StarcoderdataPython |
328051 | import FWCore.ParameterSet.Config as cms
process = cms.Process("CONVERT")
process.source = cms.Source("EmptySource")
process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))
process.load("Configuration.Geometry.GeometryIdeal_cff")
process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi")
p... | StarcoderdataPython |
3314201 | import re
from six import text_type
"""Translate strings to and from SOAP 1.2 XML name encoding
Implements rules for mapping application defined name to XML names
specified by the w3 SOAP working group for SOAP version 1.2 in
Appendix A of "SOAP Version 1.2 Part 2: Adjuncts", W3C Working Draft
17, December 2001, <htt... | StarcoderdataPython |
6566424 | #!/usr/bin/env python3
import json
from mock import patch
from unittest import TestCase
from pytest import fixture
from distribution.domain.building import Building
from distribution.rest import rest
from distribution.service import locationservice
from distribution.foundation.exceptions import DomainIdError
@fixture
... | StarcoderdataPython |
5056339 | # -*-coding:utf-8-*-
'''
使用post方法对有道进行在线翻译
通过抓取有道词典的在线翻译 http://fanyi.youdao.com/
抓取有道词典的请求头信息,来进行POST提交,进行在线翻译
有道的请求头
POST http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule HTTP/1.1
Host: fanyi.youdao.com
Proxy-Connection: keep-alive
Content-Length: 209
Accept: application/json, text/javascrip... | StarcoderdataPython |
98763 | <gh_stars>1-10
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.effects.UsesEffectNode
from pandac.PandaModules import *
class UsesEffectNode(NodePath):
__module__ = __name... | StarcoderdataPython |
67543 | <gh_stars>0
# Simple Python 3.x Sample for receiving CAN Frames via IP / UDP to PEAK-System Gateway
# (c) 2022 PEAK-System technik GmbH
# This is a SAMPLE - it is NOT optimzed - it is for training - we are no Python Gurus...
# Author: U.W.
# www.peak-system.com
from ctypes.wintypes import BYTE
import socket
f... | StarcoderdataPython |
6702691 | # This module implements a handler for serial_for_url("no_op://").
from panoptes.utils.serial_handlers import NoOpSerial
# Export it as Serial so that it will be picked up by PySerial's serial_for_url.
Serial = NoOpSerial
| StarcoderdataPython |
4977598 | <gh_stars>0
from rest_framework.decorators import api_view
from rest_framework.response import Response
from core.authors.models import Author
from django.contrib.auth import authenticate
QUERY = "login"
def handle_request(request):
success = True
message = "You have been signed in successfully"
usernam... | StarcoderdataPython |
1797437 | <reponame>Db2-DTE-POC/db2shift
#
# Set up Jupyter MAGIC commands "sql".
# %sql will return results from a DB2 select statement or execute a DB2 command
#
# IBM 2019: <NAME>
# Version 2019-10-03
#
from __future__ import print_function
from IPython.display import HTML as pHTML, Image as pImage, display as pdisplay, Jav... | StarcoderdataPython |
1864490 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Program Name: mult_add.py
# <NAME>
# 07/14/2016
# Python Version 3.4
# Description: A function that takes in 3 parameters (a,b,c) and does the following operation a*b+c
# multAdd function
def multAdd(a,b,c):
return ((a*b)+c)
# Main function
def main():
a = 6
b = 1... | StarcoderdataPython |
116212 | <gh_stars>0
from django.conf.urls import url
from pretix_covid_certificates.views import CovidCertificatesSettings
urlpatterns = [
url(
r"^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/covidcerts/$",
CovidCertificatesSettings.as_view(),
name="settings",
),
]
| StarcoderdataPython |
3527499 | <reponame>BjornChrisnach/Python_6hour_course
# Error handling
text = input("Username: ")
try:
number = int(text)
print(number)
except:
print("Invalid Username")
| StarcoderdataPython |
8106028 | # -*- coding: utf-8 -*-
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from tutorial import styles
from server import app
def s(string_block):
return string_block.replace(' ', '')
# # # # # # #
# Authenticating to Dash Deployment Server with... | StarcoderdataPython |
3368370 | <filename>day_14_a.py
def insert_masked_data(memory: dict, bitmask: list, t: int, b: list):
value = None
if t in memory:
value = memory[t]
else:
value = [0] * 36
for i, m, d in zip(range(36), bitmask, b):
if m == "X":
value[i] = d
else:
value[i] = ... | StarcoderdataPython |
1989376 | import json
import urllib2
import requests
url = 'http://192.168.3.11:8080/post'
def main():
f = open("test_vector.json", "r")
test_vec = json.load(f)
f.close()
for d in test_vec:
print "\nRequest:\n %s"%d
data = json.dumps(d)
clen = len(data)
req = urllib2.Request(u... | StarcoderdataPython |
245144 | import typing
def py_sorted(numbers: typing.List[int]) -> typing.List[int]:
"""The Python sorted algorithm.
Args:
numbers (typing.List[int]): A list of integers.
Returns:
typing.List[int]: A list of integers ordered from smallest value
to largest value.
"""
return sorted(... | StarcoderdataPython |
1943790 | <reponame>NursultanBeken/leetcode_practice
"""
Sliding window technique
"""
class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
char_set = set()
result = 0
left = 0
for i in range(len(s)):
# remo... | StarcoderdataPython |
6574634 | """Shared functions for fixes."""
import logging
import os
from functools import lru_cache
import dask.array as da
import iris
import pandas as pd
from cf_units import Unit
from scipy.interpolate import interp1d
from esmvalcore.iris_helpers import var_name_constraint
logger = logging.getLogger(__name__)
def add_au... | StarcoderdataPython |
4968566 | <filename>src/toil/utils/toilStatus.py
# Copyright (C) 2015-2021 Regents of the University of California
#
# 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... | StarcoderdataPython |
3405984 | import os
import numpy as np
import nibabel as nib
from nilabels.tools.aux_methods.utils_path import connect_path_tail_head
from nilabels.tools.aux_methods.utils_nib import set_new_data
class LabelsFuser(object):
"""
Facade of the methods in tools, for work with paths to images rather than
with data.
... | StarcoderdataPython |
6671680 | from .talk import Talk
| StarcoderdataPython |
1785153 | <reponame>mengalong/bter
# Copyright 2017~ mengalong <<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.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | StarcoderdataPython |
8179770 | <gh_stars>1-10
# 1 Gold Star
# The built-in <string>.split() procedure works
# okay, but fails to find all the words on a page
# because it only uses whitespace to split the
# string. To do better, we should also use punctuation
# marks to split the page into words.
# Define a procedure, split_string, that takes two
... | StarcoderdataPython |
6616563 | <reponame>rob-blackbourn/bareasgi<filename>bareasgi/http/http_callbacks.py
"""The http callbacks"""
from typing import Awaitable, Callable
from .http_request import HttpRequest
from .http_response import HttpResponse
HttpRequestCallback = Callable[
[HttpRequest],
Awaitable[HttpResponse]
]
HttpMiddlewareCallb... | StarcoderdataPython |
3526288 | <reponame>yaya-cheng/FGNM<filename>attack_method.py
import numpy as np
import tensorflow as tf
import scipy.stats as st
from utils import *
slim = tf.contrib.slim
def project_kern(kern_size):
kern = np.ones((kern_size, kern_size), dtype=np.float32) / (kern_size ** 2 - 1)
kern[kern_size // 2, kern_size // 2] =... | StarcoderdataPython |
3586211 | <gh_stars>1-10
import json
import xml.dom.minidom
# 读取json文件内容,返回字典格式
# with open('./answer.json', 'r', encoding='utf8')as fp:
# json_data = json.load(fp)
# print('这是文件中的json数据:', json_data)
# print('这是读取到文件数据的数据类型:', type(json_data))
# for every_img_ans in json_data:
# # print(every_img_ans)
... | StarcoderdataPython |
3476406 | '''Common get info functions for ping'''
import logging
# Genie
from genie.utils import Dq
from genie.metaparser.util.exceptions import SchemaEmptyParserError
log = logging.getLogger(__name__)
def get_ping_message(
device,
interface,
address,
source,
size,
count,
):
""" Get ntp peer... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.