id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
6523286 | import webbrowser
def open(keyword):
url = 'https://www.google.co.jp/search?q='+keyword.replace(' ','+')+'&source=lnms&tbm=isch'
webbrowser.open(url,autoraise=True) | StarcoderdataPython |
4919860 | <reponame>bambielli-flex/dagster
import pytest
from dagster import (
DagsterInvariantViolationError,
DagsterResourceFunctionError,
RunConfig,
execute_pipeline,
)
from dagster_examples.toys.many_events import define_many_events_pipeline
from dagster_examples.toys.resources import define_resource_pipelin... | StarcoderdataPython |
1907156 | <filename>tests/test_helpers.py<gh_stars>1-10
# -*- coding: utf-8 -*-
import pytest
from .context import runtimedocs
@pytest.mark.parametrize('value,expected_type', [
(1, "<class 'int'>"),
('a', "<class 'str'>"),
(lambda:None, "<class 'function'>"),
([], "<class 'list'>"),
((1,), "<class 'tuple'... | StarcoderdataPython |
11330709 | <gh_stars>0
import string
import regex
from collections import deque
from flanker.mime.message.headers import encodedword, parametrized
from flanker.mime.message.headers.wrappers import ContentType, WithParams
from flanker.mime.message.errors import DecodingError
from flanker.utils import is_pure_ascii
MAX_LINE_LENGTH... | StarcoderdataPython |
3372138 | <gh_stars>0
import copy
from datetime import datetime
import logging
from typing import Iterator, Union, Optional, Tuple
import gridfs
from pymongo import MongoClient, ASCENDING
from bson import ObjectId
from ted_sws import config
from ted_sws.core.model.manifestation import XMLManifestation, RDFManifestation, METSMan... | StarcoderdataPython |
12859652 | from django.contrib import admin
from .models import Image,Areas,Category
# Register your models here.
admin.site.register(Image)
admin.site.register(Areas)
admin.site.register(Category) | StarcoderdataPython |
6601703 | #!/usr/bin/env python
__FILENAME__="powershell.py"
__AUTHOR__="<NAME>"
__VERSION__="1.1.1"
__COPYRIGHT__="Copyright (c) 2018-2021 %s" % (__AUTHOR__)
__LICENSE__="MIT License (https://dwettstein.mit-license.org/)"
__LINK__="https://github.com/dwettstein/PythonStuff"
__DESCRIPTION__=(
"This module contains utility fu... | StarcoderdataPython |
3222401 | from guizero import App, TextBox, PushButton, Text, alerts
from tkinter.font import Font
def go():
alerts.info("hi", "hi " + textbox.value)
app = App()
text = Text(app, text="Enter your name")
textbox = TextBox(app)
button = PushButton(app, text="Hi", command=go)
app.display() | StarcoderdataPython |
9789985 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Parse FIO output:
'''
import os
import argparse
import rex
import prettytable
def parse_fio_file(filename, verbose=False):
'''
Parse the FIO output and return a
dict
'''
job_pattern = r"job.*rw=(w:<type>).*bs=(w:<blocksize>)-.*" \
"ioengi... | StarcoderdataPython |
9660843 | <filename>json2tree/__main__.py
import argparse
import logging
import os
import sys
from json2tree.theme_1 import html as html_1
from json2tree.theme_2 import html as html_2
import json
def readJSON(file_path, theme):
f = open(file_path)
json_data = json.load(f)
html_string = ''
if(theme=='1'):
... | StarcoderdataPython |
324538 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This module is also sponsored by E.T.A.I. (www.etai.fr)
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ver... | StarcoderdataPython |
381098 | from aiohttp import ClientSession
import pytest # noqa: F401
import pytest_asyncio.plugin # noqa: F401
import aiohttp_github_helpers as h
TEST_OWNER = "metwork-framework"
TEST_REPO = "testrepo"
@pytest.mark.asyncio
async def test_github_get_labels_on_issue():
async with ClientSession() as client_session:
... | StarcoderdataPython |
8162665 | for _ in range(int(input())):
l = input().split()
r = float(l[0])
for i in l[1:]:
if i == '@':
r *= 3
elif i == '%':
r += 5
elif i == '#':
r -= 7
print("{:.2f}".format(r))
| StarcoderdataPython |
9765510 | import pytest
from app.html.block_builder import BlockBuilder, HeadingBuilder, QuoteBuilder, ListBuilder, ListItemBuilder, \
CodeBlockBuilder, HorizontalRuleBuilder
from app.converter.converter import Converter
from app.element.block import CodeBlock
from app.markdown.block_parser import BlockParser, HeadingParser... | StarcoderdataPython |
1934702 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | StarcoderdataPython |
5037060 | <filename>src/feat/utils.py
"""
Utility functions for MEGAN featurization
"""
from typing import Tuple
from rdkit import Chem
from rdkit.Chem.rdchem import Mol
import numpy as np
from src.feat.graph_features import try_get_atom_feature
from src.feat import ATOM_EDIT_TUPLE_KEYS
def fix_incomplete_mappings(sub_mol: M... | StarcoderdataPython |
1779346 | import datetime
from lib.model.database.Database import Database
from sqlalchemy import Column, Integer, String, Date, DateTime, ForeignKey
Base = Database.get_declarative_base()
class AntiEmulator(Base):
__tablename__ = 'anti_emulator'
id = Column(Integer, primary_key=True)
property = Column(String)
... | StarcoderdataPython |
8013373 | <filename>anima/ui/ui_compiled/choose_from_list_dialog_UI_pyqt4.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_files\choose_from_list_dialog.ui'
#
# Created: Thu May 04 11:01:53 2017
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
... | StarcoderdataPython |
8162838 |
from flask import Flask, request
import pandas as pd
import numpy as np
import os, sys, json, pickle
app = Flask(__name__)
"""Load Model and Scalar files"""
model_file_path = os.path.join(os.path.pardir, os.path.pardir, 'models', 'lr_model.pkl')
scalar_file_path = os.path.join(os.path.pardir, os.path.pardir, 'models... | StarcoderdataPython |
8191623 | <reponame>albertvisser/filefindr
"""Gui-toolkit onafhankelijke code t.b.v. Afrift applicaties
opgezet als classes die de toolkit-dependent code aanroepen als methodes op een attribuut ervan
ze worden geïmporteerd via een aparte module die bepaalt welke toolkit er gebruikt wordt
"""
import os
import collections
import... | StarcoderdataPython |
6671367 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
from contextlib import contextmanager
LOG = logging.getLogger(__name__)
class HealthCheckError(Exception):
def __init__(self, service, extra_message=None):
msg = "HealthCheckError: Service {} is experiencing issues.".format(
... | StarcoderdataPython |
3317782 | def read_file():
file_name = input("Введите имя файла(по умолчанию referat.txt): ") or "referat.txt"
with open(file_name, 'r', encoding='utf-8') as var:
content = var.read()
return content
with open('referat.txt', 'r', encoding='utf-8') as var01:
result = var01.read()
print('Длинна стр... | StarcoderdataPython |
8020702 | <reponame>jt7960/PFRScraper
##IMPORTS##
import requests
from bs4 import BeautifulSoup as bs
import re
import pyodbc
import pandas as pd
##DATABASE CONNECTION##
#1 establish connection to the database
#2 create a cursor (which facilitates db transactions)
cnxn = pyodbc.connect('DSN=NFLStats;') # This requires valid dat... | StarcoderdataPython |
11336146 | #!/usr/bin/python3
"""Filter from hsv image to black-white image by color thesholds"""
import cv2
import numpy as np
def cv2_hsv_color_range_filter(hvs_image, filter_parameters):
"""HVS color range filter"""
if "lower_color" not in filter_parameters or "upper_color" not in filter_parameters:
raise Val... | StarcoderdataPython |
4981097 | import model
import http.client
class HTTPUnexpected(Exception):
"""Raised whenever an unexpected response is encountered."""
def __init__(self, status: int, error: str | None = None) -> None:
message = error or f"Endpoint returned HTTP {status} {http.client.responses[status]}."
super().__init... | StarcoderdataPython |
6576210 | import torch
import torch.nn as nn
import torch.nn.functional as F
# module for childsumtreelstm
class ChildSumTreeLSTM(nn.Module):
def __init__(self, in_dim, mem_dim):
super().__init__()
self.in_dim = in_dim
self.mem_dim = mem_dim
self.ioux = nn.Linear(self.in_dim, 3 * self.mem_d... | StarcoderdataPython |
6579100 | import random
from blackjack.models import Card
class Deck:
"""Represents a deck of playing cards"""
def __init__(self) -> None:
self.new_deck()
@property
def cards(self) -> list[Card]:
"""The cards in the deck."""
return self._cards
def new_deck(self) -> None:
... | StarcoderdataPython |
11370576 | <filename>src/engine.py
import torch
import torchvision.transforms as T
from torch.utils.data import DataLoader
from train import *
from val import *
from model import *
from evaluation_metrics import *
from datasets import *
# collate_fn is called with a list of data samples at each time.
# It is expected t... | StarcoderdataPython |
398209 | <reponame>revl/pants
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.base.exceptions import TargetDefinitionException, TaskError
from pants.base.workunit import WorkUnitLabel
from pants.task.testrunner_task_mixin import TestR... | StarcoderdataPython |
1717377 | import json
import logging
import maven_dependency_utils
import os
import re
import shutil
import subprocess
import sys
import time
desired_sdk = os.getenv("ANDROID_SDK_ROOT")
if not desired_sdk:
logging.error("Environment variable ANDROID_SDK_ROOT must be set.")
exit(-1)
if os.getenv("ANDROI... | StarcoderdataPython |
4993869 | <filename>c_elegans_wiring/sub_modules/api/api_alpha.py<gh_stars>1-10
import c_elegans_wiring.sub_modules.graph.path_finder as path_finder
import c_elegans_wiring.sub_modules.graph.graph_builder as graph_builder
def build_main_cell_graph(cell_graph_obj, df_list, from_classes_list, to_classes_list):
return graph_b... | StarcoderdataPython |
6596164 | from django.contrib import admin
from .models import Block, BlockTemplate
class BlockAdmin(admin.ModelAdmin):
list_display = ('context', 'weight', 'template', 'site', )
list_filter = ('site', )
class BlockTemplateAdmin(admin.ModelAdmin):
list_display = ('name', 'markup', 'site', )
list_filter = ('s... | StarcoderdataPython |
6466500 | <filename>prompt_tuning/data/qa.py
# Copyright 2022 Google.
#
# 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 applicabl... | StarcoderdataPython |
9739253 | <gh_stars>0
#!/usr/bin/python3
from nlp.universal_dependencies import ParsedUniversalDependencies
from services.assistant_services_base import AssistantServicesBase
from .skill import SkillInput, Skill
class TellScheduleSkill(Skill):
"""Lets the assistant tell the user their schedule."""
def __init__(self):
... | StarcoderdataPython |
4830049 | <reponame>qiangzai00001/hio-prj
#!/usr/bin/python -tt
#
# Copyright (c) 2013 Intel, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; version 2 of the License
#
# This program is distribute... | StarcoderdataPython |
375182 | def miniMaxSum(arr):
arr.sort()
print(sum(arr[:-1]), sum(arr[1:]))
| StarcoderdataPython |
11258373 | import os
import sys
from tqdm import tqdm
from tensorboardX import SummaryWriter
import shutil
import argparse
import logging
import time
import random
import numpy as np
import torch
import torch.optim as optim
from torchvision import transforms
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
fr... | StarcoderdataPython |
6642966 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('etl', '0019_auto_20170328_1519'),
]
operations = [
migrations.AlterField(
model_name='featureprocess... | StarcoderdataPython |
6591633 | import unittest
from elote import ECFCompetitor
class TestECF(unittest.TestCase):
def test_Improvement(self):
initial_rating = 100
player1 = ECFCompetitor(initial_rating=initial_rating)
# if player1 beats someone with a high rating, their rating should go up.
for _ in range(10):
... | StarcoderdataPython |
3385794 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: <NAME>
# GitHub: https://github.com/SwordYork/sequencing
# No rights reserved.
#
import sequencing_np as snp
import tensorflow as tf
from sequencing import TIME_MAJOR
from sequencing.data.vocab import Vocab
from sequencing.decoders.feedback import Training... | StarcoderdataPython |
6422347 | """
---> Greatest Sum Divisible by Three
--> Medium
"""
import math
class Solution:
def maxSumDivThree(self, nums) -> int:
total = 0
rem1 = [math.inf, math.inf]
rem2 = [math.inf, math.inf]
for num in nums:
if num % 3 == 1:
if num < rem1[0]:
... | StarcoderdataPython |
377046 | """The base interface for all services."""
import enum
class ServiceState(enum.Enum):
"""The enum defining service states."""
ACTIVE = "active"
INACTIVE = "inactive"
FAILED = "failed"
@classmethod
def from_value(cls, value):
"""Return an instance of ServiceState that matches the give... | StarcoderdataPython |
3424809 | from functools import reduce
from dateutil.parser import parse
from django.db.models import Case, Count, F, IntegerField, Manager, Max, Sum, When
from kolibri.auth.models import FacilityUser
from kolibri.content.content_db_router import default_database_is_attached, get_active_content_database
from kolibri.content.mod... | StarcoderdataPython |
4973860 | <reponame>Faudil/music_generator<gh_stars>0
import numpy as np
class Markov_elem:
def __init__(self, word):
self._word = word
self._followings = []
self._following_nbr = []
self._following_proba = []
def add_following(self, following_word):
if following_word in self._fo... | StarcoderdataPython |
176350 | <reponame>NYPL/NYPL-Tenable-Jira
import sqlite3 #SQLite DB
from src.config import Config #Config load
configInformation = Config()
scanNameList = configInformation.getTenableScanName()
connection = sqlite3.connect(r"..\databases\Tenable_DB.db")
cursor = connection.cursor()
cursor.execute("SELECT name from sqlite_maste... | StarcoderdataPython |
5090637 | #!/usr/bin/env python
import snmp_helper
if True:
IP = "192.168.127.12"
a_user="pysnmp"
auth_key = "galileo1"
encrypt_key= "galileo1"
snmp_user = (a_user, auth_key, encrypt_key)
pynet_rtr1 = (IP, 7961)
pynet_rtr2 = (IP, 8061)
snmp_oids = (
("ifInOctets", "1.3.6.1.2.1.2.2.1.10.5", True),
("ifOut... | StarcoderdataPython |
1674108 | <filename>learn_python/numbers-strings.py
# -*- coding: utf-8 -*-
# !/usr/bin/env python3
# Created on Fri Oct 27 19:49:29 2017
# @author: gaiusyao
from math import exp, log, sqrt
print("Hello world")
hello_world = "Hello world"
print(hello_world)
hello_world = "Hello Python world"
print(hello_world)
# int
x = 42
p... | StarcoderdataPython |
1669462 | #!/usr/bin/python
from pathlib import Path
import datetime
now = datetime.datetime.now()
year = now.year
month = now.month
name = input('Enter article name:')
path1 = Path('articles') / str(year) / str(month)
path1.mkdir(parents=True, exist_ok=True)
path2 = path1 / f'{name}.txt'
path2.touch()
print(f'Article cr... | StarcoderdataPython |
6617355 | <gh_stars>1-10
import microtest
from auth_server.extensions import orm
from auth_server.models import User
import auth_server.security as security
@microtest.setup
def setup(app):
global ctx
ctx = app.app_context()
ctx.push()
@microtest.reset
def reset():
User.query.delete()
@microtest.cleanup... | StarcoderdataPython |
11300191 | # -*- coding:utf-8 -*-
import django
from .views import UploadView
if django.VERSION[0] > 1:
from django.urls import re_path as url_func
else:
from django.conf.urls import url as url_func
urlpatterns = [
url_func(r'^uploads/$', UploadView.as_view(), name='uploads'),
] | StarcoderdataPython |
1919590 | #!/bin/env python
import argparse
import logging
import sys
import shutil
from pathlib import Path, PurePath
def read_commit(wkspc_dir) -> str:
"""
read and return the value
in the commit file
:param wkspc_dir: jenkins workspace dicrectory
:return: commit tag value
"""
commit = 'false'
... | StarcoderdataPython |
9711095 | #! /usr/bin/env python3
# coding: utf-8
from tkinter import Tk, Label, Button, StringVar, Entry, Toplevel, \
messagebox, ttk
from tkinter import *
import tkinter as tk
from database import *
import json
from api import *
from wproduct_sheet import *
class Wsearch_substitute():
# This class is used to search p... | StarcoderdataPython |
11288592 | import faulthandler
import atexit
import signal
import traceback
import os
import multiprocessing
# To test with doctest...
if not __package__: # pragma: no cover
LIB_PATH = "."
else:
from .. import LIB_PATH
# Global configuration
DUMP_DIRECTORY = LIB_PATH + "/dump/"
DUMP_CURRENT_PROCESS = DUMP_DIRECTORY + ... | StarcoderdataPython |
5011522 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright 2014 Telefónica Investigación y Desarrollo, S.A.U
#
# This file is part of FI-WARE project.
#
# 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 th... | StarcoderdataPython |
1840275 | <reponame>MaciejZurek/python_practicing
from poker.validators import (
RoyalFlushValidator,
StraightFlushValidator,
FourOfAKindValidator,
FullHouseValidator,
FlushValidator,
StraightValidator,
ThreeOfAKindValidator,
TwoPairValidator,
PairValidator,
HighCardValidator,
NoCards... | StarcoderdataPython |
9799664 | #!/usr/bin/python
"""
Temperature & Humidity class
"""
import array
import time
import io
import fcntl
I2C_SLAVE = 0x0703
HTU21D_ADDR = 0x40 # HTU21D default address.
CMD_READ_TEMP_HOLD = "\xE3"
CMD_READ_HUM_HOLD = "\xE5"
CMD_READ_TEMP_NOHOLD = "\xF3"
CMD_READ_HUM_NOHOLD = "\xF5"
CMD_WRITE_USER_REG = "\xE6"
CMD_READ... | StarcoderdataPython |
9779317 | <reponame>robzim/isilon_sdk_python
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 3
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noq... | StarcoderdataPython |
1737133 | <filename>homeassistant/components/august/__init__.py<gh_stars>1-10
"""Support for August devices."""
import asyncio
from datetime import timedelta
from functools import partial
import logging
from august.api import Api, AugustApiHTTPError
from august.authenticator import AuthenticationState, Authenticator, Validation... | StarcoderdataPython |
4915689 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Sun Feb 19 13:53:24 2012
import wx
# begin wxGlade: extracode
from pyoptools.gui.glplotframe import glCanvas
# end wxGlade
class OGLFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: OGLFrame.__init__
... | StarcoderdataPython |
3231139 | # Copyright Contributors to the Rez project
#
# 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 ... | StarcoderdataPython |
9781426 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
I am a support module for making SOCKSv4 servers with twistd.
"""
from twisted.protocols import socks
from twisted.python import usage
from twisted.application import internet
import sys
class Options(usage.Options):
synopsis = "[-i <i... | StarcoderdataPython |
1970022 | """CHAPTER 30
WIND LOADS: COMPONENTS AND CLADDING
"""
from types import SimpleNamespace
from asce7.common import Deg, Log
#############################################################
# 30.3.2 Design Wind Pressures
#############################################################
def eq30p3d1_GCp_interpolant(figure):
... | StarcoderdataPython |
1838964 | from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
return render(request, "index.html")
#登录动作
def login_action(request):
if request.method == 'POST':
username = request.POST.get('username', '')
password = request.POST.get('password', '')
if u... | StarcoderdataPython |
1955538 | <reponame>skyscooby/sahasrahbot
import os
from alttprbot.alttprgen.preset import get_preset
from alttprbot.tournament.core import TournamentConfig
from alttprbot_discord.bot import discordbot
from .sglcore import SGLRandomizerTournamentRace
class SMZ3(SGLRandomizerTournamentRace):
async def configuration(self):
... | StarcoderdataPython |
5178905 | <gh_stars>1-10
"""
(c) Copyright Fair Isaac Corporation 2017. 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... | StarcoderdataPython |
274624 | __author__ = 'filiph'
| StarcoderdataPython |
3559763 |
def output(s,l):
if l == 0:
return
print (s[l-1])
output(s,l-1)
i = raw_input('input:')
l = len(i)
print output(i,l) | StarcoderdataPython |
8017721 | import itertools
#产生指定数目的元素的所有排列(顺序有关)
x = itertools.permutations(range(4),3)
print(list(x))
"""
[(0, 1, 2), (0, 1, 3), (0, 2, 1), (0, 2, 3), (0, 3, 1), (0, 3, 2), (1, 0, 2), (1, 0, 3), (1, 2, 0), (1, 2, 3), (1, 3, 0), (1, 3, 2), (2, 0, 1), (2, 0, 3), (2, 1, 0), (2, 1, 3), (2, 3, 0), (2, 3, 1), (3, 0, 1), (3, 0, 2),... | StarcoderdataPython |
4823938 | <reponame>ChristopherMayes/xopt
import logging
from concurrent.futures import Executor
from typing import Dict, Optional, Callable
import torch
from botorch.utils.sampling import draw_sobol_samples
from ..data import gather_and_save_training_data, get_data_json
from ..generators.generator import BayesianGenerator
fro... | StarcoderdataPython |
12864982 | # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and
# other Shroud Project Developers.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (BSD-3-Clause)
#
########################################################################
"""
Generate a module for classes using PyBi... | StarcoderdataPython |
6654659 | <gh_stars>10-100
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2012, <NAME> <<EMAIL>>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyr... | StarcoderdataPython |
1748496 | <filename>src/gui2.py
import sys
import re
import PyQt5.QtWidgets as qt
from pathlib import Path
from PyQt5 import QtCore
from PyQt5.QtGui import QPixmap
class PredictDXA(qt.QWidget):
'''
GUI to predict.py
'''
def __init__(self):
super().__init__()
self.init_ui()
self.in_folder ... | StarcoderdataPython |
6658412 | <reponame>xianjunzhengbackup/Cloud-Native-Python
/usr/local/lib/python3.6/_collections_abc.py | StarcoderdataPython |
3420552 | # Copyright (c) 2020 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the S... | StarcoderdataPython |
6562463 | # -*- coding: utf-8 -*-
"""
jctl
Command line tool to use Python-Jamf
"""
pass | StarcoderdataPython |
8022456 | class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def sumOfLeftLeaves(root):
def sumOfLeftLeavesHelper(root, isLeft):
if root == None:
return 0
else:
hasLeftChild = root.left != None
hasRigh... | StarcoderdataPython |
3512725 | <reponame>dfunckt/django-connections<gh_stars>10-100
#!/usr/bin/env python
from os.path import dirname, join
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from connections import VERSION
def get_version(version):
assert len(version) == 5
assert version[3] in ... | StarcoderdataPython |
3362153 | <reponame>yetingli/ReDoS-Benchmarks<gh_stars>1-10
# 225
# (<[^>]*?tag[^>]*?(?:identify_by)[^>]*>)((?:.*?(?:<[ \r\t]*tag[^>]*>?.*?(?:<.*?/.*?tag.*?>)?)*)*)(<[^>]*?/[^>]*?tag[^>]*?>)
# EXPONENT
# nums:4
# EXPONENT AttackString:"<tagidentify_by>"+"<tag</!tag</>"*2+"! _1_EOA(i or ii)"
import re
from time import perf_count... | StarcoderdataPython |
5010773 | """This module wraps the :class:`Socket` and :class:`Context` found in :mod:`pyzmq <zmq>` to be non blocking
"""
import zmq
from zmq import *
from zmq import devices
__all__ = zmq.__all__
import gevent
from gevent import select
from gevent.event import AsyncResult
from gevent.hub import get_hub
class GreenSocket(Soc... | StarcoderdataPython |
1783729 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# vim: fenc=utf-8
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
#
"""
File name: foop.py
Version: 0.1
Author: dhilipsiva <<EMAIL>>
Date created: 2015-05-15
"""
__author__ = "dhilipsiva"
__status__ = "development"
"""
"""
class Foo(object):
def baz(sel... | StarcoderdataPython |
1710032 | from django.conf.urls import url
from views import calendar
urlpatterns = [
url(
# ### Views of calendar ###
r'^all$',
calendar.AllEvents.as_view()
)
]
| StarcoderdataPython |
12827823 | """
Unittests checking the initialization of the ``MockServer`` class and evaluation of the config passed to it.
"""
from unittest.mock import patch
import pytest
from server_double.server import Endpoint, MockServer
def test_port():
server = MockServer(config={"port": 8083})
assert server.port == 8083
@p... | StarcoderdataPython |
4900204 | <reponame>HaoranDennis/pandapower
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2019 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import pandas as pd
import pytest
import pandapower as pp
import pandapower.shortcircuit as sc
... | StarcoderdataPython |
12846497 | <filename>util/vis_tool.py
import os.path as osp
import matplotlib.pyplot as plt
import numpy as np
import cv2
class VisualUtil:
def __init__(self, dataset):
self.dataset = dataset
# RED BGR
self.color_pred = [(0,0,102), (0,0,179), (0,0,255), (77,77,255), (153,153,255)]
# self.colo... | StarcoderdataPython |
1809211 | <reponame>yehonatanz/konst<gh_stars>0
def test_string():
from konst.string import A
assert A == 'A'
def test_string_preserve_case():
from konst.string import mixedCase
assert mixedCase == 'mixedCase'
| StarcoderdataPython |
6550784 | <gh_stars>1-10
"""
Progress Tab Serializers
"""
from datetime import datetime
from rest_framework import serializers
from rest_framework.reverse import reverse
from pytz import UTC
from lms.djangoapps.course_home_api.serializers import ReadOnlySerializer, VerifiedModeSerializer
class CourseGradeSerializer(ReadOnlyS... | StarcoderdataPython |
3303002 | from frappe import _
def get_data():
return {
'fieldname': 'trip_order',
'transactions': [
{
'label': _('Fulfillment'),
'items': ['Sales Invoice', 'Delivery Note']
},
{
'label': _('Purchasing'),
'items': ['Material Request', 'Purchase Order']
},
{
'label': _('Projects'),
'it... | StarcoderdataPython |
5006 | """
Module for plotting analyses
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from copy import deepcopy
import pickle, json
import os
from matplotlib.offsetbox import AnchoredOffsetbox
try:
basestring
except NameError:
basestring = str
colorList = [[0.42, 0.67, 0.84], [0.... | StarcoderdataPython |
3402659 | <filename>sarif_om/_logical_location.py
# This file was generated by jschema_to_python version 1.2.3.
import attr
@attr.s
class LogicalLocation(object):
"""A logical location of a construct that produced a result."""
decorated_name = attr.ib(default=None, metadata={"schema_property_name": "decoratedName"})
... | StarcoderdataPython |
6474124 | <gh_stars>0
# -*- encoding: utf-8 -*-
"""
MIT License
Copyright (c) 2019 - present AppSeed.us
"""
from django.db import models
from django.contrib.auth.models import User
from django.contrib.postgres.fields import ArrayField
# Create your models here.
class Users(models.Model):
pass
class Buildings(models.Mo... | StarcoderdataPython |
8108359 | <reponame>allenalvin333/Hackerrank_Interview
# Udaan Preliminary Test
database = {} # User is key, appointment is value
for T in range(int(input())):
l = list(input().split())
if(l[0]=="add-user"): # Input Command Taken
if(l[1] in database): print("failure")
... | StarcoderdataPython |
9667880 | <reponame>RalphWalters/thredo
# Example 3
#
# Cancelling a thread
import thredo
def hello(sec):
print("Yawn")
try:
thredo.sleep(sec)
print("Awake")
except thredo.ThreadCancelled:
print("Cancelled!")
def main():
t = thredo.spawn(hello, 100)
thredo.sleep(5)
t.cancel()
... | StarcoderdataPython |
8108960 | <reponame>liquidinstruments/pymoku
import math
import logging
import warnings
from pymoku._instrument import to_reg_unsigned
from pymoku._instrument import from_reg_unsigned
from pymoku._instrument import to_reg_signed
from pymoku._instrument import from_reg_signed
from pymoku._instrument import deprecated
from pymok... | StarcoderdataPython |
8055181 | <reponame>mismaah/dhivehi-nlp
import unittest
from dhivehi_nlp import trigram_similarity
class test_trigram_similarity(unittest.TestCase):
def test_generate_trigram(self):
result = {
" ބ",
" ބަ",
"ބަޔ",
"ަޔަ",
"ޔަކ",
"ަކު",
... | StarcoderdataPython |
3288658 | <reponame>databyjp/asset_correlation_analysis
# ========== (c) <NAME> 16/3/21 ==========
import logging
import pandas as pd
import numpy as np
import utils
import scipy.stats
import plotly.express as px
logger = logging.getLogger(__name__)
desired_width = 320
pd.set_option('display.max_columns', 20)
pd.set_option('... | StarcoderdataPython |
1668412 | <reponame>AZMAG/smartpy_sim_indicators
from __future__ import division, print_function
import gc
import numpy as np
import pandas as pd
import orca
from smartpy_core.wrangling import broadcast
def clear_cache(table_name, columns=None):
"""
Manually clears cached columns. If no column(s)
are provided th... | StarcoderdataPython |
20901 | import sys
import time
from tia.trad.tools.io.follow import followMonitor
import tia.configuration as conf
from tia.trad.tools.errf import eReport
import ujson as json
import matplotlib.pyplot as plt
import math
import collections
import logging
from tia.trad.tools.ipc.processLogger import PROCESS_NAME
LOGGER_NAME = P... | StarcoderdataPython |
11352923 | # By <NAME>
# <EMAIL>
# Honeybee started by <NAME> is licensed
# under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
"""
This component [removes | updates] Honeybee components from [grasshopper | a source folder]
-
Provided by Honeybee 0.0.55
Args:
sourceDirectory_: Optional address to a... | StarcoderdataPython |
3574780 | <filename>scoring.py<gh_stars>0
def count_common_tags(tags_list1, tags_list2):
"""
:param tags_list1: The first list of tags
:param tags_list2: The second list of tags
:return: The number of tags in common between these 2 slides
"""
common_tags_cpt = 0
tags_List1_tmp = tags_List2_t... | StarcoderdataPython |
8192583 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright © 2014, 2015 OnlineGroups.net and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany ... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.