id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
4887036 | <filename>Normalization/NLTKNormalization.py
#!/usr/bin/python3
# Created by MikBac on 2020
import unicodedata
try:
from .NGram.NGram import getNGramTuples
except:
from NGram.NGram import getNGramTuples
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
from nltk.stem import WordNetLemmatizer
f... | StarcoderdataPython |
5149116 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contacts', '0003_auto_20150904_2018'),
... | StarcoderdataPython |
5136581 | <filename>WEEKS/CD_Sata-Structures/_RESOURCES/python-prac/mini-scripts/python_Rounding_Decimals__fix.txt.py
import numpy as np
arr = np.fix([-3.1666, 3.6667])
print(arr)
| StarcoderdataPython |
1647480 | <filename>src/utils/pyutils.py<gh_stars>1-10
"""
Python utils, reusable chunks etc.
"""
from typing import List, Union
import sys
import os
import time
import numpy as np
import logging
def rprint(value):
"""Similar to print function but overwrites last line.
Parameters
----------
value
Valu... | StarcoderdataPython |
3229948 | <filename>PycharmProjects/Cursoemvideo/exe082.py<gh_stars>0
numeros = []
par = []
impar = []
while True:
numeros.append(int (input ('DIGITE UM NUMERO: ')))
resp = str (input ('DESEJA CONTINUAR [S/N]: ')).upper()
if resp == 'N':
break
print (f'A LISTA COMPLETA É {numeros}')
for i, v in enumerate(nume... | StarcoderdataPython |
1903035 | <filename>demo/demo_poc.py
"""
The intention of this script is to provide a demonstration of how ConFlowGen is supposed to be used as a library.
It is, by design, a stateful library that persists all input in an SQL database format to enable reproducibility.
The intention of this demo is further explained in the logs i... | StarcoderdataPython |
1811382 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.SingleDynamicData import SingleDynamicData
class AlipaySocialBaseMessageDynamicicondataModifyModel(object):
def __init__(self):
self._biz_id = None
self._op_d... | StarcoderdataPython |
56392 | <reponame>deepest-stack/graph2tensor
# coding=utf-8
import numpy as np
from setuptools import find_packages, setup, Extension
sampler = Extension('graph2tensor.client.sampler',
include_dirs=[np.get_include(), ],
extra_compile_args=['-std=c++11', '-fopenmp'],
... | StarcoderdataPython |
11386860 | # coding: utf-8
import numpy as np
import pysptk
from nose.tools import raises
from pysptk.util import mcepalpha
from pysptk.util import apply_along_last_axis, automatic_type_conversion
def test_assert_gamma():
def __test(gamma):
pysptk.util.assert_gamma(gamma)
for gamma in [-2.0, 0.1]:
yiel... | StarcoderdataPython |
9623493 | # coding: utf-8
from jiraprompt.wrapper import IssueFields, JiraWrapper
from jirasync.utils import echo
class MyJiraWrapper(JiraWrapper):
def create_issue(
self,
summary,
details=None,
component=None,
labels=None,
assignee=None,
sprint=None,
issuety... | StarcoderdataPython |
9751929 | # coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2 # noqa: E501
OpenAPI spec version: 2.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class SingleSignOnTokenRequest(object):
... | StarcoderdataPython |
136208 | import os
import tensorflow as tf
import numpy as np
import matplotlib
# matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import argparse
from numpy import linalg as LA
from keras.applications.vgg16 import VGG16
from keras.preprocessing import image
from keras.applications.vgg... | StarcoderdataPython |
9614620 | # -*- coding: utf-8 -*-
class quantization(object):
"""docstring for quantization"""
def __init__(self, nbit=8):
super(quantization, self).__init__()
self.__nbit = nbit
def quantify(self, w):
with tf.variable_scope("Conv2D"):
| StarcoderdataPython |
338311 | <gh_stars>0
from tkinter import *
import mysql.connector
import tkinter.messagebox as tmsg
def pack1(rootname, text):
lablename = Label(rootname, text=text,
bg="#eb9234",
fg="white",
padx=5,
pady=5,
font=... | StarcoderdataPython |
8049063 | <gh_stars>0
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
'''
Note - the pbs module isn't very pythonic, so you'll see things like
value = job.Resource_List["attribute"] or 100
instead of
value = job.Resource_List.get("attribute", 100)
That is because is a metac... | StarcoderdataPython |
8094093 | import dash
from dash.dependencies import Output, Event
import dash_core_components as dcc
import dash_html_components as html
import plotly
import random
import plotly.graph_objs as go
from collections import deque
X = deque(maxlen=20)
Y = deque(maxlen=20)
X.append(1)
Y.append(1)
app = dash.Dash(__name__)
app.layou... | StarcoderdataPython |
6478141 | import json
from functools import wraps
from flask import Response
class Json:
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(self, app):
from types import MethodType
app.json = MethodType(json_route, app)
return self
class _Enc... | StarcoderdataPython |
3463018 | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 30 00:53:34 2020
@author: <NAME>
"""
| StarcoderdataPython |
154729 | <filename>calculations.py
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 13 09:44:59 2018
@author: simonk
"""
import math
# ref for tangents
# https://en.wikipedia.org/wiki/Tangent_lines_to_circles
def CalcTangents(p1, r1, p2, r2):
x1 = p1[0]
y1 = p1[1]
x2 = p2[0]
y2 = p2[1]
half_pi = math.pi / ... | StarcoderdataPython |
3268908 | from pyworks import Task, State
class BaseState(State):
def pw_timeout(self):
self.log("Timeout")
def worker_done(self, msg):
self.log("worker_done(): Wrong state: %s" % self)
class InitialState(BaseState):
def pw_timeout(self):
self.log("timeout(): Going to TimeoutState")
... | StarcoderdataPython |
6609507 | from django.db.models.fields import BigIntegerField
class SequenceField(BigIntegerField):
# TODO(dcramer): implement sequences based on Instagram's work
pass
| StarcoderdataPython |
5055615 | <reponame>allannjuguna/allannjuguna.github.io
#1 /usr/bin/python3
import sys
arguments=sys.argv
def main(filename):
try:
with open(filename,'r') as r:
contents=r.readlines()
r.close()
lines=[print("<code>"+line.strip()+"</code><br/>") for line in contents if line]
# print(lines)
except:
print(f"Unab... | StarcoderdataPython |
1899684 | <reponame>MeirKriheli/Open-Knesset
# encoding: UTF-8
from django.conf.urls import url, patterns
from ok_tag.views import suggest_tag_post, add_tag_to_object, remove_tag_from_object, \
add_tag_synonym, TagList, TagDetail, CommitteeMeetingMoreView, untagged_objects
ok_tag_patterns = patterns('',
... | StarcoderdataPython |
1943050 | import argparse
import boto3
from gbs3.backup import backup
from gbs3.restore import restore
import gbs3.settings
from gbs3.settings import *
from gbs3.util import eprint
def verify_conf(conf_name):
if not getattr(gbs3.settings, conf_name):
eprint('missing config option {}'.format(conf_name))
ex... | StarcoderdataPython |
41999 | <reponame>hung0913208/Base
from threading import Lock
from time import sleep
from .logger import Logger, DEBUG
from .utils import update_variable_safety
try:
from queue import Queue, Empty
except ImportError:
from Queue import Queue, Empty
import subprocess
import sys
import os
class Performer(object):
d... | StarcoderdataPython |
142306 | # -*- coding: utf-8 -*-
"""
Using TorchScript to serialize and deploy model
===============================================
Models in TorchANI's model zoo support TorchScript. TorchScript is a way to create
serializable and optimizable models from PyTorch code. It allows users to saved their
models from a Python proce... | StarcoderdataPython |
3489960 | <gh_stars>0
from __future__ import unicode_literals
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.decorators import login_required
from django.urls import reverse_lazy
from django.contrib import messages
from django.h... | StarcoderdataPython |
1969757 | import json
from plynx.db.node import Node
from plynx.base import hub
from plynx.utils.common import parse_search_string
def _enhance_list_item(raw_item):
if raw_item['_type'] == 'Group':
# TODO proper checking
items = []
for raw_subitem in raw_item['items']:
items.append(_enha... | StarcoderdataPython |
6425759 | <filename>tests/test_all.py<gh_stars>1-10
import pytest
from werkzeug.routing import RequestRedirect
from flask import Flask, abort, Response, Blueprint
from werkzeug.datastructures import WWWAuthenticate
from datetime import datetime
from flask_errors_handler import (
ErrorHandler, SubdomainDispatcher, URLPrefixDi... | StarcoderdataPython |
1704815 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, logging
# logging.disable(sys.maxsize)
## Set dir
testdir = os.path.dirname(os.path.abspath(__file__))
datdir = testdir+'/dat/'
outdir = testdir+'/out/'
if not os.path.exists(outdir):
os.makedirs(outdir)
import numpy as np
from astropy.io ... | StarcoderdataPython |
4902021 | <filename>tests/test_post_train.py
import math
import numpy as np
import pytest
from helpers.utils import get_features_labels, get_test_case, time_predict
@pytest.mark.parametrize(
"kwargs",
[
# 1. Having a house built later should not impact the SalePrice
({"key": "YearBuilt", "add": 1}),
... | StarcoderdataPython |
5135987 | # print method is to show text to console
print("life is short,I use python!")
print('--<-<-<@')
print('good good study,\nday day up')
print('AB'*3+'CD') | StarcoderdataPython |
170715 | import unittest
import tock
from tock.grammars import *
from tock.syntax import String
class TestGrammar(unittest.TestCase):
def test_init(self):
g = Grammar()
g.set_start_nonterminal('S')
g.add_nonterminal('T')
g.add_rule('S', 'a S b')
g.add_rule('S', 'T')
g.add_rul... | StarcoderdataPython |
195174 | <reponame>maikenp/galaxy
# for rgenetics - lped to pbed
# where to stop with converters
# pbed might be central
# eg lped/eigen/fbat/snpmatrix all to pbed
# and pbed to lped/eigen/fbat/snpmatrix ?
# that's a lot of converters
import os
import subprocess
import sys
import time
prog = os.path.split(sys.argv[0])[-1]
my... | StarcoderdataPython |
1600228 | <reponame>ruchirjain86/professional-services
# Copyright 2021 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | StarcoderdataPython |
3347868 | <reponame>KT12/capstone_in_progress
# -*- coding: utf-8 -*-
from gensim.parsing import PorterStemmer
global_stemmer = PorterStemmer()
class StemmingHelper(object):
"""
Class to aid the stemming process - from word to stemmed form,
and vice versa.
The 'original' form of a stemmed word will be returne... | StarcoderdataPython |
355761 | <filename>alti_discord/bot_database.py<gh_stars>1-10
import sqlite3
class BotDatabase:
def __init__(self):
self.connection = sqlite3.connect('alti_discord.database')
self.cursor = self.connection.cursor()
self.cursor.execute("CREATE TABLE IF NOT EXISTS AltiDiscord(vaporId TEXT, discordId T... | StarcoderdataPython |
9681438 | <reponame>mfassler/python3-quanergyM8
#!/usr/bin/env python3
import sys
if sys.version_info[0] < 3:
raise Exception("Must be using Python 3")
import time
import socket
import struct
import numpy as np
import matplotlib.pyplot as plt
import cv2
from quanergyM8 import Quanergy_M8_Parser, MAGIC_SIGNATURE
if len(sy... | StarcoderdataPython |
338866 | import torch, math
from .CosineSimilarity import CosineSimilarity
DEFAULT = CosineSimilarity(dim=2)
class PrototypeSimilarity(torch.nn.Module):
def __init__(self, features, classes, similarity=DEFAULT):
super().__init__()
self.C = classes
self.D = features
self.weight = torch.nn.... | StarcoderdataPython |
1902676 | <reponame>VictorMello1993/CursoPythonUdemy<gh_stars>0
# %% [markdown]
## Criando uma classe Data
class Data:
# def toStr(self):
# print(f'{self.dia}/{self.mes}/{self.ano}')
'''Chamando o método mágico que retorna um objeto
em formato de string. Este método é padrão
para todos os objeto... | StarcoderdataPython |
5103769 | #!/usr/bin/env python
import os
import glob
import numpy as np
import matplotlib.pyplot as plt
from ccsTools import ccsProducer, CcsRaftSetup
ccsProducer('ts8_ready_acq', 'ccs_ts8_ready_acq.py',
ccs_setup_class=CcsRaftSetup,
sys_paths=(os.path.join(os.environ['IANDTJOBSDIR'], 'python'),))
| StarcoderdataPython |
3394766 | import torch
from torch.nn.parameter import Parameter
import numbers
import numpy as np
from scipy.special import factorial
from . import point_process
from . import distributions as dist
from . import base
class count_model(base._likelihood):
"""
Count likelihood base class.
"""
def __init__(se... | StarcoderdataPython |
4910161 | import sys
import os
s2l = {}
fi = open(sys.argv[3], 'r')
for line in fi:
s = line.split('\t')[0]
l = line.split('\t')[1]
s2l[s] = l
fi.close()
#print s2l
fi = open(sys.argv[1], 'r')
fo = open(sys.argv[2], 'w')
for line in fi:
s = line.split('::')[1]
l = s2l.get(s, '-1')
if l == '-1':
print s
fo.write(l + '... | StarcoderdataPython |
5060319 | from django.test import TestCase
from django.urls import reverse
from accounts.models import UserProfileInfo, User
from admin_app.models import Magazine, Truck, Route
from accounts.forms import UserForm, UserProfileInfoForm
from django.test import Client
from django.test import TestCase
from order_app.models import Che... | StarcoderdataPython |
3350414 | import pandas as pd
import Core_Scripts.Custom_Functions.Functions_Formatting_Data as formatFunc
from Core_Scripts.Custom_Functions.Functions_General import append_df_to_excel
import os
from collections import Counter
import datetime
import csv
# so that output doesnt get cut short when displaying, below line will wid... | StarcoderdataPython |
233859 | from src.card import *
class TestCard:
card = Card(
[7, 8, 3, 4]
) # we use an attributes to avoid recreate a card instance for each test
def test_create_card(self):
assert self.card.sides == [7, 8, 3, 4]
def test_card_tostring(self):
assert self.card.toString() == "7, 8, 3,... | StarcoderdataPython |
84421 | <filename>testproject/settings.py
from django.conf import global_settings
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
DEBUG = True
SECRET_KEY = 'secret'
ROOT_URLCONF = "testproject.urls"
INSTALLED_APPS = ["log_request_id"]
MIDDLEWARE_CLASSES ... | StarcoderdataPython |
11385585 | from django.contrib.gis.db import models
class Admin1Code(models.Model):
code = models.CharField(max_length=10, unique=True)
name = models.CharField(max_length=58)
objects = models.GeoManager()
def __str__(self):
return ': '.join([str(self.code), str(self.name)])
class Admin2Code(models.Mo... | StarcoderdataPython |
3578941 | from feather import read_dataframe as read_feather
import numpy as np
import pandas as pd
import pdb
import pydens
from zpylib import data_path as dp
def select_group(cols, n):
return np.random.choice(cols, size=n, replace=False)
def cols2density(df, cols):
cade = pydens.cade.Cade(
sim_size=1000000,... | StarcoderdataPython |
377235 | <gh_stars>100-1000
from rpython.rlib.rarithmetic import intmask
from rpython.rlib.objectmodel import specialize
from rpython.rtyper.lltypesystem import lltype, rffi
from rpython.jit.backend.llsupport.descr import CallDescr
class UnsupportedKind(Exception):
pass
def get_call_descr_dynamic(cpu, cif_description, ext... | StarcoderdataPython |
1844548 | <filename>Lecture4/student/project.py
from VandyStudent import VandyStudent
from Student import add
if __name__ == '__main__':
print(add(1, 2))
student1 = VandyStudent('Ao', 'Qu', 'EBI', '<NAME>')
student2 = VandyStudent('Xuhuan', 'Huang', 'Branscomb', '<NAME>')
print(student1 > student2)
student1.... | StarcoderdataPython |
6432722 | <gh_stars>0
from .map import inc
| StarcoderdataPython |
3275189 | #!/usr/bin/env python
##
## video.py - recoding VNC to FLV.
##
## Copyright (c) 2009-2010 by <NAME>
##
import sys, zlib, re
from struct import pack, unpack
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from flvscreen import FlvScreen
def str2clip(s):
m = re.mat... | StarcoderdataPython |
3298398 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from yoti_python_sdk.tests.conftest import PEM_FILE_PATH, YOTI_CLIENT_SDK_ID
from yoti_python_sdk.tests.mocks import (
mocked_requests_post_share_url,
mocked_requests_post_share_url_app_not_found,
mocked_requests_post_share_url_... | StarcoderdataPython |
49563 | import turtle
turtle.bgcolor("black")
sq = turtle.Turtle()
sq.speed(20)
sq.color("white")
for i in range(500):
sq.forward(i)
sq.left(91)
| StarcoderdataPython |
9782062 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from flavor import *
from floating_ip_associate import *
from floating_ip import *
from ins... | StarcoderdataPython |
8097032 | <gh_stars>1-10
# coding=utf-8
import os
import getopt
import sys
import platform
import pandas as pd
from datetime import datetime
from datetime import timedelta
from Sql.Connect import switch_amex_database, switch_nysdaq_database, switch_nyse_database, switch_zh_database
from Sql.StockBriefTable import Stoc... | StarcoderdataPython |
3563423 | <filename>tests/common/test_ping.py<gh_stars>0
from .context import common
import pytest
import subprocess
# set timeout for all test functions to 1.2 sec
pytestmark = pytest.mark.timeout(1.2)
def test_is_target_reachable__loopback():
# should always succeed
assert common.is_target_reachable("127.0.0.1")
def t... | StarcoderdataPython |
11391344 | from django.contrib import admin
from blog.models import Post, Comment, Reaction
class CommentAdmin(admin.ModelAdmin):
list_display = ('post', 'comment_text', 'user')
admin.site.register(Comment, CommentAdmin)
class PostAdmin(admin.ModelAdmin):
list_display = ('post_title', 'user', 'updated', 'publish_status... | StarcoderdataPython |
6510322 | # @title Define imports and utility functions.
import collections
import functools
import time
from pathlib import Path
import gin
import jax
import jax.numpy as jnp
import numpy as np
import PIL.Image
import skvideo.io
import tensorflow as tf
from absl import app, flags, logging
from flax import jax_utils
from flax i... | StarcoderdataPython |
8080799 | from queue import Queue
import numpy as np
def breath_first_search(graph, start=0):
queue = Queue()
queue.put(start)
visited = np.zeros(graph.numVertices)
while not queue.empty():
vertex = queue.get()
if visited[vertex] == 1:
continue
print('Visit: ', vertex)
... | StarcoderdataPython |
4873947 | import logging
from terra import util_terra
from terra.execute_type import (
_execute_type,
EXECUTE_TYPE_SWAP,
)
from .borrow import (
handle_deposit_borrow,
handle_repay_withdraw,
)
def handle(exporter, elem, txinfo, index):
execute_msg = util_terra._execute_msg(elem, index)
if "execute_order... | StarcoderdataPython |
363737 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | StarcoderdataPython |
3516436 | <reponame>mario21ic/python_curso
# -*- coding: utf-8 -*-
print "#"*3 +" Operador ternario "+"#"*3
var1 = 'valor1'
var2 = 'valor2' if var1 == 'valor1' else 'valor3'
print "var2:",var2
| StarcoderdataPython |
235921 | # Copyright 2018 ParallelM, 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 ... | StarcoderdataPython |
333883 | <reponame>heckad/sqlalchemy
#!/usr/bin/env python
"""
pytest plugin script.
This script is an extension to pytest which
installs SQLAlchemy's testing plugin into the local environment.
"""
import os
import sys
import pytest
os.environ["SQLALCHEMY_WARN_20"] = "true"
collect_ignore_glob = []
pytest.register_assert... | StarcoderdataPython |
215776 | <gh_stars>10-100
import pytest
from lms.models import ApplicationInstance
from lms.views.application_instances import (
create_application_instance,
new_application_instance,
)
class TestCreateApplicationInstance:
def test_it_creates_an_application_instance(self, pyramid_request):
create_applicat... | StarcoderdataPython |
8028342 | import enum
class API_ENV(enum.Enum):
DEVELOPMENT = "development"
PRODUCTION = "production"
class API_CONFIG(enum.Enum):
SECRET_KEY = "SECRET_KEY"
DEBUG = "DEBUG"
TESTING = "TESTING"
| StarcoderdataPython |
4907224 | <filename>rb/cna/cna_graph.py<gh_stars>1-10
from typing import Callable, Dict, List, Tuple, Union
import networkx as nx
import numpy as np
from networkx.algorithms.link_analysis.pagerank_alg import pagerank
from rb.cna.edge_type import EdgeType
from rb.cna.overlap_type import OverlapType
from rb.core.block import Bloc... | StarcoderdataPython |
1831046 | <filename>autograd/initializers/initializer.py
from autograd import Tensor
class Initializer(object):
def __call__(self, shape=None):
if shape is None:
raise ValueError(
f'can not initialize Tensor when shape is None')
if not isinstance(shape, tuple):
raise Val... | StarcoderdataPython |
3318053 | BOT_TOKEN = '<KEY>'
# find your timezone here -> https://gist.github.com/heyalexej/8bf688fd67d7199be4a1682b3eec7568
TIMEZONE = 'Asia/Hong_Kong'
# 24-hour, leave empty to disable
NOTIFY_TIME = '23:00'
| StarcoderdataPython |
8104711 | <reponame>N5GEH/FiLiP<gh_stars>1-10
"""
Autogenerated Models for the vocabulary described by the ontologies:
http://www.semanticweb.org/building (building circuits)
"""
from enum import Enum
from typing import Dict, Union, List
from filip.semantics.semantics_models import\
SemanticClass,\
SemanticIndividual,\
Rela... | StarcoderdataPython |
5165329 | class RelengException(Exception):
pass
| StarcoderdataPython |
6685907 | <gh_stars>1-10
#! flask/bin/python
from app import app, db
from app.models import *
from trueskill_functions import *
# tests for trueskill_functions
print "test0.trueskills is empty, and region is None: should be populated with Global TrueSkill"
# test0 = User(tag="test0")
test0 = check_set_user("test0")
populate_t... | StarcoderdataPython |
5095456 | from selenium import webdriver
from framework.factory.models_enums.page_config import PageConfig
from framework.factory.page_factory import PageFactory
from configuration.configuration import ConfigurationManager
import inspect
class BasePage(PageFactory):
"""Base class to create a page."""
def __init__(self... | StarcoderdataPython |
8090063 | # coding: utf-8
import anyjson
import envoy
import os
import os.path
import setuptools as orig_setuptools
import sys
import string
import operator
import datetime
from itertools import islice, dropwhile, izip_longest
from collections import defaultdict, deque
from orderedset import OrderedSet
from allmychanges.utils ... | StarcoderdataPython |
1895125 | # coding: utf-8
import json
import os
from uuid import uuid4
import requests
from .log import log
class Tokenizer(object):
def __init__(self):
self.is_test = False
def get_token(self, systemId, **args):
"""
curl -X POST https://devpfront.a-3.ru/token/api/v1 \
-H 'content-... | StarcoderdataPython |
11207287 | import unittest
from resources.file_io_wrapper import FileIOWrapper
class TestFileIO(unittest.TestCase):
def setUp(self) -> None:
self.sut = FileIOWrapper()
self.test_bucket = "unit-testing-buckets"
def test_create_list_delete_buckets(self):
# Arrange (and act)
self.sut.creat... | StarcoderdataPython |
5099704 | from flask import Flask, render_template, request, jsonify
app = Flask(__name__)
result = {'Answer': 0}
def add(a, b):
return float(a) + float(b)
def sub(a, b):
return float(a) - float(b)
def mul(a, b):
return float(a) * float(b)
def div(a, b):
return float(a) / float(b)
def pow(a, b):
return a ** b
def gc... | StarcoderdataPython |
6414887 | from zipfile import ZipFile
from bs4 import BeautifulSoup
from flask import Flask, render_template, request
from util import allowed_file
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/upload', methods=['POST'])
def upload():
if 'file' not in request.f... | StarcoderdataPython |
6520371 | <filename>fireworks_vasp/tasks.py
__author__ = '<NAME>'
__copyright__ = 'Copyright 2013, The Materials Project'
__version__ = '0.1'
__maintainer__ = '<NAME>'
__email__ = '<EMAIL>'
__date__ = '1/31/14'
import logging
from pymatgen import Structure
from fireworks import FireTaskBase, FWAction, explicit_serialize
from cu... | StarcoderdataPython |
4970988 | #!/usr/bin/python
# Copyright 2011 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 appli... | StarcoderdataPython |
245395 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | StarcoderdataPython |
12854572 | <reponame>xenadevel/xena-open-automation-python-api<filename>xoa_driver/internals/core/commands/px_commands.py<gh_stars>1-10
#: L23 Port Transceiver Commands
from dataclasses import dataclass
import typing
from ..protocol.command_builders import (
build_get_request,
build_set_request
)
from .. import interfac... | StarcoderdataPython |
202134 | <gh_stars>0
from .utils import *
from .TelloClient import *
| StarcoderdataPython |
6568791 | # -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2017 <NAME> <<EMAIL>>
#
# diffoscope 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 versi... | StarcoderdataPython |
318855 | <gh_stars>10-100
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 3 14:39:32 2020
@author: zo
"""
def tokenizer_and_model_config_mismatch(config, tokenizer):
"""
Check for tokenizer and model config miss match.
Args:
config:
model config.
tokenizer:
... | StarcoderdataPython |
3303421 | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from ._shared import parse_key_vault_id, KeyVaultResourceId
def parse_key_vault_secret_id(source_id):
# type: (str) -> KeyVaultResourceId
"""Parses a secret's... | StarcoderdataPython |
12850782 | <reponame>MarioCodes/ProyectosClaseDAM<filename>python/periodic-web-scrapper/scraper/utilities/WebUtilities.py
'''
Created on Mar 22, 2018
@author: msanchez
'''
import requests
from html.parser import HTMLParser
import urllib
class WebUtilities(object):
def __init__(self):
''' Utility class. Has everyth... | StarcoderdataPython |
11390509 | <filename>etc/script/notify.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import json
import urllib2
import smtplib
from email.mime.text import MIMEText
notify_channel_funcs = {
"email":"email",
"sms":"sms",
"voice":"voice",
"dingtalk":"dingtalk",
"wecom":"wecom",
"feishu":"feis... | StarcoderdataPython |
9659704 | <reponame>DaniAffCH/Amazon-scraper
from selectorlib import Extractor
import requests
import re
class Scraper:
__private_url = str()
r = None
ext = None
headers = {
'dnt': '1',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleW... | StarcoderdataPython |
399767 | <reponame>fakedrake/WikipediaBase
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_classifiers
----------------------------------
Tests for `classifiers` module.
"""
try:
import unittest2 as unittest
except ImportError:
import unittest
from wikipediabase import classifiers as cls
class TestClassifie... | StarcoderdataPython |
9651996 | <filename>core/views.py<gh_stars>0
from django.shortcuts import render, redirect
from django.http.response import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from pytesseract import pytesseract
from PIL import Image
from django.contrib import messages
@csrf_exempt
def upload(request):
contex... | StarcoderdataPython |
3353424 | bills = [7, 12, 22, 52, 102, 15, 25, 55, 105, 30, 60, 110, 70, 120, 150]
count = 0
while True:
N, M = map(int, input().split())
if N == 0 and M == 0:
break
for i in bills:
if M - N == i:
count = 1
break
else:
count = 0
if count == 1:
pr... | StarcoderdataPython |
5046041 | <reponame>droberin/TelNot
#!/usr/bin/env python3
#
# Author: <NAME> <<EMAIL>
# Version: 1.0
#
from telnot import telnot
if __name__ == '__main__':
app = telnot.TelNot()
app.run()
| StarcoderdataPython |
1834249 | import os
import numpy as np
import torch
from .helper_func import tensor_to_np
class Dataset:
def __init__(self, path):
self.path = path
self.data = dict()
self.files = set(os.listdir(path))
def __getattr__(self, item):
xname = item + "_x"
yname = item + "_y"
... | StarcoderdataPython |
4885797 | import contextlib
import io
import sys
import time
import unittest
import unittest.mock
import importlib
import mqtt_app
from threading import Thread
class TestApp(unittest.TestCase):
@contextlib.contextmanager
def _capture_output(self):
new_out, new_err = io.StringIO(), io.StringIO()
old_ou... | StarcoderdataPython |
1682975 | class GameState(object):
"""
This class represents a contract that must be fulfilled for MCTS to work.
Such contract describes a singular state within a game (i.e. pawns positioning on chessboard).
Methods provided below are bare minimum to make UTC in any 2-player complete information deter... | StarcoderdataPython |
1782832 | <filename>coreml/data/sampler.py
"""Custom sampler for loading data"""
import random
from typing import List, Any, Optional
from collections import defaultdict
import numpy as np
from torch.utils.data.sampler import Sampler, RandomSampler
from torch.utils.data.distributed import DistributedSampler
from torch.utils.data... | StarcoderdataPython |
6478205 | <reponame>dumpmemory/zulip<gh_stars>1-10
# Generated by Django 3.2.9 on 2021-12-27 21:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zilencer", "0023_remotezulipserver_deactivated"),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.