id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
8178150 | <gh_stars>0
import math
from copy import deepcopy
import pandas as pd
import pytest
from sfa_api.conftest import (
BASE_URL, copy_update, variables, agg_types,
VALID_OBS_JSON, demo_forecasts, demo_group_cdf,
VALID_AGG_JSON, demo_aggregates)
def test_get_all_aggregates(api):
res = api.get('/aggrega... | StarcoderdataPython |
1688316 | #!/usr/bin/env python
#
# Copyright 2014 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 require... | StarcoderdataPython |
22119 | import testtools
from oslo_log import log
from tempest.api.compute import base
import tempest.api.compute.flavors.test_flavors as FlavorsV2Test
import tempest.api.compute.flavors.test_flavors_negative as FlavorsListWithDetailsNegativeTest
import tempest.api.compute.flavors.test_flavors_negative as FlavorDetailsNegativ... | StarcoderdataPython |
9702349 | # Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2016-2020 German Aerospace Center (DLR) and others.
# SUMOPy module
# Copyright (C) 2012-2017 University of Bologna - DICAM
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public ... | StarcoderdataPython |
3344789 | <filename>examples/smart_thing_quick_start.py<gh_stars>0
__author__ = "<NAME>"
__copyright__ = "Copyright (C) 2020 appliedAIstudio"
__version__ = "0.1"
# needed to run a local version of the AI
from highcliff.ai import AI
# the Highcliff actions to be tested
from highcliff.exampleactions import MonitorBodyTemperature... | StarcoderdataPython |
1990428 | <filename>tests_runner/cli_tests.py
import os
from tests_runner.utils.command import run_command
from tests_runner.utils.result import TestResult, ResultPrinter
from tests_runner.utils.config import COMPILER_EXEC_PATH, VERSION_FILE
from tests_runner.utils.dir import string_from_file
USAGE_HELP = '''USAGE: shtkc FILE... | StarcoderdataPython |
5020536 | <filename>app/cli/generators.py
"""Generator Module.
Generates templates using jinja.
"""
import os
import uuid
from jinja2 import Environment, PackageLoader
class ConfigGenerator():
"""Abstract configuration generator using Jinja"""
def __init__(self):
self.env = Environment(
loader=Pac... | StarcoderdataPython |
3588399 | # Copyright 2014 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.
#
# Sends a single message on opening containing the headers received from the
# browser. The header keys have been converted to lower-case, while the values
... | StarcoderdataPython |
5154390 | <reponame>EPFL-LCSB/yetfl
from collections import namedtuple
import pandas as pd
import numpy as np
from etfl.io.json import load_json_model
from etfl.optim.config import standard_solver_config, growth_uptake_config
from etfl.optim.variables import GrowthActivation, BinaryActivator
from pytfa.optim.utils import sym... | StarcoderdataPython |
1996863 | """
Copyright (c) 2019 Intel Corporation
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 wri... | StarcoderdataPython |
9614712 | from ..nerio.z_wave_CN_validation_testing import z_wave_CN_validation_testing as z_wave_CN_validation_testing_nerio
class z_wave_CN_validation_testing(z_wave_CN_validation_testing_nerio):
pass
| StarcoderdataPython |
8055852 | <reponame>davidnewman/coneventional
from setuptools import setup, find_packages
setup(
name="coneventional",
version='1.0.0',
description='Parse conventional event summaries into objects.',
long_description=open('README.rst', encoding='utf-8').read(),
keywords=['python', 'events'],
author='<N... | StarcoderdataPython |
4828331 | <gh_stars>10-100
import sys
import io
import argparse
from tokenize import tokenize
import tokenize as Token
import xml.etree.ElementTree as ET
from xml.dom.minidom import getDOMImplementation, Text
from .astview import AstNode
############# monkey-patch minidom.Text so it doesnt escape "
def _monkey_writexml(self, ... | StarcoderdataPython |
4962914 | <filename>model.py
# ******************************************************************************
# Copyright 2019 Intel Corporation
#
# 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
#
# ... | StarcoderdataPython |
5171766 | import sys
from framework_list import frameworks
from functions import log, run_command
log("Publishing CocoaPods")
for framework in frameworks:
log(f"Publishing {framework}")
# Most pods take a few minutes to build, and a few seconds to push to trunk. However, the
# AWSiOSSDK podspec can take a long ti... | StarcoderdataPython |
3278624 | <gh_stars>1-10
word = 'tin'
print(word[0])
print(word[1])
print(word[2])
print(word[3])
| StarcoderdataPython |
12838123 | from django.db import models
from data_ocean.models import DataOceanModel
from location_register.models.koatuu_models import KoatuuCategory
class RatuRegion(DataOceanModel):
name = models.CharField('назва', max_length=30, unique=True)
koatuu = models.CharField('код КОАТУУ', max_length=10, unique=True, null=T... | StarcoderdataPython |
156431 | # dictionary, emoji convertion, split method
message = input(">")
words = message.split(' ')
print(words) # get a seperated words of the msg
emojis = {
":)": "😄",
":(": "😟"
}
output = ""
for word in words:
output += emojis.get(word, word) + " "
print(output)
| StarcoderdataPython |
182362 | <filename>src/flask_lucide/extension.py
"""Single File plugin for Lucide icons."""
import re
from dataclasses import dataclass
from flask import current_app, Flask
from io import StringIO
from markupsafe import Markup
from pathlib import Path
from typing import Optional, Any
from xml.dom import minidom
from .icons im... | StarcoderdataPython |
203118 | from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='pynoter',
version='0.1.7',
description='Powerpoint presentations into org or tex files',
long_description='Allows users to convert powerpoint presentations into raw text for editing in la... | StarcoderdataPython |
1642939 | import collections
import datetime
import pytz
from django.contrib.auth.decorators import user_passes_test
from django.shortcuts import render
from standup.status.models import Status, Team, StandupUser
def require_superuser(fun):
def authorize_user(user):
return user.is_active and user.is_superuser
... | StarcoderdataPython |
3405670 | # flake8: noqa
import os
from pathlib import Path
from tempfile import TemporaryDirectory
from pytest import mark
import torch
from torch import nn
import torch.distributed as dist
import torch.multiprocessing as mp
from torch.utils.data import DataLoader
from catalyst import dl
from catalyst.contrib.datasets import... | StarcoderdataPython |
6535803 | <gh_stars>1-10
#!/usr/bin/env python
# coding: utf-8
"""
Information about the frontend package of the widget.
"""
# module_name is the name of the NPM package for the widget
module_name = "@deck.gl/jupyter-widget"
# module_version is the current version of the module of the JS portion of the widget
module_version = ... | StarcoderdataPython |
3200404 | <reponame>LucaGuffanti/FCI<filename>Lab2/udpClient.py
from socket import *
# definisco i dati per la socket cioè l'indirizzo IP e la Porta
serverName = 'localhost' # 127.0.0.1
serverPort = 12001 # arbitrario tranne quelli standardizzati
# costruisco la socket
# AF_INET si riferisce al tipo di indirizzo IP
# SOCK_DG... | StarcoderdataPython |
73671 | from abc import ABCMeta, abstractmethod
from typing import Callable, Iterable, List, TypeVar, Tuple
from ..universe import Universe
T = TypeVar('T')
BaseUniverseType = TypeVar('BaseUniverseType', bound='BaseUniverse[T]')
class BaseUniverse(Universe[T]):
"""
Represents a base class for universes of 'The Game... | StarcoderdataPython |
33923 | import serialio
class Serial(object):
def __init__(self, port, baudrate, timeout):
self.port = port
self.baudrate = baudrate
self.timeout = timeout
self._openPort()
def _openPort(self):
self.hComm = serialio.Serial(self.port, self.baudrate) # Opening the port
def read(self):
data = seria... | StarcoderdataPython |
8117082 | <filename>irispreppy/psf/deconvolve.py<gh_stars>1-10
import concurrent.futures
import pickle
from copy import deepcopy as dc
from glob import glob as ls
from os import cpu_count as cpus
from os import path
import numpy as np
import scipy.stats as scist
from astropy.io import fits
from tqdm import tqdm
from . import I... | StarcoderdataPython |
8124035 | <gh_stars>1-10
from scapy.all import *
import sqlite3
import sys
from pprint import pprint
GSM_PACKET_QUERY = '''SELECT * FROM GSMPacket'''
if len(sys.argv) != 3:
print("Usage: python packetdumper.py <db-path> <pcap-dir>")
sys.exit(-1)
sqlitedb = sys.argv[1]
pcapdir = sys.argv[2]
conn = sqlite3.connect(sqlit... | StarcoderdataPython |
6691188 | <filename>webapp/migrations/versions/8ae9b5ddadf6_add_audit_logs.py
"""add audit logs
Revision ID: <KEY>
Revises: <PASSWORD>
Create Date: 2021-04-22 12:06:35.642688
"""
from alembic import op
import sqlalchemy as sa
from app import app
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = 'e<P... | StarcoderdataPython |
4952643 | from opencdms.models.climsoft.v4_1_1_core import Base
from apps.climsoft.db import engine
def migrate():
Base.metadata.create_all(engine.db_engine)
| StarcoderdataPython |
3542633 | # import the time module
import time
import pygame
# define the countdown func.
def countdown(t):
while t:
#divmod functions return quotient and remainder
mins, secs = divmod(t, 60)
#:02d repesents that minutes and seconds will be represented in 2 digits
... | StarcoderdataPython |
3377583 | #使用多线程:在携程中集成阻塞io
import asyncio
from concurrent.futures import ThreadPoolExecutor
import socket
from urllib.parse import urlparse
def get_url(url):
#通过socket请求html
url = urlparse(url)
host = url.netloc
path = url.path
if path == "":
path = "/"
#建立socket连接
client = socket.socket(s... | StarcoderdataPython |
6675886 | <filename>lostanimals/lostpet/admin.py
from django.contrib import admin
from django_google_maps import widgets as map_widgets
from django_google_maps import fields as map_fields
from lostpet.models import Pet
# Register your models here.
class PetAdmin(admin.ModelAdmin):
formfield_overrides = {
map_fields.Ad... | StarcoderdataPython |
4824349 | from django.db import models
class User(models.Model):
username = models.CharField(max_length=100)
email = models.EmailField()
groups = models.ManyToManyField('Group')
ordering = models.IntegerField(default=0)
class Meta:
ordering = ('ordering',)
class Group(models.Model):
name = mo... | StarcoderdataPython |
6564985 | <gh_stars>1-10
from django.contrib.gis.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from ambulance.models import Location, LocationType
from equipment.models import EquipmentHolder
from environs import Env
env = Env()
# Hospital model
class Hospital(Locat... | StarcoderdataPython |
5000196 | from . import config_links, packages
| StarcoderdataPython |
230194 | <reponame>a76yyyy/ipdata
import os
data_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))+os.path.sep+"data")
tmp_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))+os.path.sep+"tmp")
DEFAULT_FILE_LOCATION = os.path.join(data_dir,'ipv6wry.db')
sql_file = os.path.abspath(data_dir+os.path.se... | StarcoderdataPython |
1650967 | from .loss import MemReplayLoss
| StarcoderdataPython |
4896547 | <filename>wandb/sdk/interface/interface_sock.py
"""InterfaceSock - Derived from InterfaceShared using a socket to send to internal thread
See interface.py for how interface classes relate to each other.
"""
import logging
from typing import Any, Optional
from typing import TYPE_CHECKING
from .interface_shared impo... | StarcoderdataPython |
6594702 | <gh_stars>10-100
"""
bidsUtils.py
============================
Description:
This file is used for formatting pipline data into the BIDS format
Author:
<NAME>
Usage: N/A not a command line script (no bang above)
"""
from os.path import join
class BAWBIDSFormatter(object):
def __init__(self):
sel... | StarcoderdataPython |
4961818 | <gh_stars>0
from simple import func1
from whatever import func2
from world import func3
| StarcoderdataPython |
3475698 | <filename>Chapter01/file.py
f = open('test.txt', 'w')
f.write('first line of file \n')
f.write('second line of file \n')
f.close()
f = open('test.txt')
content = f.read()
print(content)
f.close()
| StarcoderdataPython |
1962025 | from util.enums import RES
TILE_H = 32
TILE_W = 32
DEFAULT_FONT = RES + "fonts/FiraSans-Light.ttf"
DEFAULT_FONT_SIZE = 24
HEART_LOCS = [[(770, 5), (805, 5), (840, 5), (875, 5)],
[(770, 39), (805, 39), (840, 39), (875, 39)]]
TOWER_LOCS = [(781, 99), (781, 157), (781, 217),
(846, 99), (846,... | StarcoderdataPython |
5053844 | import itertools as itt
from typing import List, Optional, Sequence
from rl_rpsr.linalg import cross_sum
from rl_rpsr.pruning import inc_prune, purge
from rl_rpsr.util import VI_Type
from rl_rpsr.value_function import Alpha, ValueFunction
from rl_rpsr.value_iteration import VI_Algo
from .model import RPSR_Model
__al... | StarcoderdataPython |
3257256 | <reponame>similarweb/gru
from string import Template
import simpleldap
from gru.plugins.base.auth import AuthenticationBackend, User
from gru.config import settings
class LdapBackend(AuthenticationBackend):
"""
LDAP authentication backend.
expects the following configuration in the inventory.yaml file
... | StarcoderdataPython |
3472765 | <gh_stars>10-100
"""
Readability OAuth1 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/readability.html
"""
from social.backends.oauth import BaseOAuth1
READABILITY_API = 'https://www.readability.com/api/rest/v1'
class ReadabilityOAuth(BaseOAuth1):
"""Readability OAuth authentication backend""... | StarcoderdataPython |
12850213 | <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
# ... | StarcoderdataPython |
5014719 | <gh_stars>0
# _*_ coding: utf-8 _*_
from aip import AipOcr
import wda
import cv2
import webbrowser
import time
import datetime
from urllib import parse
import numpy as np
import requests
# """ 你的 APPID AK SK """
APP_ID = '10701834'
API_KEY = '<KEY>'
SECRET_KEY = '<KEY>'
client = AipOcr(APP_ID, API_KEY, SECRET_KEY... | StarcoderdataPython |
9753315 |
from django.conf.urls import url
from hood import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns=[
url('^$',views.index, name='index'),
url('^edit/',views.edit_profile, name='edit_profile'),
url(r'^user/(?P<username>\w+)', views.user_profile, name='user_profi... | StarcoderdataPython |
9600688 | from django import forms
from accounts.models import UserProfile
class ProfileEditForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
for (_, field) in self.fields.items():
field.widget.attrs['class'] = 'form-control'
username = forms.Cha... | StarcoderdataPython |
4826204 | <reponame>awesome-archive/Automatic_Speech_Recognition<gh_stars>0
# -*- coding:utf-8 -*-
import os
import numpy as np
import scipy.io.wavfile as wav
from calcmfcc import calcMFCC_delta_delta
PHN_LOOKUP_TABLE = ['aa', 'ae', 'ah', 'ao', 'aw', 'ax', 'ax-h', 'axr', 'ay', 'b', 'bcl', 'ch', 'd', 'dcl', 'dh', 'dx',
... | StarcoderdataPython |
9781354 | <gh_stars>10-100
# coding=utf-8
import os
# 获取上级目录的绝对路径
last_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
# 获取lib
LIB_DIR = os.path.join(last_dir, u"lib")
LINUX_X64_DIR = os.path.join(LIB_DIR, u"linux_x64")
WINDOWS_DIR = os.path.join(LIB_DIR, u"windows")
WIN32_DIR = os.path.join(LIB_DIR, u"wi... | StarcoderdataPython |
1938772 | import logging
import os
import subprocess
import sys
import traceback
from datetime import datetime
import oss2
import prettytable
import requests
from automonkey.config import DefaultConfig
from automonkey.exception import FileDownloadErrorException
logger = logging.getLogger(__name__)
"""
# 工具类
"""
class Util... | StarcoderdataPython |
8032461 | <gh_stars>1-10
_available_directives = {}
def directive(fn):
_available_directives[fn.__name__] = fn
fn._directive = True
return fn
def get_directive(fn):
return _available_directives[fn]
def get_available_directives():
return _available_directives
@directive
async def body(request):
ret... | StarcoderdataPython |
1707893 | from django.shortcuts import render,redirect
from django.http import HttpResponse
# Create your views here.
from .tasks import *
import pymongo
import datetime
from bson.objectid import ObjectId
from .local1 import *
from .regular1 import *
from django.http import JsonResponse
class vars():
grid_var = 0
zel_... | StarcoderdataPython |
5179867 | # Copyright 2021 DeepMind Technologies Limited.
#
# 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... | StarcoderdataPython |
6439096 | #!/usr/bin/env python3
import logging
import socket
import os
from time import sleep
import seqlog
server_url = os.getenv("SEQ_SERVER_URL", "http://localhost:5341/")
api_key = os.getenv("SEQ_API_KEY", "")
print("Logging to Seq server '{}' (API key = '{}').".format(server_url, api_key))
log_handler = seqlog.log_to_... | StarcoderdataPython |
11245183 | <gh_stars>1-10
""" pyglotaran-extras io package """
from pyglotaran_extras.io.load_data import load_data
from pyglotaran_extras.io.setup_case_study import setup_case_study
__all__ = ["setup_case_study", "load_data"]
| StarcoderdataPython |
221489 | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import time
import random
import hmac
import hashlib
import binascii
import base64
import json
import logging
import re
import requests
# (*)腾讯优图配置
app_id = os.environ.get('app_id')
secret_id = os.environ.get('secret_id')
secret_key = os.environ.get('secret_ke... | StarcoderdataPython |
6517024 | '''
Crie um programa que leia o nome de uma pessoa e diga se ela tem "Silva" no nome.
'''
nome = str(input('Digite um nome de pessoa: ')).title().split()
print(f'\nTem "Silva" no nome? {"Silva" in nome}')
#Essa forma evita que 'Silvana' seja aceita | StarcoderdataPython |
3239331 | <gh_stars>0
"""
LKB (c) 2016-17
Processing Nivel220 sensor (RS485 interface) output, as collected by Portmon for Windows port sniffer.
Output:
Time, X,Y,T
written for python 2.7
"""
#import pandas as pd
#import numpy as np
#import scipy
import glob, os #for file handling
import re #advanced text
import pdb #debugg... | StarcoderdataPython |
1955096 | <reponame>drzymala-pro/histograph<gh_stars>0
# -*- coding: utf-8 -*-
from histograph.histograph import Histograph
| StarcoderdataPython |
8143237 | import marshmallow as ma
from flask.globals import current_app
from marshmallow.exceptions import ValidationError
from marshmallow.utils import missing
from sqlalchemy.exc import IntegrityError
from werkzeug.exceptions import UnprocessableEntity
from slurk.extensions.api import abort
def register_blueprints(api):
... | StarcoderdataPython |
3541061 | <gh_stars>1-10
from twisted.internet import reactor, defer, endpoints
from twisted.internet.endpoints import TCP4ClientEndpoint, connectProtocol
from twisted.protocols.amp import AMP
from ampserver import Sum, Divide
def doMath():
destination = TCP4ClientEndpoint(reactor, '1172.16.58.3', 1234)
sumDeferred = c... | StarcoderdataPython |
11334432 | <reponame>cmbasnett/fake-bpy-module<gh_stars>0
DecimateModifier.face_count = None
| StarcoderdataPython |
4948921 | from model.linter import Linter
import sys
from tkinter import *
from interpreter import Interpreter
class Model():
def __init__(self):
self.linter=Linter()
self.errors = StringVar()
self.maxsteps = IntVar()
self.input = StringVar()
self.name = StringVar()
self.name.... | StarcoderdataPython |
8146033 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import string
from random import *
#global a, b, c, d
a = string.ascii_lowercase
b = string.ascii_uppercase
c = string.digits
d = string.punctuation
def genPassword(n):
a1=randint(1,n-3)
b1=randint(1,n-2-a1)
c1=randint(1,n-1-a1-b1)
d1=n-a1-b1-c1
a2=... | StarcoderdataPython |
12862932 | from abc import ABCMeta
from whatsapp_tracker.bases.selenium_bases.base_selenium_kit import BaseSeleniumKit
from whatsapp_tracker.mixins.seleniun_keyboard_press_mixin import SeleniumKeyBoardPressMixin
class BaseSeleniumKeyboard(BaseSeleniumKit, SeleniumKeyBoardPressMixin, metaclass=ABCMeta):
...
| StarcoderdataPython |
11292747 | import time
from python_ecs.ecs import Component
class Stronger(Component):
def __init__(self) -> None:
super().__init__()
self.time = 0
self.start_time = time.time()
| StarcoderdataPython |
3339056 | <filename>significance_test/significanceTest.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>
"""
Statistical Hypothesis Test(significance test)
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import shapiro
from scipy.stats import normaltest
from scipy.stats import anderson
fr... | StarcoderdataPython |
5001374 | #!/usr/bin/python3
# -*- coding : utf-8 -*-
import os
import nlpnet
class Tagger:
'''
POS-Tagger for portuguese language
'''
def __init__(self):
self.tagger = nlpnet.POSTagger(os.path.dirname(os.path.realpath(__file__)) + "/pos-pt", language="pt")
def tag(self, text):
'''
... | StarcoderdataPython |
9644288 | <reponame>MTandHJ/leetcode
from typing import List
from base import version
from sorts import MinHeap
class Solution:
@version("sorted: 32ms")
def findKthLargest(self, nums: List[int], k: int) -> int:
return sorted(nums)[-k]
@staticmethod
def _sorted(nums: List) -> List:
left, rig... | StarcoderdataPython |
11372639 | #!/usr/local/bin/python3
#-*- encoding: utf-8 -*-
import json
from common.db.redisDB import RedisDB
#싱글톤 패턴으로 단 한번의 DB 커넥션을 가진다.
class ClientRedis:
_instance = None
_dbConn = None
_prefixClient = 'worker_client_t0001:ip:'
_prefixClientDeviceInfo = 'worker_client_t0001:device:'
_timeout = 7200
... | StarcoderdataPython |
3470798 |
from BasicMetrics import true_positive, false_positive
def precision(y_true, y_pred) -> float:
TP = true_positive(y_true, y_pred)
FP = false_positive(y_true, y_pred)
precision = TP / (TP+FP) #formulla
return precision
l1 = [0,1,1,1,0,0,0,1]
l2 = [0,1,0,1,0,1,0,0]
print(precision(l1, l2))
| StarcoderdataPython |
4979012 | <reponame>kumagai-group/vise<gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright (c) 2020. Distributed under the terms of the MIT License.
from pymatgen.io.vasp.sets import Kpoints
class ViseKpoints(Kpoints):
def __str__(self):
lines = [self.comment, str(self.num_kpts), self.style.name]
style =... | StarcoderdataPython |
120512 | """
When you select a contiguous block of text in a PDF viewer, the selection is highlighted with a blue rectangle. In this PDF viewer, each word is highlighted independently. For example:
PDF-highighting.png
In this challenge, you will be given a list of letter heights in the alphabet and a string. Using the le... | StarcoderdataPython |
9605268 | import csv
ground_truth_path = "/Users/sephon/Desktop/Research/VizioMetrics/Corpus/Phylogenetic/CNN_corpus/TreeRipper_dataset/TreeRipper_multi_dataset.csv"
ground_truth_unfix_path = "/Users/sephon/Desktop/Research/VizioMetrics/Corpus/Phylogenetic/CNN_corpus/TreeRipper_dataset/TreeRipper_multi_dataset_unfix.csv"
cou... | StarcoderdataPython |
3323035 | #!/usr/bin/env python
"""
parse.py - replace simple yaml values
Usage:
parse.py [-h] --file filename.yaml [--dry-run] --key-val a.b.c=val
Options:
-h, --help show this help message and exit
--file filename.yaml replace in this YAML file
--dry-run Don't replace in file, just prin... | StarcoderdataPython |
5113675 | Register =\
{
"firstname_textbox": "css:#basicBootstrapForm > div:nth-child(1) > div:nth-child(2) > input",
"lastname_textbox": "#basicBootstrapForm > div:nth-child(1) > div:nth-child(3) > input",
"address_textbox": "#basicBootstrapForm > div:nth-child(2) > div > textarea",
"email_textbox": "#eid > in... | StarcoderdataPython |
6655840 | <reponame>XiaoshengLin/shadow3
from __future__ import print_function
import Shadow.ShadowLibExtensions as sd
import numpy
import os
import socket
import getpass
import datetime
try:
import matplotlib.pyplot as plt
import matplotlib
except:
pass
class ArgsError(Exception):
def __init__(self,value):
self.v... | StarcoderdataPython |
46317 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright(c) 2019 Nippon Telegraph and Telephone Corporation
# Filename: NVRDriverCLIProtocol.py
import traceback
import re
import GlobalModule
from EmCommonLog import decorater_log
from CgwshDriverCLIProtocol import CgwshDriverCLIProtocol
class NVRDriverCL... | StarcoderdataPython |
5117956 | <filename>data_describe/_widget.py
from abc import ABC, abstractmethod
class BaseWidget(ABC):
"""Interface for collecting information and visualizations for a feature.
A "widget" serves as a container for data, diagnostics, and other outputs
(i.e. DataFrames, plots, estimators etc.) for a feature in data... | StarcoderdataPython |
3413519 | # encoding: utf-8
from .cuhk03 import CUHK03
from .dukemtmcreid import DukeMTMCreID
from .market1501 import Market1501
from .msmt17 import MSMT17
from .veri import VeRi
from .aicity20 import AICity20
from .aicity20_sim import AICity20Sim
from .aicity20_trainval import AICity20Trainval
from .aicity20_ReOri import AICity... | StarcoderdataPython |
233161 | import torch
from transformers import BertModel, BertTokenizer
from bert_ner.aux import bioes_classes, clean_tuples
from bert_ner.aux import create_data_from_sentences, batchify_sentences
from bert_ner.model import NERModel
def clean_labels(output_labels):
return [item[2:] if item not in ['OTHER', '[CLS]'] else ... | StarcoderdataPython |
99996 | <gh_stars>10-100
"""PyTest configuration module."""
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import base64
import json
import os
import zlib
import numpy as np
import pytest
from scenepic import Color
def _asset(name):
if name.endswith(".json"):
path = os.path.join(os.pa... | StarcoderdataPython |
5141750 | from django.conf import settings
from django.dispatch import Signal
from django.http import HttpResponseRedirect
from ..base_client import FrameworkIntegration, RemoteApp
from ..requests_client import OAuth1Session, OAuth2Session
from deming.models import OauthClient
token_update = Signal()
class DjangoIntegration(... | StarcoderdataPython |
9625360 | """Finds the best option for the next waypoint."""
import geopandas as gpd
import shapely.geometry as sp
from matplotlib import pyplot as plt
from path_finding.path_finder import _find_intersection_to_destination
from path_finding.path_finder import _generate_waypoint_choices
from path_finding.path_finder import _get_b... | StarcoderdataPython |
11311026 | <gh_stars>1-10
from distutils.core import setup
setup(
name = 'blissops',
packages = ['blissops'],
version = '0.1',
license='MIT',
description = 'Simple BytesIO based image manipulation library. No hard work and no good results.',
author = 'Liam (ir-3) H.',
author_email = '<EMAIL>',
url = 'https://githu... | StarcoderdataPython |
1831673 | from flask import Blueprint
from flask_restful import Api
from . import resources
bp = Blueprint("users", __name__)
api = Api(bp)
api.add_resource(resources.Users, "/users")
api.add_resource(resources.UsersId, "/users/<user_id>")
| StarcoderdataPython |
3598705 | from thesis import config
from thesis.experiments import pg_time_train_iter_cc
from thesis.runner import runner
conf = pg_time_train_iter_cc.make_conf("pippo")
conf, *_ = pg_time_train_iter_cc.doconfs(conf, config.data_dir)
run = runner.build_runner(conf, config.scratch_data_dir)
ag = run.agent
ag.train(ag.sample_me... | StarcoderdataPython |
3379085 | import argparse
from cocojson.tools import split_from_file
def main():
ap = argparse.ArgumentParser()
ap.add_argument('cocojson', help='Path to coco.json to chop up', type=str)
ap.add_argument('--ratios', help='List of ratios to split by', type=float,required=True, nargs='+')
ap.add_argument('--names'... | StarcoderdataPython |
5076574 | <reponame>Dineth-De-Silva/CSV
import os
class csv:
def __init__(self, FileName):
self.FileName = FileName
def write(self, Data):
File = open(self.FileName + ".csv", "w")
if isinstance(Data, list):
for Element in Data:
if isinstance(Element, list):
... | StarcoderdataPython |
40645 | import django
# Now this is ugly.
# The django.db.backend.features that exist changes per version and per db :/
if django.VERSION[:2] == (2, 2):
has_sufficient_json_support = ('has_jsonb_agg',)
if django.VERSION[:2] == (3, 2):
# This version of EasyDMP is not using Django's native JSONField
# implementatio... | StarcoderdataPython |
9664730 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server import util
class Model(Model):
"""NOTE: This class is auto generated by the swagger code ... | StarcoderdataPython |
3573122 | from django.db import models
from django.contrib.auth import get_user_model
class Friend(models.Model):
"""This is a model to build relationships between users"""
# the user doing the following
user_from = models.ForeignKey(
get_user_model(),
related_name='rel_from_set',
on_delete... | StarcoderdataPython |
11227814 | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""OCP-on-Azure Report Serializers."""
from rest_framework import serializers
import api.report.azure.serializers as azureser
import api.report.ocp.serializers as ocpser
from api.report.serializers import validate_field
class OCPAzureGroupBySeri... | StarcoderdataPython |
3499907 | # Copyright (c) 2018 Anki, Inc.
#
# 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 in the file LICENSE.txt or at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | StarcoderdataPython |
1847900 | # -*- coding: utf-8 -*-
from builtins import str
from flask import render_template,g
from flask_mail import Message
from cineapp import mail, db
from cineapp.models import User
from threading import Thread
from cineapp import app
import html2text, time, json, traceback
# Send mail into a dedicated thread in order to ... | StarcoderdataPython |
7010 | <filename>util.py
import numpy as np
import pandas as pd
from skimage import io
import skimage.measure as measure
import os
from lpg_pca_impl import denoise
def getNoisedImage(originalImage, variance):
# return random_noise(originalImage, mode='gaussian', var=variance)
np.random.seed(42)
noise = np.random... | StarcoderdataPython |
6468862 | <reponame>jnthn/intellij-community
from b import f
def g():
return f() | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.