id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6599227 | <reponame>tunedal/covidstats<gh_stars>0
from unittest import TestCase
from unittest.mock import patch
from readers.popreader import PopData, latest_population_count
class LatestPopulationCountTest(TestCase):
def test_appends_supplemental_data(self):
file_data = iter([])
supplement = PopData(coun... | StarcoderdataPython |
3414717 | <filename>examples/fedavg/generate_configs.py
import os
import numpy as np
from importlib import import_module
import examples.datahandlers as datahandlers
def get_fusion_config():
fusion = {
'name': 'FedAvgFusionHandler',
'path': 'ibmfl.aggregator.fusion.fedavg_fusion_handler'
}
return f... | StarcoderdataPython |
3424374 | <filename>dim-testsuite/tests/dns_test.py
from dim import db
from dim.dns import get_ip_from_ptr_name
from dim.rrtype import validate_strings
from dim.errors import InvalidParameterError, AlreadyExistsError, InvalidZoneError, DimError
from tests.util import RPCTest, raises
def test_validate_strings():
validate_st... | StarcoderdataPython |
8166776 | <reponame>TareqMonwer/reading-track<gh_stars>1-10
from django.shortcuts import render
from .models import Note
def home(request):
notes = Note.objects.order_by('-last_updated')
context = {
'notes': notes,
}
return render(request, 'pages/home.html', context)
def note_details(request, note_id... | StarcoderdataPython |
6423454 | __author__ = '<NAME>'
"""
Company : VMWare Inc.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
"""
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship,sessionmaker
f... | StarcoderdataPython |
337528 | #!/usr/bin/python
import urllib
import urllib2
import json
import sys
def query_graphite(url):
"""Function to make query to graphite to retrive monitoring data
Returns data for the query in json format. Refer document
http://graphite.readthedocs.org/en/1.0/url-api.html for details
Accepts url formatted to make... | StarcoderdataPython |
12813929 | <reponame>ishaanshah/Cuantum-Qomputing<gh_stars>1-10
import numpy as np
from qiskit import *
from qiskit.visualization import plot_histogram, plot_bloch_multivector
from qiskit.extensions import Initialize
from qiskit_textbook.tools import random_state, array_to_latex
from matplotlib import *
def teleport_gate():
... | StarcoderdataPython |
1922697 | <reponame>shashankboosi/Mycroft<filename>src/helpers/visualization.py
import pickle
import matplotlib.pyplot as plt
acc_list_path = "../../resources/output/accuracy_list/acc_list_sample.p"
with open(acc_list_path, 'rb') as f:
acc_list = pickle.load(f)
acc_list_path = "../../resources/output/accuracy_list/acc_lis... | StarcoderdataPython |
62579 | OntCversion = '2.0.0'
from ontology.interop.Ontology.Contract import Migrate
# from ontology.interop.Ontology.Contract import Destroy
from ontology.interop.System.Runtime import Notify
from ontology.interop.System.Storage import Put, GetContext, Get
KEY = "KEY"
NAME = "SecondName"
def Main(operation, args):
# if ... | StarcoderdataPython |
3209359 | a = [input() for i in range(8)]
cnt = 0
for i in range(0,8,2):
for u in range(0,8,2):
if a[i][u] == 'F':
cnt += 1
for i in range(1,8,2):
for u in range(1,8,2):
if a[i][u] == 'F':
cnt += 1
print(cnt) | StarcoderdataPython |
6701533 | <reponame>elastest/elastest-persistence-service
from flask_restplus import fields
from rest_api_app.api.restplus import api
edm_backup_resp = api.model('EDM backup response', {
'backup_id': fields.Integer(readOnly=True, description='The unique identifier of an EDM backup')
})
edm_backup = api.model('edm backup', ... | StarcoderdataPython |
3597732 | import logging
import time
import uuid
from typing import List
import furl
import esia_client
from esia_client import Scope
logger = logging.getLogger(__name__)
__all__ = ['AsyncAuth', 'AsyncUserInfo', 'AsyncEBS']
class AsyncUserInfo(esia_client.UserInfo):
async def _request(self, url: str) -> dict:
"... | StarcoderdataPython |
8031457 | <gh_stars>10-100
import unittest
from datetime import datetime
import pandas as pd
from airflow import DAG
from dsbox.operators.data_operator import DataOperator
from dsbox.operators.data_unit import DataInputFileUnit, DataOutputFileUnit
from dsbox.utils import execute_dag
def drop_na_dataframe(dataframe, columns):... | StarcoderdataPython |
6628728 | import logging
from collections import defaultdict
from qgis.core import QgsFeatureRequest, QgsField, QgsGeometry
from qgis.PyQt.QtCore import QVariant
from catatom2osm import config, translate
from catatom2osm.geo import BUFFER_SIZE, SIMPLIFY_BUILDING_PARTS
from catatom2osm.geo.geometry import Geometry
from catatom2... | StarcoderdataPython |
1629437 | from django.contrib import admin
from traffiq.models import TrafficReport
class TrafficAdmin(admin.ModelAdmin):
list_display = (
'latitude',
'longitude',
'last_latitude',
'last_longitude',
'response',
'when')
admin.site.register(TrafficReport, TrafficAdmin)
| StarcoderdataPython |
223682 | # -*- coding: utf-8 -*-
"""Top-level package for Python Token Bucket."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.1'
from .tokenbucket import TokenBucket
__all__ = ['TokenBucket']
| StarcoderdataPython |
1872141 | <reponame>ckamtsikis/cmssw<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMOffline.Trigger.HTMonitor_cfi import hltHTmonitoring
from DQMOffline.Trigger.JetMonitor_cfi import hltJetMETmonitoring
from DQMOffline.Trigger.TrackingMonitoring_cff import *
DisplacedJetIter2TracksMonitoringHLT = tracking... | StarcoderdataPython |
1612973 | <reponame>gbrault/resonance<filename>resonance/tests/test_nonlinear_systems.py
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
import pytest
from pandas.util.testing import assert_frame_equal
from ..nonlinear_systems import (SingleDoFNonLinearSystem,
... | StarcoderdataPython |
3537686 | <reponame>stanman71/Miranda<filename>app/sites/watering.py
from flask import render_template, redirect, url_for, request
from flask_login import login_required, current_user
from functools import wraps
from app import app
from app.database.database import *
from app.components.checks import CHECK_WATERING_SETTINGS
#... | StarcoderdataPython |
6460622 | <filename>setup.py
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='simpleversions',
version='0.1.4',
py_modules=['simpleversions'],
zip_safe=False,
)
| StarcoderdataPython |
258277 | <reponame>DiogoM1/si<filename>src/si/unsupervised/pca.py
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Created By : <NAME>
# Created Date: 01-09-2021
# version ='0.0.1'
# ---------------------------------------------------------------------------
"""Principal ... | StarcoderdataPython |
9780314 | mse = {
"1": {
"SVR": {
"EE_TP": [0.47309497454290295, 0.6529189746067385],
"EC_TP": [0.8374681091040123, 0.9269201168691027],
"COSTO_TP": [0.4730949745428932, 0.6529189746067281]
},
"RF": {
"EE_TP": [0.5957400765524125, 0.7812476913851661],
... | StarcoderdataPython |
11266050 | from __future__ import print_function
from robin import unet
from keras.layers import Input
import tensorflow as tf
def test_unet():
input = Input((448, 448, 1))
conv_layer = unet.double_conv_layer(input, 32)
print(type(conv_layer))
assert type(conv_layer) == tf.Tensor
| StarcoderdataPython |
5152697 | from .depth import Depth
from .doctree2md import Translator, Writer
from docutils import nodes
from pydash import _
import html2text
import os
import sys
h = html2text.HTML2Text()
class MarkdownTranslator(Translator):
depth = Depth()
enumerated_count = {}
table_entries = []
table_rows = []
tables ... | StarcoderdataPython |
1842707 | from socket import * #import socket module
import sys # sys module needed to terminate the program
##############################################
#Prepare a TCP server socket
serverPort = 8080
serverSocket = socket(AF_INET, SOCK_STREAM)
serverSocket.bind(('',serverPort))
serverSocket.listen(1)
########################... | StarcoderdataPython |
5042385 | <reponame>rakhimov/rtk<gh_stars>0
# -*- coding: utf-8 -*-
#
# rtk.gui.gtk.matrixviews.MatrixView.py is part of the RTK Project
#
# All rights reserved.
# Copyright 2007 - 2017 <NAME> andrew.rowland <AT> reliaqual <DOT> com
"""
RTKMatrixView Meta-Class Module
-------------------------------------------------------... | StarcoderdataPython |
8074359 | from .__base_regressor import GradientDescentRegressor
from .__tensorflow_regressor import tensorflow_AnnRegressor
__all__=["GradientDescentRegressor","tensorflow_AnnRegressor"]
| StarcoderdataPython |
8076022 | # coding: utf-8
""" Retrieve all the publications with authors or co-authors from a particular institute
in a given month.
In this example we will find all the publications authored (at least in part) by
researchers at the Australian National University, Canberra."""
__author__ = "<NAME> <<EMAIL>>"
# S... | StarcoderdataPython |
1628608 | <filename>pyzo/core/kernelbroker.py
# -*- coding: utf-8 -*-
# Copyright (C) 2016, the Pyzo development team
#
# Pyzo is distributed under the terms of the 2-Clause BSD License.
# The full license can be found in 'license.txt'.
""" Module kernelBroker
This module implements the interface between Pyzo and the kernel.
... | StarcoderdataPython |
4823006 | # This file is part of the Reproducible and Reusable Data Analysis Workflow
# Server (flowServ).
#
# Copyright (C) 2019-2021 NYU.
#
# flowServ is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for more details.
"""Factory pattern for file stores."""
from... | StarcoderdataPython |
8038716 | # Copyright 2015 Google Inc. 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 applicable law or ag... | StarcoderdataPython |
1906337 | <reponame>abdalazzezzalsalahat/my-DX
from django.urls.base import reverse_lazy
from snacks.models import Snack
from django.db import models
from django.shortcuts import render
from django.utils.translation import templatize
from django.views.generic import (
TemplateView,
ListView,
CreateView,
DetailVi... | StarcoderdataPython |
1771614 | <filename>framework/random_sampling.py
## Copyright 2020 UT-Battelle, LLC. See LICENSE.txt for more information.
###
# @author <NAME>, <NAME>, <NAME>, <NAME>
# <EMAIL>
#
# Modification:
# Baseline code
# Date: Apr, 2020
# *********************************************************************... | StarcoderdataPython |
5036403 | <reponame>AJBenjumea/distributed-apps-platform<gh_stars>1-10
#!/usr/bin/env python
# Copyright (c) 2020-2021 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2 License
# The full license information can be found in LICENSE.txt
# in the root directory of this project.
"""
This module defines Console App ... | StarcoderdataPython |
6501452 | <filename>graphs/Graph.py<gh_stars>1-10
from collections import Counter, defaultdict
from typing import Dict, List
import networkx as nx
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from emoji import UNICODE_EMOJI
from plotly.subplots import make_subplots
from wo... | StarcoderdataPython |
1615963 |
# coding: utf-8
'''
data
||
cats-dogs-redux
____________________________||__________________
| | | |
train test valid sample
____|___ _____|___ ______... | StarcoderdataPython |
1909186 | # Generated by Django 4.0.3 on 2022-05-20 13:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project_budget', '0005_alter_contractspending_date_and_more'),
]
operations = [
migrations.AddField(
model_name='resourcespendin... | StarcoderdataPython |
8029327 |
from dolfin import *
from .params_geo import *
from math import sqrt, pow
def subdomain_list(**params):
globals().update(params)
return [Fluid(), Molecule()]
def boundaries_list(**params):
globals().update(params)
return [Upper(), Lower(), Side(), MoleculeB()]
synonymes = {
"solid... | StarcoderdataPython |
8064063 | <filename>direct_perform.py
import numpy as np
from scipy import spatial
from datetime import datetime
import pandas as pd
import os
max_doc_len = 500
glove_embeddings = {}
embeds_file = open('glove/glove.840B.300d.txt', 'r')
for line in embeds_file:
try:
splitLines = line.split()
word = splitLine... | StarcoderdataPython |
6551411 | import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
from getpass import getpass
from email.encoders import encode_base64, encode_quopri
me = '<EMAIL>'
you= ['<EMAIL>','<EMAIL>']
auth = ('<EMAIL>', getpass())
mx= ('smtp.g... | StarcoderdataPython |
5158828 | #!/usr/bin/env python
"""
Project: CLIPRT - Client Information Parsing and Reporting Tool.
@author: mhodges
Copyright 2021 <NAME>
"""
from cliprt.classes.client_identity import ClientIdentity
from cliprt.classes.client_information_workbook import ClientInformationWorkbook
class ClientIdentityTest:
"""
... | StarcoderdataPython |
1835105 | import numpy as np
from utils.utils_geometry import (iou_3d_from_corners, box_2d_overlap_union,
tracking_center_distance_2d, tracking_distance_2d_dims, tracking_distance_2d_full)
def iou_bbox_3d_matrix(detections, predictions, detections_dims, predictions_dims):
return generic_s... | StarcoderdataPython |
135990 | <gh_stars>0
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
class MACSData:
def importdata(self, filename):
"""
read in MACS projection data type.
@param filename: string type, full name including suffix is required. Example: "mydata.txt"
@return: np.ndarray... | StarcoderdataPython |
247003 | <gh_stars>1-10
# ------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------... | StarcoderdataPython |
3273937 | <reponame>HughTebby/ASSS<gh_stars>0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2010 <NAME>
# Simple Sampler plays a sound when you push its button.
import pygtk
pygtk.require('2.0')
import gtk
import os
from os import *
from signal import SIGTERM
import subprocess
from subprocess import Popen
class Soun... | StarcoderdataPython |
4940558 | <reponame>czxxxcyz/mario_python<filename>mario_level_1.py
import sys
import pygame as pg
from data.main import main
import cProfile
if __name__=='__main__':
main()
pg.quit()
sys.exit() | StarcoderdataPython |
192213 | <reponame>artudi54/video-streamer<gh_stars>1-10
class Request:
pass
class DirectoryInfoRequest(Request):
def __init__(self, path):
super().__init__()
self.path = path
class AdditionalEntryPropertiesRequest(Request):
def __init__(self, filepath):
super().__init__()
self.... | StarcoderdataPython |
4992130 | <reponame>neurodata/maggot_connectome<gh_stars>1-10
#%% [markdown]
# # Matching when including the contralateral connections
#%% [markdown]
# ## Preliminaries
#%%
from pkg.utils import set_warnings
set_warnings()
import datetime
import time
from pathlib import Path
import os
import matplotlib.pyplot as plt
import n... | StarcoderdataPython |
5053281 | <filename>tests/apitests/arc.py
size(200, 200)
path = BezierPath()
path.moveTo((100, 100))
path.arc((100, 100), 80, 230, 170, False)
path.arc((100, 100), 60, 30, 120, True)
path.closePath()
stroke(0)
fill(None)
strokeWidth(4)
drawPath(path)
# arc(center, radius, startAngle, endAngle, clockwise)
# Arc with center and... | StarcoderdataPython |
1833211 | <reponame>austinjp/textacy<gh_stars>1000+
"""
Sequence-based Metrics
----------------------
:mod:`textacy.similarity.sequences`: Normalized similarity metrics built on
sequence-based algorithms that identify and measure the subsequences common to each.
"""
import difflib
from typing import Sequence
def matching_subs... | StarcoderdataPython |
8123686 | <gh_stars>100-1000
import os
import logging
import time
from collections import namedtuple
from pathlib import Path
import torch
import torch.optim as optim
import torch.nn as nn
import numpy as np
from torch.utils.data import DataLoader
from prefetch_generator import BackgroundGenerator
from contextlib import context... | StarcoderdataPython |
5015539 | <gh_stars>0
import math
import numpy
from plotly.subplots import make_subplots
from pygments.lexers import go
import IMLearn.learners.regressors.linear_regression
from IMLearn.learners.regressors import PolynomialFitting
from IMLearn.utils import split_train_test
import numpy as np
import pandas as pd
import plotly.... | StarcoderdataPython |
8100791 | import random
def seedLCG(seed):
global rand
rand = seed
def lcg():
a = 1140671485
c = 128201163
m = 2**24
global rand
rand = (a*rand + c) % m
return rand
| StarcoderdataPython |
4829761 | from django.db import models
from abstracts.models import TimeStamp
from configurations.models import CategorySalesRank
class Supplier(TimeStamp):
name = models.CharField(max_length=255)
website = models.CharField(max_length=255, default='', blank=True)
def __str__(self):
return f'<Supplier: {sel... | StarcoderdataPython |
3556235 | <reponame>pnijjar/eventbrite-helpers<filename>gen_rss_eventbrite.py
#!/usr/bin/env python3
from eventbrite_helpers import helpers as h
h.write_transformation(['rss',])
| StarcoderdataPython |
11243120 | import board
import busio
import digitalio
import adafruit_tlc59711
def create_spi():
spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI)
return spi
class RgbLed:
def __init__(self, spi):
self.spi = spi
self.MAX = 65535
self.MAX_BRIGHT = 127
def setup(self):
self.led = ... | StarcoderdataPython |
3573187 |
def make_home_page(projects):
# Make list of project links:
project_str = ""
for project in projects:
proj_rep = project.replace("-", "_")
project_str += f'<a href="data/{project}/index_{proj_rep}.html">{project}</a>\n'
page_str = \
f'''
<!-- Side navigation -->
<head>
<link rel="... | StarcoderdataPython |
3502293 | import time
class ZmqMessage:
def __init__(self):
self.timePoint = []
def zmgInit_empty(self):
self.makeTimePoint()
def zmgInit(self,zmqSender,msgType,st,flags,addr):
self.zmqSender = zmqSender
self.msgType = msgType
self.st = st
self.flags = flags
... | StarcoderdataPython |
8040925 | <gh_stars>0
# Comment it before submitting
# class Node:
# def __init__(self, value, left=None, right=None):
# self.value = value
# self.right = right
# self.left = left
def solution(Node) -> int:
root_value = Node.value
if (Node.left is None) and (Node.right is None):
ret... | StarcoderdataPython |
1712733 | from __future__ import absolute_import
from . import temporal
from . import maintenance
| StarcoderdataPython |
9774792 |
import asyncio, argparse
from re import M
from bleak import BleakClient
address = "2C34464E-9C38-279D-923C-E60D5EBBC3E8"
battery_char = '00002a19-0000-1000-8000-00805f9b34fb'
sensor_char = "c1670003-2c5d-42fd-be9b-1f2dd6681818"
sensor_cmds = {
'sound': {'on': '0b0019022001040102010101e0', 'off': '0b0019020100000... | StarcoderdataPython |
203836 | <filename>SfM/Traditional/NonLinearPnP.py
""" File to implement Non Linear PnP method
"""
import numpy as np
import scipy.optimize as opt
from scipy.spatial.transform import Rotation as Rscipy
def reprojError(CQ, K, X, x):
"""Function to calculate reprojection error
Args:
K (TYPE): intrinsic matrix
... | StarcoderdataPython |
300024 | from uuid import uuid4
import datetime
from datetime import timezone
from sqlalchemy import (
Column,
String,
ForeignKey)
from sqlalchemy.dialects.postgresql import JSONB, UUID
from sqlalchemy.orm import relationship
from .types.isodatetime import IsoDateTime
from .meta import Base
class Rat(Base):
... | StarcoderdataPython |
3553120 | #########################################################
# VALIDATION SCRIPT #
# TWO LINK ARM #
# @author <NAME>
#########################################################
__author__ = "<NAME>"
import pickle
from ImitationLearning.AI import Netleaky
import pygame
import torch
import random
import math
import matplotl... | StarcoderdataPython |
9690959 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `corrct.operators` package."""
import numpy as np
import unittest
from corrct import operators
from corrct import utils_test
eps = np.finfo(np.float32).eps
class TestOperators(unittest.TestCase):
"""Base test class for operators in `corrct.operators... | StarcoderdataPython |
8081421 | from datetime import datetime
from app import db
from app.admin import bp
from app.admin.forms import CreateUserForm
from app.auth.access import admin_required
from app.models import User
from flask import (current_app, flash, redirect, render_template, request,
url_for)
from flask.json import jsoni... | StarcoderdataPython |
194744 | # Copyright 2020 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 |
1936367 | #!/usr/bin/env python
#-------------------------------------------------------------------------------
# Name: OctopusLite
# Purpose: OctopusLite is a simple script based timelapse acquisition. It
# uses other open-source hardware control software for image
# acquisition and some hardware synch... | StarcoderdataPython |
5044491 | from netmiko import ConnectHandler, file_transfer
connection_info = {
'device_type': 'cisco_ios',
'host': '<insert host>',
'port': 22, # Change if your port is different
'username': '<insert username>',
'password': '<insert password>'
}
with ConnectHandler(**connection_info) as conn:
conn.send... | StarcoderdataPython |
3407761 | # -*- coding: utf-8 -*-
"""
Examples for image warping with optimal transport
"""
import logging
import numpy as np
from numpy.matlib import repmat
import PIL.Image as Image
from skimage.color import rgb2gray
from ot import imgwarp
imgwarp.logger.setLevel(logging.INFO)
def main():
##### Example 1: Uniform to... | StarcoderdataPython |
9600169 | import pytest
import pandas as pd
from roughviz.charts.barh import Barh
def test_wrong_input_data():
wrong_data = {
"loc": ["North", "South", "East", "West"],
"values": [10, 5, 8, 3]
}
with pytest.raises(ValueError):
Barh(data=wrong_data)
def test_wrong_data_path():
fpath = ... | StarcoderdataPython |
4859989 | <reponame>NodiraIbrogimova/LeetHub
class Solution:
def containsNearbyDuplicate(self, nums: List[int], k: int) -> bool:
hashmap = dict()
for i in range(len(nums)):
if nums[i] in hashmap and abs(hashmap[nums[i]] - i) <= k:
return True
hashmap[nums[i]] = i
... | StarcoderdataPython |
3422684 | <reponame>chuajiesheng/twitter-sentiment-analysis
import sys
import json
import hashlib
import gc
from operator import *
import shlex
from pyspark import StorageLevel
from pyspark.sql import SQLContext
from pyspark.sql.functions import *
from pyspark.sql.types import *
import numpy as np
from subjectivity_clues impo... | StarcoderdataPython |
379261 | <reponame>philiphinton/learn_python
# Wrap the operations into one function, now named `calculate`,
# with a mandatory "operation" parameter.
def calculate(x: int, y: int = 1, operation: str = None) -> int:
"""Calculates the sum (or difference) of two numbers.
Parameters:
`x` : int
The first numb... | StarcoderdataPython |
3426203 | <gh_stars>1-10
from PyQt5 import QtWidgets, QtGui
class ImageWidget(QtWidgets.QWidget):
def __init__(self, filename, parent=None):
super().__init__(parent=parent)
label = QtWidgets.QLabel()
pixmap = QtGui.QPixmap(filename)
label.setPixmap(pixmap)
layout = QtWidgets.QGridLa... | StarcoderdataPython |
8042643 | from statsmodels.compat.python import lmap
import calendar
from io import BytesIO
import locale
import numpy as np
from numpy.testing import assert_, assert_equal
import pandas as pd
import pytest
from statsmodels.datasets import elnino, macrodata
from statsmodels.graphics.tsaplots import (
month_plot,
plot_... | StarcoderdataPython |
9688528 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Process
import os
import time
from sanic import Sanic
from watchdog.observers import Observer
import watchdog
def watch(builder):
"""Watch changes in directories and yield events indicating where the change
happened: BLOG_FOLDER, ST... | StarcoderdataPython |
1657699 | from onto.view.query_delta import OnTriggerMixin
from onto.context import Context
Context.load()
to_trigger = OnTriggerMixin(resource="projects/flask-boiler-testing/databases/(default)/documents/gcfTest/{gcfTestDocId}")
| StarcoderdataPython |
8097392 | <gh_stars>10-100
#!/usr/bin/env python
#--coding:utf-8 --
"""
cLoops2 estDis.py
Get the observed and expected background of genomic distance vs genomic interaciton frequency.
2019-08-26: updated with parallel
2019-12-30: update output orders
2020-10-27: integrate into cLoops2 main interface
"""
__date__ = "2019-08-23... | StarcoderdataPython |
12861014 | <reponame>reconstruir/bes<filename>lib/bes/fs/dir_util.py
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
import os, os.path as path, shutil
import datetime
from .file_match import file_match
from .file_util import file_util
class dir_util(object):
@classmethod
def... | StarcoderdataPython |
326573 | <filename>pyquil/api/_compiler.py
##############################################################################
# Copyright 2016-2018 Rigetti Computing
#
# 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... | StarcoderdataPython |
8093682 |
from tkinter import *
import tkinter as tk
#Be sure to import our other modules
#so we can have access to them
import phonebook_main
import phonebook_func
def load_gui (self):
#self is the key to access the class objects, perimissions to access widgets
#we are giving the class all of these wigets; buttons, s... | StarcoderdataPython |
366948 | # -*- coding: utf-8 -*-
from packages._proxy import *
from packages._url import *
from packages._Base import *
from packages._mode import *
from packages._tags import *
from packages._profiles import *
def username_list(username,mediatype,limit,apinum = 0):
u = Url()
u.setUserName(username)
u.setMediaTyp... | StarcoderdataPython |
5057576 | <filename>doc/hexagonal_image_generation/ctapipe/ctapipe_basics_test3.py
#!/usr/bin/env python3.7
import astropy.units as u
import matplotlib.pyplot as plt
import numpy as np
from ctapipe.image import toymodel
from ctapipe.instrument import CameraGeometry
from ctapipe.visualization import ... | StarcoderdataPython |
11285922 | #!/usr/bin/env python
# Calculate the macroscopic force-displacement plot
# Undeformed cross-section area of the specimen
undeformed_area = 10
import os, fnmatch
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
mesh_name = 'Meshless.0.geo' # file containing the initial pos... | StarcoderdataPython |
1739771 | from __settings__ import *
from opensimplex import OpenSimplex
from random import randint
from filters.int_median_cutter import int_median_cutter
def refactor(map_array: list, min_height: int, max_height: int):
"""
Function blending map composed from rectangular chunks into seamless one, without visible... | StarcoderdataPython |
6706674 | """
HDX Modifications to the default behavior of CKAN's dashboard
for usersand user profiles. Overrides functions found in user.py
"""
import logging
from pylons import config
import ckan.lib.base as base
import ckan.model as model
import ckan.lib.helpers as h
import ckan.authz as new_authz
import ckan.logic... | StarcoderdataPython |
1623156 | # python server.py no1_2_cookie_app:app
from http.cookies import SimpleCookie
from no1_1_cookie_framework import MyWSGIFramework
# Cookieまわりの参考
# http://pwp.stevecassidy.net/wsgi/cookies.html
def cookie(environ, start_response):
visit_in_html = 1
headers = [('Content-Type', 'text/plain'),]
# 今... | StarcoderdataPython |
4977019 | <filename>2017/day18-1.py
with open("day18.txt") as f:
instructions = [x.strip() for x in f.readlines()]
lastPlayed = None
i = 0
regs = {chr(i): 0 for i in range(97, 117)}
while i < len(instructions):
instruct = instructions[i].split()
op = instruct[0]
reg = instruct[1]
if len(instruct) == 3:
... | StarcoderdataPython |
6528091 | import unittest
import numpy as np
from import_toolkit._cluster_profiler import Mixin
np.set_printoptions(suppress=True)
class TestMixin(unittest.TestCase):
def test_angle_between_vectors(self):
vectors_input = [
[1, 0, 0], [0, 1, 0], [0, 0, 1],
[-1, 0, 0], [0, -1, 0], [0, 0, -1],... | StarcoderdataPython |
3245150 | import numpy as np
from typing import Union
import anndata
from .scatters import (
scatters,
docstrings,
)
from ..tl import compute_smallest_distance
from ..dynamo_logger import main_critical, main_info, main_finish_progress, main_log_time, main_warning
docstrings.delete_params("scatters.parameters", "adata",... | StarcoderdataPython |
5128608 | <gh_stars>1-10
def equalProperties(properties):
# test for equality
pass
#import numpy as np
#np.testing.assert_allclose | StarcoderdataPython |
12845660 | <reponame>MetaGenScope/metagenscope-server
"""Microbe Directory display models."""
from app.extensions import mongoDB as mdb
class MicrobeDirectoryResult(mdb.EmbeddedDocument): # pylint: disable=too-few-public-methods
"""Set of microbe directory results."""
samples = mdb.DictField(required=True)
| StarcoderdataPython |
12852628 | <filename>pytest_docker_registry_fixtures/fixtures.py<gh_stars>0
#!/usr/bin/env python
# pylint: disable=redefined-outer-name,too-many-arguments,too-many-locals
"""The actual fixtures, you found them ;)."""
import logging
import itertools
from base64 import b64encode
from distutils.util import strtobool
from functo... | StarcoderdataPython |
3381634 | <filename>src/tests/t_kprop.py
#!/usr/bin/python
from k5test import *
conf_slave = {'dbmodules': {'db': {'database_name': '$testdir/db.slave'}}}
# kprop/kpropd are the only users of krb5_auth_con_initivector, so run
# this test over all enctypes to exercise mkpriv cipher state.
for realm in multipass_realms(create_us... | StarcoderdataPython |
4822034 | <reponame>spraakbanken/karp-backend-v6-tmp
from typing import Dict
from karp.domain import model
from karp.domain.models.entry import EntryOp, EntryStatus
from karp.domain.models.resource import ResourceOp
from karp.infrastructure.sql import db
class ResourceDTO(db.Base):
__tablename__ = "resources"
history... | StarcoderdataPython |
4560 | <filename>src/djangoreactredux/wsgi.py
"""
WSGI config for django-react-redux-jwt-base project.
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djangoreactredux.settings.dev")
from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
application = get_wsgi_appli... | StarcoderdataPython |
4974283 | import logging
import tempfile
import shutil
import inspect
import re
from io import IOBase
from pathlib import Path
from importlib_resources import files
from datetime import datetime, timedelta
from typing import Sequence, Optional, Mapping
from .versions import VersionRaw, guess_version
from .meta import Meta, Me... | StarcoderdataPython |
3547747 | from django.test import TestCase
from django.forms.models import model_to_dict
from longclaw.tests.utils import LongclawTestCase, AddressFactory, CountryFactory, ShippingRateFactory
from longclaw.longclawshipping.forms import AddressForm
from longclaw.longclawshipping.utils import get_shipping_cost
from longclaw.longcl... | StarcoderdataPython |
5017774 | <reponame>josrolgil/exjobbCalvin
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.