id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
1765954 | <reponame>ErickGallani/lunchticketcontrol
""" This module is for aggregate all configs strategies """
class Config(object):
""" Default config """
# Application name
APP_NAME = 'Lunch ticket'
# Application host
HOST = '127.0.0.1'
# Application port
PORT = 5050
# Application protocol
... | StarcoderdataPython |
3223425 |
import torch
import torch.nn.functional as F
from scipy.stats import wasserstein_distance
def MMD(samples_A, samples_B, sigma=1, biased=True):
alpha = 1 / (2 * sigma**2)
B = samples_A.size(0)
AA, BB = torch.mm(samples_A, samples_A.t()), torch.mm(samples_B, samples_B.t())
AB = torch.mm(samples_A, samp... | StarcoderdataPython |
3398855 | """
Copyright 2018 InfAI (CC SES)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in... | StarcoderdataPython |
1710988 | <filename>src/refline/srccheck/testing/ignored_bad.py<gh_stars>0
# this is a file full with problems
# but ignored with:
# checker_ignore_this_file
import os
def doit():
foo = bar
def with_tab():
print "there's a tab"
| StarcoderdataPython |
3313958 | <filename>scripts/tms_writer.py<gh_stars>10-100
# -*- coding: utf-8 -*-
import os
import sys
import getopt
from textwrap import dedent
from forge.lib.tiler import TilerManager
from forge.lib.helpers import error
def usage():
print(dedent('''\
Usage: venv/bin/python scripts/tms_writer.py
... | StarcoderdataPython |
1736141 | <reponame>technige/httpstream
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2015, <NAME>
#
# 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/licens... | StarcoderdataPython |
3381532 | import warnings
import matplotlib.pyplot as plt
import cv2
import mmcv
import random
from PIL import Image
import numpy as np
import torch
from mmcv.runner import load_checkpoint
from mmcv.parallel import collate, scatter
from openselfsup.models import build_model
from openselfsup.utils import build_from_cfg
from o... | StarcoderdataPython |
3228627 | <reponame>SPIN-UMass/SWEET<filename>mailmynet/Maildir/proxy_postfix/Twisted-11.0.0/build/lib.linux-x86_64-2.6/twisted/internet/reactor.py
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
The reactor is the Twisted event loop within Twisted, the loop which drives
applications using Twisted. T... | StarcoderdataPython |
3365054 | from custom_components.sbahn_munich.const import DEFAULT_LIMIT
from datetime import date, datetime
import json
from custom_components.sbahn_munich.sensor import SBahnStation
from custom_components.sbahn_munich.api import Timetable, Station
def test_device_state_attributes():
station = Station("testStation", [], ... | StarcoderdataPython |
3259825 | # import pyedflib
import numpy as np
from scipy import signal as sg
import argparse
import sys
import json
# import matplotlib.pyplotmatplot as plt
from pprint import pprint
import pandas as pd
class Notch():
Q = 0
f0 = 0
def __init__(self,f0=60,Q=50):
self.f0=f0
self.Q=Q
def argp... | StarcoderdataPython |
1608814 | <reponame>geancarlo/fastapi-autowire
from .domain import Bar, Foo
from .services import FooPrinter
def controller1(foo: Foo):
return foo.value1, foo.value2
def controller2(foo_printer: FooPrinter):
return foo_printer.print()
def controller3(bar: Bar):
return bar.__dict__
| StarcoderdataPython |
21792 | import codecs
import os
# Function to save a string into a file
def save_string_in_file(string_text, file_name):
with codecs.open(file_name, "w", "utf-8") as f:
f.write(string_text)
f.close()
# Function to read all files in a dir with a specific extension
def read_files_in_dir_ext(dir_route, exten... | StarcoderdataPython |
4812915 | import pytest
# set choices for --test-type
test_choices = ['all', 'default', 'matlab']
def pytest_addoption(parser):
"""
Command line input function which requires 'all', 'default' or 'matlab'
as an input
"""
parser.addoption(
"--test-type", action="store", default="all", type=str,
... | StarcoderdataPython |
51377 | <gh_stars>1-10
import sys,os
import py2 as csv
import converter,iohelper
from itertools import groupby
def do_split(csvfilepath,colidx):
result = {}
header=[]
iohelper.delete_file_folder('splitted/')
iohelper.dir_create('splitted/')
with open(csvfilepath, 'rb') as csvfile:
csvreader = csv.r... | StarcoderdataPython |
138281 |
import sys, re, os
from pathlib import Path
_, output_dir, *output_base_names = sys.argv
chrom_regex = re.compile(r'(chr[a-zA-Z0-9]+)')
chromosomes = [chrom_regex.search(x).group(1) for x in output_base_names]
output_dir = Path(output_dir)
if not output_dir.exists():
os.makedirs(str(output_dir))
output_files = di... | StarcoderdataPython |
1727888 | <gh_stars>1-10
S = input()
print("No" if "L" in S[::2] or "R" in S[1::2] else "Yes") | StarcoderdataPython |
19297 | import unittest
import time
import copy
from unittest.mock import patch, MagicMock, call
from ignition.service.messaging import PostalService, KafkaDeliveryService, KafkaInboxService, Envelope, Message, MessagingProperties
from kafka import KafkaProducer
class TestPostalService(unittest.TestCase):
def setUp(self... | StarcoderdataPython |
3374965 | from django.test import TestCase
from mirrors.tests import create_mirror_url
class MirrorUrlTest(TestCase):
def setUp(self):
self.mirror_url = create_mirror_url()
def testAddressFamilies(self):
self.assertIsNotNone(self.mirror_url.address_families())
def testHostname(self):
... | StarcoderdataPython |
3383179 | from .event import Event # noqa
from .producer import Producer # noqa
from .consumer import Consumer # noqa
from .decorators import event_subscriber, dispatch_event # noqa
from .dummy import * # noqa
| StarcoderdataPython |
86727 | from game_stats import GameStats
from word_board import WordBoard
from view_cli import ViewCLI
# from view_html import ViewHTML
FILENAME = ''
VIEW = ''
WB = ''
GS = ''
def setup(fn='wgg/static/wordlists/popular9.txt'):
global FILENAME, VIEW, WB, GS
FILENAME = fn
VIEW = ViewCLI()
WB = WordBoard(FILENA... | StarcoderdataPython |
1669850 | <reponame>wborbajr/eXchangeAPI-PY<filename>exchangeapi/routers/routers.py
from fastapi import APIRouter
from exchangeapi.routers.v1.items import router as items_v1_router
from exchangeapi.routers.v2.items import router as items_v2_router
router = APIRouter()
router.include_router(items_v1_router)
router.include_route... | StarcoderdataPython |
1609126 | from loguru import logger
from fcutils.maths.signals import get_onset_offset
from data.dbase.io import load_bin
def get_triggers(session: dict, sampling_rate: int = 30000) -> dict:
"""
Get the time at which frame triggers occur in bonsai
"""
name = session["name"]
logger.debug(f'Getting bons... | StarcoderdataPython |
117965 | tweet_at = '@Attribution'
tweet_url = 'https://example.com/additional-url'
tweet_hashtag = '#MyHashtag'
tweet_data = [
{ 'image': 'https://example.com/image.jpg',
'id': 'image_id',
'title': 'Example title',
'desc': 'Example description with lots of text that probably goes well over the 280 character lim... | StarcoderdataPython |
1624084 | <reponame>mrroach/CentralServer
from csrv.model.cards import card_info
from csrv.model.cards import ice
from csrv.model.actions import subroutines
from csrv.model.actions.subroutines import trash_a_program
class Card01064(ice.Ice):
NAME = u'Card01064'
SET = card_info.CORE
NUMBER = 64
SIDE = card_info.CORP
... | StarcoderdataPython |
1600258 | from sadie.airr import AirrTable
import pandas as pd
# write airr table to a csv
airr_table_1 = AirrTable(pd.read_csv("PG9 AIRR.csv"))
# write to a json file
airr_table_2 = AirrTable(pd.read_json("PG9 AIRR.json", orient="records"))
# write to an excel file
airr_table_3 = AirrTable(pd.read_excel("PG9 AIRR.xlsx"))
# ... | StarcoderdataPython |
151327 | <filename>gui/api_plugins/aff4_test.py<gh_stars>1-10
#!/usr/bin/env python
"""This modules contains tests for AFF4 API renderers."""
from grr.gui.api_plugins import aff4 as aff4_plugin
from grr.lib import aff4
from grr.lib import flags
from grr.lib import test_lib
from grr.lib import utils
class ApiAff4RendererTe... | StarcoderdataPython |
4810912 | <reponame>tfrdidi/mod_security_add_ids_to_rules<gh_stars>0
import sys
import os.path
# Mod_security decided to make IDs on rules mandatory with a certain update.
# This script is ment to solve the problem by assigning all rules of a file
# an ID starting with a certain value that is specified by the user.
#
# Call thi... | StarcoderdataPython |
159336 | <gh_stars>10-100
from pygofile import Gofile
gofile = Gofile(token='') | StarcoderdataPython |
3305024 | #!/usr/bin/env python3
from math import *
import random
name = "TerrainB"
block_size = 0.4
block_size_z1 = 0.14
block_size_z2 = 0.247
block_color_r = 0.56
block_color_g = 0.56
block_color_b = 0.56
num_blocks_x = 12
num_blocks_y = 12
iniPos_x = 0.2
iniPos_y = 0.2
block_size2 = block_size/2.0
header = '''\
format: Ch... | StarcoderdataPython |
3325545 | <filename>python/summarise_testing.py
#!/usr/bin/env python3
import pandas as pd
import cfg
def targets_info(fp, target):
data = pd.read_csv(fp)
print('targets information from: {}'.format(fp))
print(target)
print('val count')
print(data[target].value_counts(ascending=False))
z_count = 0
... | StarcoderdataPython |
3398335 | from typing import List
from pydantic import Field
from .schema import Schema, chainable
from .verdict import Verdict
class Assertion(Schema):
__root__: List[Verdict] = Field(min_items=1, max_items=256, default=[])
@property
def artifacts(self):
return self.__root__
@chainable
def add_... | StarcoderdataPython |
49173 | <reponame>frost917/customer-manager
import json
from datetime import datetime
# Dict in List
def authFailedJson():
payload = dict()
convDict = dict()
convList = list()
convDict['error'] = "AuthFailed"
convDict['msg'] = "Authentication Failed!"
convList.append(convDict)
payload['failed'] =... | StarcoderdataPython |
1639911 | <reponame>gsw945/web-static-server
# -*- coding: utf-8 -*-
import tornado.wsgi
import tornado.httpserver
import tornado.ioloop
from server import app, PORT
if __name__ == '__main__':
container = tornado.wsgi.WSGIContainer(app)
http_server = tornado.httpserver.HTTPServer(container)
print('listen at port [... | StarcoderdataPython |
3329118 | # (C) 2015 - 2019 by <NAME>
# License: MIT
import os
import sys
from collections import defaultdict
from time import time, sleep
from datastalker import pythonwifi
import logging
log = logging.getLogger('root.hopper')
class Hopper(object):
"""
Handle all logic regarding channel hopping.
"""
def __in... | StarcoderdataPython |
3295 | <gh_stars>1-10
def pick_food(name):
if name == "chima":
return "chicken"
else:
return "dry food"
| StarcoderdataPython |
3358752 | """
Set of specific utilities for combining PySeg with Subtomogram Averaging tools (PyTom)
# Author: <NAME> (Max Planck Institute for Biochemistry)
# Date: 1.06.16
"""
__author__ = '<NAME>'
from .plist import TomoPeaks, SetTomoPeaks, Score, SingleTiltWedge, Particle, ParticleList, PK_COORDS
from .star import Star
fr... | StarcoderdataPython |
144858 | <filename>mitmproxy/proxy2/layers/modes.py
from abc import ABCMeta
from mitmproxy import platform
from mitmproxy.net import server_spec
from mitmproxy.proxy2 import commands, events, layer
from mitmproxy.proxy2.layers import tls
from mitmproxy.proxy2.utils import expect
class HttpProxy(layer.Layer):
@expect(even... | StarcoderdataPython |
41481 | """
Add `Django Filebrowser`_ to your project so you can use a centralized interface to manage the uploaded files to be used with other components (`cms`_, `zinnia`_, etc.).
The version used is a special version called *no grappelli* that can be used outside of the *django-grapelli* environment.
Filebrowser manage fi... | StarcoderdataPython |
1780914 | import os, sys, math
import torch
import matplotlib.pyplot as plt
def convert_grid2prob(grid, threshold=0.1, temperature=1):
threshold = torch.max(grid) - threshold*(torch.max(grid)-torch.min(grid))
grid[grid>threshold] = torch.tensor(float('inf'))
prob = torch.exp(-temperature*grid) / torch.sum(torch.exp... | StarcoderdataPython |
148027 | from __future__ import print_function, absolute_import
import sys
import os
sys.path.append(os.path.dirname(__file__))
__name__='conda_pack'
from .core import CondaEnv, File, CondaPackException, pack
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
from .cli import main
main(... | StarcoderdataPython |
4806325 | <filename>src/io_scene_bl4/pbdf.py<gh_stars>0
"""
Provides methods to work with the PBDF (Pod Binary Data File) encryption.
"""
from .binary import *
def retrieve_key(file, file_size):
"""Retrieves the XOR encryption key from the given file.
Args:
file: The encrypted input file.
file_size (int... | StarcoderdataPython |
3339278 | from django.shortcuts import render
def showLogin(request, **kargs):
return render(request, 'Scouting2016/login.html', context=kargs)
| StarcoderdataPython |
1657820 | #
# Пятнадцатый простой парсер для тестирования скорости работы.
#
# Автор: <NAME>
# Лицензия: MIT License
#
from bs4 import BeautifulSoup
from .parsers_base import get_htmls, get_html
URL = 'https://www.google.com/search?newwindow=1&hl=ru&sxsrf=ACYBGNQVOJ5xq1L-uxtvBuQXhZ7X-nxa0g%3A1581684802586&ei=Qp' \
... | StarcoderdataPython |
1686141 | <filename>laaso/_subscription_ids.py
#
# laaso/_subscription_ids.py
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
'''
Implement an object that can pull subscription_ids from the config
as logical names and return them as str-as-uuid.
This is done in a separate file to... | StarcoderdataPython |
3370569 | import logging
import uuid
from dataclasses import dataclass
from datetime import datetime
from sqlalchemy import Column, String, DateTime
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
@dataclass
class JobPosting(Base):
""" Data model of Job Postings """
id: str
exter... | StarcoderdataPython |
107138 | """This module provides classes for performing syntactic aggregation.
For example, 'Roman is programming.' and 'Roman is singing' can be
put together to create 'Roman is programming and singing.'
"""
import logging
from copy import deepcopy
from nlglib.features import NUMBER, category
from nlglib.macroplanning imp... | StarcoderdataPython |
3317352 | import unittest
from textblob import TextBlob
def translate(text, from_l, to_l):
en_blob = TextBlob(text)
return en_blob.translate(from_lang=from_l, to=to_l)
translate(text='muy bien', from_l='es', to_l='en')
print(translate('Hello', 'en', 'es'))
class TestMethods(unittest.TestCase):
def test_get_le... | StarcoderdataPython |
1771879 | from .bot import Bot
from .user import User
from vkbottle.framework.framework.branch import (
Branch,
ExitBranch,
AbstractBranch,
ClsBranch,
CoroutineBranch,
)
from vkbottle.framework.framework.handler import Handler, Middleware
from .framework import rule, swear
| StarcoderdataPython |
1669874 | <reponame>vishalbelsare/diffusion-maps<filename>diffusion_maps/__init__.py
"""Diffusion maps module.
"""
from .diffusion_maps import *
from .geometric_harmonics import *
from .plot import *
from .version import *
| StarcoderdataPython |
3396450 | <reponame>siddharth-143/Python
"""
Cartooning an Image
"""
# importing libraries
import cv2
import numpy as np
# reading image
img = cv2.imread("../images/1.jpeg")
# Edges
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.medianBlur(gray, 5)
edges = cv2.adaptiveThreshold(gray, 255, cv2.ADAPTIVE_THRESH_ME... | StarcoderdataPython |
1644607 | # coding: utf-8
from pyccel.stdlib.parallel.mpi import mpi_init
from pyccel.stdlib.parallel.mpi import mpi_finalize
from pyccel.stdlib.parallel.mpi import mpi_comm_size
from pyccel.stdlib.parallel.mpi import mpi_comm_rank
from pyccel.stdlib.parallel.mpi import mpi_comm_world
# we need to declare these variables someh... | StarcoderdataPython |
3222191 | <reponame>JensGeorg/CopraRNA
#!/usr/bin/env python
import sys
IntaRNA_result = sys.argv[1]
enrich_count = int(sys.argv[2])
#print IntaRNA_result
with open(IntaRNA_result) as file:
IntaRNA_lines = file.readlines()
#print IntaRNA_lines[1]
backgroundList = []
# go through IntaRNA output line by line and extract En... | StarcoderdataPython |
1721116 | import os
import sys
import getopt
import numpy as np
import pandas as pd
import tensorflow as tf
from PIL import Image, ImageOps
def load_data(path):
X = np.array([]).reshape((0, 28, 28))
y = np.array([])
for root, dirs, files in os.walk(path):
for file in files:
if ".png" in fil... | StarcoderdataPython |
4822560 | <reponame>nataliemcmullen/WikiMiney
urls = [
"pagecounts-20121101-000000.gz",
"pagecounts-20121101-010000.gz",
"pagecounts-20121101-020000.gz",
"pagecounts-20121101-030000.gz",
"pagecounts-20121101-040000.gz",
"pagecounts-20121101-050000.gz",
"pagecounts-20121101-060000.gz",
"pagecounts-20121101-070000.gz",
"pagecounts... | StarcoderdataPython |
1760805 | <reponame>jonathanslenders/edgedb
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a c... | StarcoderdataPython |
131282 | <reponame>cfbarbero/find-cwlogs-subscriptions
import json
import argparse
parser = argparse.ArgumentParser(description='Parse the subscriptions')
parser.add_argument('filename', type=str, help='an integer for the accumulator')
args = parser.parse_args()
with open(args.filename, 'r') as f:
data = json.load(f)
s... | StarcoderdataPython |
4824776 | <reponame>Plavit/Get-Real
import pytest
import dash_html_components as html
import pandas as pd
from generators import generate_table, generate_europe_map, generate_world_map
from app import DATA_UN, DATA_EU
df = pd.read_csv('data/{}'.format(DATA_UN))
dfeu = pd.read_csv('data/{}'.format(DATA_EU))
filtered_df = pd.Da... | StarcoderdataPython |
3286494 | from abc import ABCMeta, abstractmethod
class Plugin(object):
__metaclass__ = ABCMeta
def __init__(self, options):
super(Plugin, self).__init__()
self.options = options
@abstractmethod
def run(self):
pass
| StarcoderdataPython |
157925 | <reponame>Clonexy700/edu54book
from tkinter import *
root = Tk()
c = Canvas(root, width=500, height=500, bg='white')
c.pack()
c.create_oval(225, 235, 275, 285, width=2)
c.create_oval(200, 210, 300, 310, width=2)
c.create_oval(225, 80, 275, 210, width=2)
c.create_oval(225, 310, 275, 450, width=2)
c.create_oval(60, 240... | StarcoderdataPython |
164798 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | StarcoderdataPython |
3361953 | <reponame>GerbenRienk/casi<filename>src/extract/list_one_study.py
'''
The purpose of this module is to try to send a request to the castor-api
to obtain a list of studies.
Created on 6-11-2020
@author: <NAME>
Copyright 2020 TrialDataSolutions
'''
from utils.dictfile import DictFile
from utils.castor_api imp... | StarcoderdataPython |
1723712 | <gh_stars>10-100
import os
import pandas as pd
import numpy as np
from tqdm import tqdm
import math
from time import time
np.set_printoptions(suppress=True)
def remove_forts():
"""this part is to remove the unneccessary files at the end of the simulation. Our purpose is to combine this part with the start of... | StarcoderdataPython |
147775 | <reponame>pletzer/nemoflux<filename>nemoflux/timeobj.py<gh_stars>0
import xarray
from datetime import datetime
class TimeObj(object):
def __init__(self, nc):
self.timeVarName = ''
self.timeVar = []
for vName, var in nc.items():
if getattr(var, 'standard_name', '') == 'time' or ... | StarcoderdataPython |
42464 | # -*- coding: utf-8 -*-
import wx
from grail import Grail
from pages import LoginPage, MainFrame
from protocol import GrailProtocol
class MainFrameLogic(MainFrame):
def __init__(self, login, password):
super().__init__(None)
# self.m_notebook1.SetBackgroundColour(wx.NullColour)
self.g... | StarcoderdataPython |
18170 | from epidemioptim.environments.cost_functions.costs.death_toll_cost import DeathToll
from epidemioptim.environments.cost_functions.costs.gdp_recess_cost import GdpRecess
| StarcoderdataPython |
1626681 | <gh_stars>0
from rubygems_utils import RubyGemsTestUtils
class RubyGemsTestrubygems_faraday_net_http_persistent(RubyGemsTestUtils):
def test_gem_list_rubygems_faraday_net_http_persistent(self):
self.gem_is_installed("faraday-net_http_persistent")
| StarcoderdataPython |
1793789 | <filename>model/QAsparql/lcquad_dataset.py
import json
import requests, json, re, operator
import sys
from parser.lc_quad import LC_Qaud
def prepare_dataset(ds):
ds.load()
ds.parse()
return ds
def ask_query(uri):
if uri == "<https://www.w3.org/1999/02/22-rdf-syntax-ns#type>":
return 200, jso... | StarcoderdataPython |
158130 | import json
import os
from dotenv import load_dotenv
import pytest
from ssaw import Client
@pytest.fixture(scope="session", autouse=True)
def load_env_vars(request):
curr_path = os.path.dirname(os.path.realpath(__file__))
env_path = os.path.join(curr_path, "tests/env_vars.sh")
load_dotenv(dotenv_path=e... | StarcoderdataPython |
1655496 | <gh_stars>1-10
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Genera... | StarcoderdataPython |
3298121 | from PyQt5.QtCore import Qt
from PyQt5.QtSql import QSqlTableModel
class libraryModel:
def __init__(self):
self.model = self.createTable()
@staticmethod
def createTable():
tableModel = QSqlTableModel()
tableModel.setTable("library")
tableModel.setEditStrategy(QSqlTableModel.OnFieldChange)
t... | StarcoderdataPython |
3377879 | import socket
import os
import asyncio
from asyncio import run_coroutine_threadsafe
from rocketmq.client import PushConsumer, ConsumeStatus
from typing import Callable, Awaitable, Any, List, Dict
"""
在消息队列中,GroupId目的维持在并发条件下消费位点(offset)的一致性。
管理每个消费队列的不同消费组的消费进度是一个非常复杂的事情。消息会被多个消费者消费,
不同的是每个消费者只负责消费其中部分消费队列,添加或删除消费者,都... | StarcoderdataPython |
1695944 | from freezegun import freeze_time
from openinghours.tests.tests import OpeningHoursTestCase
class FormsTestCase(OpeningHoursTestCase):
def setUp(self):
super(FormsTestCase, self).setUp()
def tearDown(self):
super(FormsTestCase, self).tearDown()
def test_hours_are_published(self):
... | StarcoderdataPython |
1771524 | from __future__ import absolute_import
import numpy as np
from pyti import catch_errors
from six.moves import range
from numba import jit
@jit
def accumulation_distribution(close_data, high_data, low_data, volume):
"""
Accumulation/Distribution.
Formula:
A/D = (Ct - Lt) - (Ht - Ct) / (Ht - Lt) * Vt + ... | StarcoderdataPython |
27565 | """Module defining DiagGGNPermute."""
from backpack.core.derivatives.permute import PermuteDerivatives
from backpack.extensions.secondorder.diag_ggn.diag_ggn_base import DiagGGNBaseModule
class DiagGGNPermute(DiagGGNBaseModule):
"""DiagGGN extension of Permute."""
def __init__(self):
"""Initialize.""... | StarcoderdataPython |
45221 | <reponame>vaibhav162/Banking-Marketing-Project<gh_stars>0
#!/usr/bin/env python
# coding: utf-8
# # Importing Libraries and Dataset
# In[1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# In[2]:
bank= pd.read_csv(r"C:\Users\shruti\Desktop\Decodr\Project\Decodr Pro... | StarcoderdataPython |
3355148 | from niaaml.classifiers.classifier import Classifier
from niaaml.classifiers.random_forest import RandomForest
from niaaml.classifiers.multi_layer_perceptron import MultiLayerPerceptron
from niaaml.classifiers.linear_svc import LinearSVC
from niaaml.classifiers.ada_boost import AdaBoost
from niaaml.classifiers.extremel... | StarcoderdataPython |
29098 | <reponame>AugustinMascarelli/survol
"""
Computer system.
Scripts related to the class CIM_ComputerSystem.
"""
import sys
import socket
import lib_util
# This must be defined here, because dockit cannot load modules from here,
# and this ontology would not be defined.
def EntityOntology():
return ( ["Name"], )
i... | StarcoderdataPython |
1651786 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from click.testing import CliRunner
from knipse import cli
class TestKnipse(unittest.TestCase):
def test_command_line_interface(self) -> None:
'''Test command line interface.'''
runner = CliRunner()
result = runner.invoke(cli... | StarcoderdataPython |
79621 | <filename>test_integration/geopm_test_integration.py<gh_stars>0
#!/usr/bin/env python
#
# Copyright (c) 2015, 2016, 2017, 2018, 2019, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Re... | StarcoderdataPython |
3377760 | class Solution:
def XXX(self, x: int) -> int:
INT_MIN, INT_MAX = -2**31, 2**31 - 1
if str(x).startswith('-'):
y = -int(str(x)[1:][::-1])
else:
y = int(str(x)[::-1])
if (y < INT_MIN or y > INT_MAX):
return 0
return y
| StarcoderdataPython |
1704281 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-04-21 14:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('falmer_auth', '0003_auto_20170417_2124'),
]
operations = [
migrations.Alter... | StarcoderdataPython |
96057 | import datetime
import time
import tweepy
from plyer import notification
from tweepy import OAuthHandler
import settings
# 監視したいキーワードのリスト
words = ["GitHub", "AWS", "Slack", "Gmail", "障害"]
auth = OAuthHandler(settings.CONSUMER_KEY, settings.CONSUMER_SECRET)
auth.set_access_token(settings.ACCESS_TOKEN, settings.ACCES... | StarcoderdataPython |
4832108 | <reponame>tlambert03/image-demos
"""
Displays covid19 data from omero
"""
# import s3fs
# import zarr
#
# s3 = s3fs.S3FileSystem(anon=True, client_kwargs={'endpoint_url': 'https://s3.embassy.ebi.ac.uk/'})
# store = s3fs.S3Map(root='idr/zarr/v0.1/9822151.zarr', s3=s3, check=False)
# root = zarr.group(store=store)
# res... | StarcoderdataPython |
1797105 | def sequence():
first, diff, terms = int(input("Please enter the first term of a sequence: ")), int(input("Please enter the common difference: ")), int(input("Please enter the amount of terms you would like to display: "))
seq = 0
for i in range(0, terms):
seq += first
first += diff
... | StarcoderdataPython |
1738159 | <gh_stars>1-10
from collections import deque
import numpy as np
class HistoryBuffer(object):
def __init__(self, history_len):
self.shapes = None
self._buffers = None
self._history_len = history_len
def update(self, *args):
if self.shapes is None:
self.shapes = [np... | StarcoderdataPython |
1615940 | import argparse
import os
import shlex
import unittest
from gooey.gui import formatters
class TestFormatters(unittest.TestCase):
def test_counter_formatter(self):
"""
Should return the first option repeated N times
None if N is unspecified
Issue #316 - using lon... | StarcoderdataPython |
88860 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
import csv
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import roc_auc_score
from defs import Model
from lime import LIME
CLASSES = {
... | StarcoderdataPython |
1657308 | <gh_stars>1-10
from django.conf import settings
import xmltodict
from openpersonen.utils.helpers import convert_empty_instances
def convert_response_to_verblijfs_titel_historie_dict(response):
dict_object = xmltodict.parse(response.content)
antwoord_dict_object = dict_object["soapenv:Envelope"]["soapenv:Bo... | StarcoderdataPython |
109481 | from django.db import models
class Pessoa(models.Model):
nome = models.CharField(max_length=100)
servico = models.CharField(max_length=100)
telefone = models.CharField(max_length=30)
def __str__(self):
return self.nome
| StarcoderdataPython |
12359 | """
Routines for the analysis of proton radiographs. These routines can be broadly
classified as either creating synthetic radiographs from prescribed fields or
methods of 'inverting' experimentally created radiographs to reconstruct the
original fields (under some set of assumptions).
"""
__all__ = [
"SyntheticPr... | StarcoderdataPython |
3367259 | '''
middleware/getOS.py
- Gets running Operating System of user
'''
import platform
def handle():
OS = platform.system()
osList = []
tmpList = ['Windows', 'Darwin', 'Linux']
osList.append(OS)
for item in tmpList:
if item not in osList:
osList.append(item)
return ... | StarcoderdataPython |
1741368 | import functools
import sys
import traceback
from gi.repository import Gtk
from . import window_creator
def show_error(exctype, value, tb, gtk_main=False):
"""
Shows window showing detailed information about critical error.
:param exctype: converted to string and displayed (may contain additional text)... | StarcoderdataPython |
168946 | <reponame>pfe-everis/lcd
import torch
import torch.nn as nn
import torch.nn.functional as F
class PatchNetEncoder(nn.Module):
def __init__(self, embedding_size):
super(PatchNetEncoder, self).__init__()
self.embedding_size = embedding_size
self.conv1 = nn.Conv2d(3, 32, 4, 2, 1)
self... | StarcoderdataPython |
4837886 | <filename>gui/blockify/blockifydbus.py
"""spotifydbus
Usage:
spotifydbus (toggle | next | prev | stop | play) [-v...] [options]
spotifydbus get [title | artist | length | status | all] [-v...] [options]
spotifydbus (openuri <uri> | seek <secs> | setpos <pos>) [-v...] [options]
Options:
-l, --log=<path... | StarcoderdataPython |
1784679 | <filename>predictionerror.py
import abc
import core
import torch.nn as nn
######################################################################################################
######################################################################################################
######################################... | StarcoderdataPython |
107523 | # -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
mods = ('clu.all',
'clu.abstract',
'clu.constants.consts',
'clu.constants.polyfills',
'clu.config.base',
'clu.config.settings',
'clu.config.ns',
'clu.csv',
'clu.fs.appdirectories... | StarcoderdataPython |
3279762 | # Copyright (c) 2019 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
import sys
import ctypes # type: ignore
from PyQt5.QtGui import QOpenGLVersionProfile, QOpenGLContext, QOpenGLFramebufferObject, QOpenGLBuffer
from PyQt5.QtWidgets import QMessageBox
from typing import Any, TYPE_CHECKING, ca... | StarcoderdataPython |
1687336 | <filename>single_im_annotate.py
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import argparse, os
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as vis_util
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--file", typ... | StarcoderdataPython |
3308483 | <gh_stars>1-10
# 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"); y... | StarcoderdataPython |
3292590 | <filename>scripts/parseCommonLogs.py<gh_stars>1-10
from glob import glob
import os
import datetime as dt
from parseOutputFile import parse_output
import math
def progressBar(current, total, barLength = 20):
percent = float(current) * 100 / total
arrow = '-' * int(percent/100 * barLength - 1) + '>'
spaces ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.