id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
11225265 | #!/usr/bin/env python3
from evawiz_basic import *
if ( len(sys.argv)<2 ):
exit(0);
pre = " -Wl,"
if ( sys.argv[1] == "tcu" ):
pre = " -Xlinker "
pass
inc= "";
def add_path(path,absolute=False):
global inc
if absolute:
inc += "%s-rpath='%s'"%(pre,path)
else:
inc += "%s-rpath='$... | StarcoderdataPython |
9740813 | #
# Try to tell the difference between the images
#
#import cv2
import Image, numpy
def split(img):
pixels = list(img.getdata())
r = []
g = []
b = []
for p in pixels:
r.append(p[0])
g.append(p[1])
b.append(p[2])
rr = numpy.asarray(r)
gg = numpy.asarray(g)
bb = numpy.asarray(b)
return rr,... | StarcoderdataPython |
341865 | <gh_stars>10-100
from django.core.management.base import BaseCommand
from django.db import connections
from tsdata.sql import get_add_constraints_and_indexes
class Command(BaseCommand):
"""Inspect and print current NC database constraints and indexes"""
def handle(self, *args, **options):
cursor = c... | StarcoderdataPython |
4851696 | <filename>tests/utils.py
import json
from time import time
from async_asgi_testclient import TestClient
from qbot.utils import calculate_signature
async def send_slack_request(event: dict, client: TestClient):
timestamp = time()
data = json.dumps(event).encode("utf-8")
signature = calculate_signature(ti... | StarcoderdataPython |
9651918 | import sys
import time
def go_sukiya(wallet, is_bilk):
menu = {
"牛丼ミニ": 290,
"牛丼並盛": 350,
"牛丼中盛": 480
}
print("いらっしゃいませ!")
if is_bilk:
print("お客様は一度食い逃げしています")
print("警察を呼びます")
sys.exit()
print("何をご注文なさいますか?")
products = choice_multiple(menu)
... | StarcoderdataPython |
4972285 | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | StarcoderdataPython |
11257109 | <gh_stars>10-100
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | StarcoderdataPython |
11330303 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Authors: <NAME>
# Imports.
import sys; sys.path += [".", ".."]
import argparse as Ap
import logging as L
import numpy as np
import os, pdb, sys
import time
import tensorflow.compat.v1... | StarcoderdataPython |
3279913 | <gh_stars>10-100
#! /usr/bin/env python3
# -*- coding: utf-8; py-indent-offset: 4 -*-
#
# Author: Linuxfabrik GmbH, Zurich, Switzerland
# Contact: info (at) linuxfabrik (dot) ch
# https://www.linuxfabrik.ch/
# License: The Unlicense, see LICENSE file.
# https://git.linuxfabrik.ch/linuxfabrik-icinga-plugins/c... | StarcoderdataPython |
8024067 | <filename>iris/commons/clickhouse.py
import asyncio
import os
from collections.abc import Iterator
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from datetime import datetime
from logging import LoggerAdapter
from pathlib import Path
from typing import Any
import aiofiles.os
from ... | StarcoderdataPython |
11247857 | """
test_xvfb_server.py
Copyright 2011 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
w3af is distributed in the hope that it... | StarcoderdataPython |
5099526 | <reponame>mwroffo/FastCardsOnline<filename>app/main/__init__.py<gh_stars>0
# main.__init__.py
# declares the main blueprint for core functionality.
from flask import Blueprint
bp = Blueprint('main', __name__)
from app.main import routes | StarcoderdataPython |
9762007 | """
Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
Note:
s could be empty and contains only lowe... | StarcoderdataPython |
11210355 | import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
def gauss_evaluate_likelihood(X, x_true):
if len(X.shape) == 3:
a,b,c = X.shape
X = np.reshape(X, newshape=(a,b*c))
x_true = np.reshape(x_true, newshape=(b*c,))
X_mean = np.mean(X,0)
X_sd = np.std(X,0)
return np.mean(-(... | StarcoderdataPython |
9664764 | import functools
import logging
from typing import Any, Callable
import typer
from adk.exceptions import QneAdkException
def catch_qne_adk_exceptions(func: Callable[..., Any]) -> Any:
""" Decorator function to catch exceptions and print an error message """
@functools.wraps(func)
def catch_exceptions(*a... | StarcoderdataPython |
6657229 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : tql-ANN.
# @File : demo
# @Time : 2019-12-04 20:10
# @Author : yuanjie
# @Email : <EMAIL>
# @Software : PyCharm
# @Description :
import numpy as np
from annzoo.faiss import ANN
data = np.random.random((1000, 128)).astyp... | StarcoderdataPython |
6545359 | # First request to FlowXO that determines structure (limits) of all further requests
from user import User
import constants as c
from outgoing import message
dummy = 'dummy'
user = User(dummy)
for i in range(c.MAX_SERVICE_MESSAGES):
user.update_service_messages(text=dummy, buttons=[dummy]*c.MAX_BUTTONS_PER_SERVI... | StarcoderdataPython |
1721781 | <reponame>Jan-zou/LeetCode
# !/usr/bin/env python
# coding: utf-8
'''
Description:
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0?
Find all unique triplets in the array which gives the sum of zero.
Note:
+ Elements in a triplet (a,b,c) must be in non-descending order. ... | StarcoderdataPython |
176674 | <reponame>DoctorHayes/235CppStyle
import re
# Recursive function for compound statements (blocks, functions, etc.)
def validate_statement_indentation(self, code_lines, line_index, indent_min = 0, indent_max = 0, enclosure_stack = [], isNewStatement = True):
if line_index >= code_lines.num_lines:
return li... | StarcoderdataPython |
1724535 | <reponame>falabrasil/br-ali<filename>explogs/20_bracis_kaldi/g2p_map/news2m2m.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8
#
# Grupo FalaBrasil (2020)
# Universidade Federal do Pará
#
# author: apr 2020
# <NAME> - https://cassota.gitlab.io/
# last edited: jul 2020
import sys
import o... | StarcoderdataPython |
1926745 | from os.path import exists, expanduser
import pandas as pd
import time
class ExecExcel:
"""
read xlsx and csv
"""
def __init__(self, file_path):
self.file_path = expanduser(file_path)
def read(self, sheet='Sheet1', axis=0, index_col=None, **kwargs):
df = pd.ExcelFile(self.file_pat... | StarcoderdataPython |
6661561 | __REFERENCES__ = [
'https://github.com/leftthomas/SRGAN/blob/master/pytorch_ssim/__init__.py'
]
from math import exp
import torch
import torch.nn.functional as F
from torch.autograd import Variable
def gaussian(window_size: int, sigma: int) -> torch.Tensor:
gauss = torch.Tensor(
[
exp(-(... | StarcoderdataPython |
58514 | from kairon import cli
import logging
if __name__ == "__main__":
logging.basicConfig(level="DEBUG")
cli()
| StarcoderdataPython |
1855019 | <reponame>slavad/py-series-clean
from helpers.common_imports import *
def generate_index_vector(vector_size):
"""generates index vector: from -max_index to max_index"""
if vector_size % 2 == 0:
raise ValueError("matrix_size must be odd")
max_index = (vector_size - 1)/2
index_vector = np.arange(... | StarcoderdataPython |
6602772 | from flask import Flask, request, jsonify, Blueprint
from flask_jwt_extended import (jwt_required, get_jwt_identity)
import database
import function
post_endpoints = Blueprint('post_endpoints', __name__)
# POSTS
@post_endpoints.route('/post/<string:id>/comments', methods=['POST'])
@jwt_required
def add_comment(id):
... | StarcoderdataPython |
5127527 | """
Test for deprecations of imports into global namespace::
sage: berlekamp_massey
doctest:warning...:
DeprecationWarning:
Importing berlekamp_massey from here is deprecated. If you need to use it, please import it directly from sage.matrix.berlekamp_massey
See https://trac.sagemath.org/27066 for... | StarcoderdataPython |
6605454 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
def part1(in_data):
data = re.sub(r"!.", "", in_data)
data = re.sub(r"<[^>]*>", "", data)
score = 0
next_score = 1
for char in data:
if (char == "{"):
score += next_score
next_score += 1
elif (char ==... | StarcoderdataPython |
74270 | <filename>src/app_server/user_management/user_query.py
from datetime import datetime
from io import SEEK_CUR
import logging
from flask import request
from config_utils import *
from sqlalchemy import *
from psycopg2.errors import UniqueViolation
import hashlib
import urllib.parse as urlparse
from key_processing.aes... | StarcoderdataPython |
3499462 | import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import roc_auc_score
from pyhawkes.models import DiscreteTimeNetworkHawkesModelSpikeAndSlab
# Create a simple random network with K nodes a sparsity level of p
# Each event induces impulse responses of length dt_max on connected nodes
K = 3
p = ... | StarcoderdataPython |
8107189 |
default_app_config = 'main.apps.MainConfig' | StarcoderdataPython |
3250433 | from collections import Counter
from operator import itemgetter
import os
class Beacon(object):
def __init__(self, x, y, z):
self.coords = ((1, x), (2, y), (3, z))
def __str__(self):
return str(self.coords)
def get_coords(self):
return self.coords
def apply_trns(self, coords... | StarcoderdataPython |
1668745 | import argparse
from typing import Optional
import annofabcli.stat_visualization.mask_visualization_dir
import annofabcli.stat_visualization.merge_visualization_dir
import annofabcli.stat_visualization.write_performance_rating_csv
from annofabcli.stat_visualization import (
summarise_whole_performance_csv,
wri... | StarcoderdataPython |
5119655 | import datetime
from cluster_vcf_records import vcf_file_read, vcf_record
import pyfastaq
from clockwork import utils
def _combine_minos_and_samtools_header(minos_header, samtools_header, ref_seqs):
header_start = [
"##fileformat=VCFv4.2",
"##source=clockwork merge samtools gvcf and minos vcf",
... | StarcoderdataPython |
1714762 | from rest_framework import viewsets
from django_filters import rest_framework as filters
from .models import Service
from .serializers import ServiceSerializer
from rest_framework.decorators import action
from rest_framework.response import Response
from django.shortcuts import get_object_or_404
from django.contrib.aut... | StarcoderdataPython |
11208789 | import os
import numpy as np
from itertools import product
from Bio import SwissProt
from unittest import TestCase
from ..database import create_session, delete_database, cleanup_database
from ..database.models import Interaction, Protein
from ..database.utilities import create_interaction
from ..database.exceptions i... | StarcoderdataPython |
3256036 | # Autogenerated file. ANY CHANGES WILL BE OVERWRITTEN
from to_python.dump.functions.account_functions import DUMP_PARTIAL as DP_F_ACCOUNT_FUNCTIONS
from to_python.dump.functions.acl_functions import DUMP_PARTIAL as DP_F_ACL_FUNCTIONS
from to_python.dump.functions.admin_functions import DUMP_PARTIAL as DP_F_ADMIN_FUNCTI... | StarcoderdataPython |
11277067 | <reponame>Pendragonek/bionic
"""Resources tests"""
| StarcoderdataPython |
5142235 | # jsb/plugs/common/twitter.py
#
#
""" a twitter plugin for the JSONBOT, currently post only .. uses tweepy oauth. """
## jsb imports
from jsb.utils.exception import handle_exception
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.utils.pdol import Pdol
from jsb.utils.textutils impor... | StarcoderdataPython |
3410194 | <gh_stars>1-10
# coding: utf-8
"""
Tradenity API
Tradenity eCommerce Rest API
Contact: <EMAIL>
"""
from __future__ import absolute_import
import re
import pprint
# python 2 and python 3 compatibility library
import six
from tradenity.api_client import ApiClient
class CashOnDeliveryPayment(object)... | StarcoderdataPython |
3398673 | import requests, json, re
__all__ = ["Couch", "Database"]
class Couch:
"""Handles the connection to CouchDB and any interaction with databases
"""
def __init__(self, user, password, host="localhost", port="5984"):
self.user = user
self.password = password
self.host = host
s... | StarcoderdataPython |
3469561 | <filename>src/dbb/compiler.py
import datetime
import glob
import os
import os.path
import re
import shutil
import subprocess
import tempfile
from os.path import dirname, join, realpath
from .util.config import config
from . import toc
from . import dependency
from .util import log
from . import pandoc
from . import pd... | StarcoderdataPython |
11384312 | <reponame>1NCE-GmbH/blueprint-pycom
# -*- coding: utf-8 -*-
class FileHelper:
@staticmethod
def write_file(content, path):
"""
Writes the content to a file
:param content: Content that needs to be written to the file
:param path: File path
"""
with open(pa... | StarcoderdataPython |
9679157 | # -*- coding: utf-8 -*-
import logging
import torch
import torch.cuda
from beaver.data import build_dataset
from beaver.infer import beam_search
from beaver.loss import WarmAdam, LabelSmoothingLoss
from beaver.model import NMTModel
from beaver.utils import Saver
from beaver.utils import calculate_bleu
from beaver.uti... | StarcoderdataPython |
3521378 | # Example usage:
# python3 zkchannel_pytezos_mgr.py --contract=zkchannel_contract.tz --cust=tz1iKxZpa5x1grZyN2Uw9gERXJJPMyG22Sqp.json --merch=tz1bXwRiFvijKnZYUj9J53oYE3fFkMTWXqNx.json --custclose=cust_close.json --merchclose=merch_close.json
import argparse
from pprint import pprint
from pytezos import pytezos
from p... | StarcoderdataPython |
9609172 | import discord, requests, asyncio, random, traceback
from discord.ext import commands
from pybooru import Danbooru
from NHentai import NHentai
from saucenao_api import SauceNao, VideoSauce, BookSauce
import tokens
class apis(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listene... | StarcoderdataPython |
11285077 | import logging
import ask_sdk_core.utils as ask_utils
import os
from ask_sdk_s3.adapter import S3Adapter
s3_adapter = S3Adapter(bucket_name=os.environ["S3_PERSISTENCE_BUCKET"])
from ask_sdk_core.skill_builder import CustomSkillBuilder
from ask_sdk_core.dispatch_components import AbstractRequestHandler
from ask_sdk_cor... | StarcoderdataPython |
1673275 | <reponame>pranjal102/command_line_interp_PythonProject<gh_stars>0
LINE_SEPARATORS = "-----------------------------------------------------------------------------------------------------------------------------"
WELCOME_STRING = "Welcome to the Droid Command line Interface.\n Type 'guide' for help-manual.\n Use 'leave... | StarcoderdataPython |
3430658 | # Copyright 2016 The Closure Rules Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | StarcoderdataPython |
3279650 |
import luigi
import subprocess
from os.path import join, dirname, basename
from ..utils.cap_task import CapTask
from ..config import PipelineConfig
from ..utils.conda import CondaPackage
from ..preprocessing.clean_reads import CleanReads
class MicrobeCensus(CapTask):
module_description = """
This module pro... | StarcoderdataPython |
9664490 | <reponame>mohanliu/qmpy<filename>qmpy/web/views/api/optimade_api.py
from rest_framework import generics
import django_filters.rest_framework
from qmpy.web.serializers.optimade import OptimadeStructureSerializer
from qmpy.materials.formation_energy import FormationEnergy
from qmpy.materials.entry import Composition
from... | StarcoderdataPython |
1886206 | <reponame>bonastos/yadif
from __future__ import print_function
import os
import sys
import re
import datetime
import string
versionParser = re.compile( r'(\s*Version\slibraryVersion)\s*\(\s*(.*)\s*,\s*(.*)\s*,\s*(.*)\s*,\s*\"(.*)\"\s*\).*' )
includesParser = re.compile( r'\s*#include\s*"(.*)"' )
guardParser = re.co... | StarcoderdataPython |
71061 | <gh_stars>1-10
class AjaxableResponseMixin(object):
"""
Mixin to add AJAX support to a form.
Must be used with an object-based FormView (e.g. CreateView)
"""
def form_invalid(self, form):
response = super(AjaxableResponseMixin, self).form_invalid(form)
if self.request.is_ajax():
... | StarcoderdataPython |
1774628 | """
==================================
01. Anonymize Video and Ephys Data
==================================
In this example, we anonymize both a video and a fif file with eeg data.
.. currentmodule:: ephys_anonymizer
.. _BrainVision format: https://www.brainproducts.com/productdetails.php?id=21&tab=5
.. _CapTrak: h... | StarcoderdataPython |
177905 | <reponame>camcl/genotypooler<filename>graphtools/quantiles_plots_ pooled_not_decoded.py<gh_stars>0
import os, sys
import numpy as np
import pandas as pd
import seaborn as sns
import timeit
import multiprocessing as mp
import matplotlib.pyplot as plt
from typing import *
rootdir = os.path.dirname(os.path.dirname(os.ge... | StarcoderdataPython |
5039809 | <filename>test/test_socket_burst_dampener.py
import asyncio
import os
import sys
import unittest
try:
from socket_burst_dampener import Daemon, parse_args
except ImportError:
sys.path.append(
os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "src"
)
)
... | StarcoderdataPython |
12825883 | <reponame>LucasBorges-Santos/docker-odoo<filename>odoo/base-addons/stock_landed_costs/tests/test_stock_landed_costs_purchase.py
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import unittest
from odoo.addons.stock_landed_costs.tests.common import TestStockLandedCostsC... | StarcoderdataPython |
312950 | <filename>exercises/solution_01_10.py
import pandas as pd
# The database
hockey_players = pd.read_csv('data/canucks.csv', index_col=0)
# Slice the rows and columns and save the new dataframe as `star_players`
star_players = hockey_players.loc['<NAME>': '<NAME>', 'No.' : 'Country']
# Display it
star_players
| StarcoderdataPython |
6641184 | <reponame>IKATS/ikats_api
# -*- coding: utf-8 -*-
"""
Copyright 2019 CS Systèmes d'Information
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 ... | StarcoderdataPython |
6616119 | <filename>sources/classic/http_auth/interfaces.py
from abc import ABC, abstractmethod
from typing import Type
from .entities import Client
# yapf: disable
class AuthStrategy(ABC):
@abstractmethod
def get_client(self, request: 'falcon.Request', **static_client_params) -> Client: ...
class ClientFactory(ABC... | StarcoderdataPython |
10037 | import awkward as ak
from coffea.nanoevents.methods import vector
import pytest
ATOL = 1e-8
def record_arrays_equal(a, b):
return (ak.fields(a) == ak.fields(b)) and all(ak.all(a[f] == b[f]) for f in ak.fields(a))
def test_two_vector():
a = ak.zip(
{
"x": [[1, 2], [], [3], [4]],
... | StarcoderdataPython |
12849910 | # Generated by Django 3.2.7 on 2022-02-08 23:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('file_manager', '0058_auto_20220118_1418'),
]
operations = [
migrations.AddField(
model_name='rawfile',
name='column_... | StarcoderdataPython |
3420418 | <reponame>xiegudong45/typeidea<gh_stars>1000+
from django.contrib.gis.db.models.sql.conversion import (
AreaField, DistanceField, GeomField, GMLField,
)
__all__ = [
'AreaField', 'DistanceField', 'GeomField', 'GMLField'
]
| StarcoderdataPython |
11396739 | <filename>code/cs231n/classifier_trainer.py
import numpy as np
class ClassifierTrainer:
""" The trainer class performs SGD with momentum on a cost function """
def __init__(self):
self.step_cache = {} # for storing velocities in momentum update
def train( # noqa for complexity
self, ... | StarcoderdataPython |
3471422 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-26 22:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('client', '0009_auto_20171024_0044'),
]
operations = [
migrations.CreateMode... | StarcoderdataPython |
3538217 | <reponame>sem-onyalo/hackathon-ideas<filename>core/App.py
import json
class App:
_settingsFileName = 'app.settings.json'
def getSettings(self, name):
with open(self._settingsFileName, 'r') as fh:
settings = json.loads(fh.read())
if name in settings:
return setti... | StarcoderdataPython |
6561264 | <reponame>javor/taxamo-python
#!/usr/bin/env python
"""
Copyright 2014-2020 by Taxamo
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
... | StarcoderdataPython |
1892847 | <gh_stars>1-10
import sys
sys.path.append('/home/jwalker/dynamics/python/atmos-tools')
sys.path.append('/home/jwalker/dynamics/python/atmos-read')
import os
import numpy as np
import matplotlib.pyplot as plt
import merra
import atmos as atm
from merra import load_daily_season
datadir = '/home/jwalker/eady/datastore/m... | StarcoderdataPython |
376502 | <gh_stars>0
import os, re, inspect, socket
# from service.remote import WinRemote, NixRemote
# from auth.auth import ZbxAgent as Auth
from pexpect.pxssh import ExceptionPxssh
from exceptions import ExceptionAgent
from appagent.config.config import Common as cfg
#*************************************************... | StarcoderdataPython |
1650429 | __author__ = '<NAME>'
| StarcoderdataPython |
1676417 | from rest_framework.exceptions import APIException
from rest_framework.status import HTTP_423_LOCKED
from waldur_ansible.jupyter_hub_management.backend import locking_service
from waldur_ansible.python_management import models as python_management_models, utils as python_management_utils
from waldur_core.core import m... | StarcoderdataPython |
4823357 | from django.db import models
# Create your models here.
class FitsFileUpload(models.Model):
fits_file = models.FileField(upload_to='uploads', null=False, blank=False, default='')
timestamp = models.DateField(auto_now_add=True, null=True, blank=True) | StarcoderdataPython |
4989354 | from typing import Dict, List, Union
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import datetime
from Bio.SeqFeature import FeatureLocation, SeqFeature
# Qualifier Dictionary
example_qualifiers_dict = {
"gene": "gene",
"latin": "latin",
"organism": "species",
"functional": "functional"... | StarcoderdataPython |
9728358 | <filename>module/constants.py<gh_stars>0
# Constants across package (Due to sharing b/w modules)
# configuration related constants
lag = "lag"
feature_col_names = "attribute_names"
data_file_path = "data_file_path"
output_file_path = "output_file_path"
patt_len = "pattern_length"
supp_threshold = "support_threshold"
c... | StarcoderdataPython |
8064788 | import os
import time
def main(request, response):
"""Serves the contents in blue.png but with a Cache-Control header.
Emits a Cache-Control header with max-age set to 1h to allow the browser
cache the image. Used for testing behaviors involving caching logics.
"""
image_path = os.path.join(os.path.dirname(... | StarcoderdataPython |
3337777 | # flake8: noqa
def my_sum(first, second):
return first + second
def my_mult(first, second):
return first * second
def my_div(first, second):
return first / second
def test_sum():
assert my_sum(1, 2) == 3
assert round(my_sum(2.1, 4.2), 2) == 6.3
def test_mult():
assert my_mult(2, 2) == 4... | StarcoderdataPython |
5040515 | # Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'enable_winrt_81_revision_dll',
'type': 'shared_library',
'msvs_enable_winrt': 1,
'msvs_application_ty... | StarcoderdataPython |
79750 | import typing
import error
REQUEST_TABLE = {
'get': [[str]],
'as': [str],
'by': ([str], 'optional'),
'if': ([list], 'optional'),
'except': ([list], 'optional'),
'join': ([
{
'name': str,
'of': [str],
}
], 'optional'),
'macro': ... | StarcoderdataPython |
9726027 | #! /usr/bin/env python
"""Experimental module for Python 2 compatibility.
The purpose of this module is to enable Pyslet to be gradually converted
to Python3 while retaining support for Python 2.7 and 2.6. This fills a
similar role to the six module but the idea is to minimise the number of
required fixes by making t... | StarcoderdataPython |
8121375 | <reponame>KarrLab/bpforms
""" Tests of bpforms command line interface (bpforms.__main__)
:Author: <NAME> <<EMAIL>>
:Date: 2019-01-31
:Copyright: 2019, Karr Lab
:License: MIT
"""
from bpforms import __main__
import bpforms
import bpforms.alphabet.dna
import bpforms.alphabet.rna
import bpforms.alphabet.protein
import c... | StarcoderdataPython |
1808210 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
from typing import Any, Callable, Iterator, List, Optional, Sequence, Tuple, Union
from torch.utils... | StarcoderdataPython |
83691 | <reponame>icmpnorequest/DASFAA2021_DMVMT
# coding=utf-8
"""
@author: <NAME>
@date: 02/10/2020
"""
from transformers import BertTokenizer
import os
import pandas as pd
import numpy as np
import string
import argparse
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
from gensim import corpora... | StarcoderdataPython |
3477226 | #!/usr/bin/env python
# coding: utf-8
# # Breve introdução à utilização do Z3 em Python
# Um tutorial do Z3Py, a biblioteca Python de interface para o popular solver Z3 da Microsoft, pode ser encontrado em https://ericpony.github.io/z3py-tutorial/guide-examples.htm.
#
# Começamos por importar o módulo do Z3.
# In[ ]... | StarcoderdataPython |
6684309 | <gh_stars>1-10
from os.path import exists
def notify(title, subtitle, message):
from os import system
t = '-title {!r}'.format(title)
s = '-subtitle {!r}'.format(subtitle)
m = '-message {!r}'.format(message)
a = '-sender {!r}'.format("com.typemytype.robofont")
system('terminal-notifier {}'.form... | StarcoderdataPython |
5112904 | #!/usr/bin/env python
"""Various algorithms concerning primes."""
def is_prime(n):
"""Detect if a number is a prime or not (robust method).
:param num: A positive number
:type num: int
:returns: boolean
:rtype: bool
"""
if n <= 1:
return False
elif n == 2:
return Tru... | StarcoderdataPython |
8050483 | import pytest
from bank_bot.banking_system.client_factory import BankingClientFactory
from bank_bot.banking_system.banking_system_class_based import BankingClient
from bank_bot.banking_system.user_class import User
from bank_bot.banking_system import UserError, MessageError
from bank_bot.settings import NO_MESSAGES_FOU... | StarcoderdataPython |
6445747 | #!/usr/bin/env python
import argparse
import datetime
import os
from celery import Celery
from random import SystemRandom
from apiclient.http import HttpMockSequence
from mail_service.gmail_service.worker import check_account_v1
celery = Celery('EOD_TASKS')
celery.config_from_object('celeryconfig')
cryptogen = System... | StarcoderdataPython |
5176448 | <filename>src/training/models/textual_paper.py<gh_stars>1-10
from src.features.sequences.transformer import SequenceMetadata
import tensorflow as tf
from typing import List
import logging
import fasttext.util
from tqdm import tqdm
from src.features.knowledge import DescriptionKnowledge
from .base import BaseEmbedding, ... | StarcoderdataPython |
12841539 | import main
def test_convert_case_error():
assert main.convert("error case", "error case") == main.validation_error
def test_convert_camel_case():
assert main.convert("camelCase", "my own camel case") == "myOwnCamelCase"
assert main.convert("camelCase", "camel") == "camel"
assert main.convert("camel... | StarcoderdataPython |
3420173 | """
Decorators for the DB API 2.0 implementation.
"""
# pylint: disable=invalid-name, unused-import
from functools import wraps
from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union, cast
from datajunction.sql.dbapi.exceptions import ProgrammingError
if TYPE_CHECKING:
from datajunction.sql.dbapi.connec... | StarcoderdataPython |
11373492 | <filename>generated-libraries/python/netapp/fpolicy/fpolicy_scope_config.py
from netapp.netapp_object import NetAppObject
class FpolicyScopeConfig(NetAppObject):
"""
Vserver FPolicy Scope configuration and management on name
When returned as part of the output, all elements of this typedef
are reported... | StarcoderdataPython |
264599 | <reponame>zhiyue/cola<gh_stars>1000+
'''
Copyright (c) 2013 <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.apache.org/licenses/LICENSE-2.0
Unless required by appli... | StarcoderdataPython |
1762171 | <reponame>azadoks/aiida-core<gh_stars>100-1000
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... | StarcoderdataPython |
368918 | <reponame>devs-7/bible-projector-python<gh_stars>0
import random
import socket
import string
def generate_random_string_with_letters_and_digits(length: int) -> str:
return ''.join(random.choices(
string.ascii_letters + string.digits,
k=length
))
def get_host() -> str:
s = socket.socket(s... | StarcoderdataPython |
192721 | <reponame>dfederschmidt/ta-splunk-add-on-for-datadog-api<filename>bin/input_module_datadog_event_stream.py
# ########################################################################
# Copyright 2020 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file exc... | StarcoderdataPython |
1939633 | import unittest
from unittest import skip
from asgard.models.account import AccountDB as Account
from hollowman.filters.autodisablehttp import AutoDisableHTTPFilter
from hollowman.marathonapp import AsgardApp
from hollowman.models import User
from tests.utils import with_json_fixture
APP_WITH_HTTP_LABELS = "single_fu... | StarcoderdataPython |
8024809 | <filename>pymultisig/sign_multisig_spend.py
#!/usr/bin/env python
import sys
import argparse
import json
try:
from pymultisig import trezor_utils
from pymultisig import btc_utils
from pymultisig.generate_multisig_address import generate_multisig_address
except ModuleNotFoundError:
import trezor_utils
... | StarcoderdataPython |
382869 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Time : 11:41
# Email : <EMAIL>
# File : readMe.py
# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ #
# +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ #
# +--+--+--+--+--+--+--+--+--+--+... | StarcoderdataPython |
9644039 | <reponame>yjbanov/chromium_build
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from master import gitiles_poller
def Update(config, c):
webrtc_repo_url = config.Master.git_server_url + '/external... | StarcoderdataPython |
9690183 | <gh_stars>0
# This code is generated automatically by ClointFusion BOT Builder Tool.
import ClointFusion as cf
import time
cf.window_show_desktop()
cf.mouse_click(int(cf.pg.size()[0]/2),int(cf.pg.size()[1]/2))
try:
cf.mouse_click(*cf.mouse_search_snip_return_coordinates_x_y(r'C:\Users\mrmay\AppData\Local\Temp... | StarcoderdataPython |
8160052 | def main():
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
n = int(readline())
a = list(map(int, readline().split()))
a.sort(reverse=True)
idx = 1
ans = a[0]
for aa in a[1:]:
if idx + 2 >= n:
if idx + 1 < n:
ans += ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.