id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3307858 | for _ in range(int(input())):
n=int(input())
l=list(map(int,input().split()))
if n%2==0:
for i in range(0,n,2):
print(l[i+1],-l[i],end=" ")
print()
else:
temp=n-3
for i in range(0,temp,2):
print(l[i+1],-l[i],end=" ")
if l[temp]+l[temp+1]!=0... | StarcoderdataPython |
3258304 | <gh_stars>0
primeiro=int(input('Primeiro termo:'))
razao=int(input('Razão:'))
decimo=primeiro+(10-1)*razao
for c in range(primeiro,decimo+razao,razao):
print('{}'.format(c), end='->')
print('ACABOU')
#progressão aritmética (PA) | StarcoderdataPython |
3241541 | <gh_stars>1-10
from sklearn.metrics import (
mean_squared_error,
mean_absolute_error,
)
from pmdarima.metrics import smape
from tsaugur.metrics.custom_metrics import (
mean_absolute_percentage_error,
root_mean_squared_error,
)
METRIC_KEY_MSE = "mse"
METRIC_KEY_MAE = "mae"
METRIC_KEY_RMSE = "rmse"
METR... | StarcoderdataPython |
1665678 | class Solution:
def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:
ans = 0
currentEnd = -math.inf
for interval in sorted(intervals, key=lambda x: x[1]):
if interval[0] >= currentEnd:
currentEnd = interval[1]
else:
ans += 1
return ans
| StarcoderdataPython |
3357078 | #!/usr/bin/env python
# encoding: utf-8
"""Azkaban CLI: a lightweight command line interface for Azkaban.
Usage:
azkaban build [-cp PROJECT] [-a ALIAS | -u URL | [-r] ZIP] [-o OPTION ...]
azkaban info [-p PROJECT] [-f | -o OPTION ... | [-i] JOB ...]
azkaban log [-a ALIAS | -u URL] EXECUTION [JOB]
azkaban run ... | StarcoderdataPython |
4801183 | import sightlines as los
import numpy as np
def test_closest_int():
nice_z_r_list = [(0,0,10), (1,0,11), (2,0,12), (3,0,13), (4,0,14),
(5,0,15), (6,0,16), (7,0,17), (8,0,18), (9,0,19)]
cell_index, dist = los.closest_cell_to(3.1, nice_z_r_list)
assert(cell_index == 3)
np.testing.as... | StarcoderdataPython |
1772961 | <reponame>GuillaumeRochette/HumanViewSynthesis
from typing import Tuple, Union
import torch
from torchvision.transforms import ToTensor as ImageToTensor
from data.transforms import (
MaskToTensor,
DynamicSquareCrop,
Resize,
stabilized_padding,
)
from data.Human36M.skeleton import JOINTS
from data.Huma... | StarcoderdataPython |
1735412 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.fixes import _astype_copy_false
class WeightsComputer:
'''
Weight methods:
idf : log( (1 + n) / (1 + df(t)) ) + 1
dfs : Distinguishing feature selector
chi2 : Term Weighting Based on Chi-Square Statistic
ig : Term... | StarcoderdataPython |
197632 | <filename>circus/watcher.py<gh_stars>0
import copy
import errno
import os
import signal
import time
import sys
from random import randint
try:
from itertools import zip_longest as izip_longest
except ImportError:
from itertools import izip_longest # NOQA
import site
from tornado import gen
from psutil import ... | StarcoderdataPython |
1753960 | import os
import sys
import time
import shutil
import argparse
import numpy as np
from PIL import Image
from skimage import io
from pathlib import Path
from matplotlib import cm
import matplotlib.pyplot as plt
from imgaug import augmenters as iaa
# Pycoco
from pycocotools.coco import COCO
from pycocotools.cocoeval imp... | StarcoderdataPython |
30429 | <filename>katena_chain_sdk_py/serializer/bytes_field.py
"""
Copyright (c) 2019, TransChain.
This source code is licensed under the Apache 2.0 license found in the
LICENSE file in the root directory of this source tree.
"""
from marshmallow import fields
from base64 import b64encode, b64decode
class BytesField(field... | StarcoderdataPython |
179508 | from .decode_predictions import decode_predictions
from .get_bboxes_from_quads import get_bboxes_from_quads
from .sort_quads_vertices import sort_quads_vertices
from .read_sample import read_sample
from .encode_textboxes import encode_textboxes
from .get_samples import get_samples
from .get_num_quads import get_num_qua... | StarcoderdataPython |
1725777 | <filename>musicsync/auth.py
import requests
from datetime import datetime, timedelta
from requests.auth import HTTPBasicAuth
from requests import Request
from .config import logger, \
GPM_APP_PASSWORD, \
GPM_EMAIL_ADDRESS, \
SPOTIFY_CLIENT_ID, \
SPOTIFY_CLIENT_SECRET
from .exceptions import AuthError... | StarcoderdataPython |
180908 | <gh_stars>1-10
from typing import List
from uuid import UUID
from fastapi import APIRouter
from fastapi.param_functions import Depends
from sqlmodel import Session
from starlette.status import HTTP_201_CREATED
from src.core.controller import order
from src.core.helpers.database import make_session
from src.core.model... | StarcoderdataPython |
3290574 | import os
import sys
import glob
#from pybp import version
from setuptools import setup
from setuptools import find_packages
# Package info
PACKAGE_NAME = "ipydebug"
DESCRIPTION = "Breakpoints and logging class for python debugging"
LONG_DESC = "Function wrappers and breakpoint class to insert breakpoints into a pytho... | StarcoderdataPython |
158601 | #final version for automating an email that the team gets every day
#libraries
#web driver (need selenium because of Java Script)
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.commo... | StarcoderdataPython |
1640986 | <reponame>olivier-m/miniature
# -*- coding: utf-8 -*-
#
# This file is part of Tamia released under the MIT license.
# See the LICENSE for more information.
from __future__ import (print_function, division, absolute_import, unicode_literals)
import unittest
if __name__ == '__main__':
unittest.main()
| StarcoderdataPython |
3259439 | import requests
import json
URL = "https://api.github.com/users/sivanWu0222"
response = requests.get(URL)
print(type(response))
response_dict = response.json()
print(response_dict)
| StarcoderdataPython |
3251254 | """
(C) Copyright 2021 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
d... | StarcoderdataPython |
26290 | import copy
import json
import numpy as np
import pandas as pd
import basicDeltaOperations as op
import calcIsotopologues as ci
import fragmentAndSimulate as fas
import solveSystem as ss
'''
This is a set of functions to quickly initalize methionine molecules based on input delta values and to simulate its fragmenta... | StarcoderdataPython |
3226712 | <reponame>islandowner-web/IT-MOOC
# Generated by Django 2.2 on 2019-12-11 19:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('organizations', '0017_remove_teacher_work_company'),
]
operations = [
migrations.RemoveField(
model_name... | StarcoderdataPython |
3237455 | <filename>pykeg/backup/mysql.py
"""MySQL-specific database backup/restore implementation."""
from builtins import str
import logging
import subprocess
from django.conf import settings
from django.apps import apps
logger = logging.getLogger(__name__)
DEFAULT_DB = "default"
# Common command-line arguments
PARAMS = {... | StarcoderdataPython |
3376690 | <reponame>pasmuss/cmssw
import FWCore.ParameterSet.Config as cms
hcaldigisAnalyzer = cms.EDAnalyzer("HcalDigisValidation",
outputFile = cms.untracked.string(''),
digiTag = cms.InputTag("hcalDigis"),
QIE10digiTag= cms.InputTag("hcalDigis"),
QIE11digiTag= cms.InputTag("hcalDigis"),
mode = cms.untrac... | StarcoderdataPython |
1723555 | <gh_stars>1-10
from fastapi import APIRouter, Depends, status, HTTPException
from fastapi.encoders import jsonable_encoder
from database import get_db
from models.pokemon_type import PokemonType as pokemon_type_model
from schemas.pokemon_type import ShowPokemonType as show_pokemon_type_schema
from schemas.pokemon_type ... | StarcoderdataPython |
165435 | <filename>src/FeatureVolumeCacheSequence.py
#!/usr/bin/env python3
# Developed by <NAME> and <NAME>
# This file is covered by the LICENSE file in the root of this project.
# A keras generator which generates batches out of cached feature volumes
import os
import numpy as np
from keras.utils import Sequence
class Fe... | StarcoderdataPython |
3309912 | from requirements_diffing import diff_files
def test_diff_files():
pass
| StarcoderdataPython |
4808126 | <gh_stars>1-10
from .types import Number, Boolean, NegNumber
from .operations import Add, Sub, Div, Mul, FloorDiv, Modulo, Exponent
from .comparisons import Lesser, Greater, Equal, NotEqual, LessThanEqual, GreaterThanEqual
from .functions import Log, Abs | StarcoderdataPython |
545 | import json
from cisco_sdwan_policy.BaseObject import BaseObject
class Application(BaseObject):
def __init__(self,name,app_list,is_app_family,id=None,reference=None,**kwargs):
self.type = "appList"
self.id = id
self.name = name
self.references = reference
self.app_family=... | StarcoderdataPython |
3276010 | from virtualenv import Virtualenv # noqa
from virtualenv import __version__ # noqa
| StarcoderdataPython |
3394968 | <reponame>sdlm/ch-id-card-api<filename>src/predict/coords.py
import numpy as np
import torch
from PIL import Image
from torch import nn
from torchvision import models
from torchvision.transforms import transforms
MODEL_PATH = "/weights/resnet50_regression_v2.2.3.pt"
def load_model(weights_path: str = None):
mode... | StarcoderdataPython |
30586 | <filename>_0697_div3/D_Cleaning_the_Phone.py
def solve(n, m, A, B):
ans = 0
ones, twos = [], []
for i in xrange(n):
if B[i] == 1: ones += A[i],
else: twos += A[i],
ones.sort()
twos.sort()
i, j = len(ones)-1, len(twos)-1
while m > 0 and (i >= 0 or j >= 0):
if i >= 0 an... | StarcoderdataPython |
129140 | <filename>tests/test_inheritance.py
import pytest
from umongo import Document, fields, exceptions
from .common import BaseTest
class TestInheritance(BaseTest):
def test_cls_field(self):
@self.instance.register
class Parent(Document):
last_name = fields.StrField()
class... | StarcoderdataPython |
43532 | <gh_stars>1-10
import os
from datetime import timedelta
import numpy
from esdl.cube_provider import NetCDFCubeSourceProvider
from dateutil.relativedelta import relativedelta
from netCDF4 import num2date
all_vars_descr = {'GPPall': {
'gross_primary_productivity': {
'source_name': 'GPPall',
'data_ty... | StarcoderdataPython |
11190 | import socket
s = socket.socket()
s.bind(("localhost", 9999))
s.listen(1)
sc, addr = s.accept()
while True:
recibido = sc.recv(1024)
if recibido == "quit":
break
print "Recibido:", recibido
sc.send(recibido)
print "adios"
sc.close()
s.close()
| StarcoderdataPython |
4817453 | '''
Test Cases for AnalysisEngine Class for WordCloud Project
<NAME>
Computer-Based Honors Program
The University of Alabama
9.27.2013
'''
import unittest
import os, os.path
from src.core.python.AnalysisEngine import AnalysisEngine
from src.core.python.SupremeCourtOpinion import SupremeCourtOpinion
from src.core.pyth... | StarcoderdataPython |
1740991 | <reponame>maxpit/human-pose-estimation<gh_stars>0
"""
Sets default args
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
from absl import flags
import os.path as osp
curr_path = osp.dirname(osp.abspath(__file__))
SMPL_FACE_PATH = osp.join(cur... | StarcoderdataPython |
3354328 | '''
Dictionary to DataFrame (2)
100xp
The Python code that solves the previous exercise is included on the right.
Have you noticed that the row labels (i.e. the labels for the different observations)
were automatically set to integers from 0 up to 6?
To solve this a list row_labels has been created. You can use it to ... | StarcoderdataPython |
4810571 | <reponame>felipesch92/cfbCursos
import re #RegEx
txt = 'Olá <NAME>, seja bem vindo ao curso de RegEx'
p = input('Digite a expressão que deseja pesquisar: ')
res = re.findall(p, txt)
qtd_elems = len(res)
print(res)
print(f'Quantidade encontrada: {qtd_elems}')
for r in res:
print(r)
| StarcoderdataPython |
88009 | <gh_stars>10-100
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
'''
Copyright 2014-2015 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICEN... | StarcoderdataPython |
130303 | <reponame>YoruCathy/GarbageNet<gh_stars>1-10
from GarbageClassification import GarbageClassification
gc = GarbageClassification(backbone="MobileNet",gpu="1",logname="realcosinelr")
gc.set_environment()
pipeline = gc.prepare_pipeline()
gc.train(pipeline) | StarcoderdataPython |
1714100 | <filename>Basics/E03_Text/testing/StringFlows.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T E X A M P L E S
#
# www.pagebot.io
# Licensed under MIT conditions
#
# ---------------------------------------... | StarcoderdataPython |
1626956 | <filename>Misc. Practice Code Junk/to_prime_or_not_to_prime.py<gh_stars>0
def to_prime_or_not_to_prime(number):
#naive python function to check whether a given number is prime or not...
#"seldomly asked in interviews"-as stated by Jose.
for num in range(2, number):
if number % num == 0:
... | StarcoderdataPython |
100203 | from bs4 import BeautifulSoup as bs
import requests
from csv import DictWriter
print("Import sukses")
def scrapeWeb():
halaman = int(input("Berapa halaman? "))
jenis_halam = input("Scrape halaman mana? ").lower()
all_news = []
for x in range(1,halaman + 1):
cap = requests.get(f"https://... | StarcoderdataPython |
63158 | {
'targets': [
{
'target_name': 'example1',
'sources': ['manifest.c'],
'libraries': [
'../../target/release/libnapi_example1.a',
],
'include_dirs': [
'../napi/include'
]
}
]
}
| StarcoderdataPython |
176571 | <filename>gpa/scripts/gpa_stats.py
# coding=utf-8
# Copyright 2018 <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | StarcoderdataPython |
180075 | <filename>arl_and_re/arl/gen_run.py
import argparse
parser = argparse.ArgumentParser()
## Required parameters
parser.add_argument("--output", default='job.sh', type=str,
help="output sh file name")
parser.add_argument("--gpuid", default=0, type=int,
help="output sh file name")
... | StarcoderdataPython |
3372169 | <filename>TRIANGULO.py
L1 = float(input('Digite o primeiro L:'))
L2 = float(input('Digite o segundo L:'))
L3 = float(input('Digite o terceiro L:'))
if L1 < L2 + L3 and L1 < L3 + L2 and L3 < L1 + L2:
print('Show, formou um TRIÂNGULO', end=' ')
if L1 == L2 == L3:
print('EQUILÁTERO: {},{},... | StarcoderdataPython |
4811242 | text = "X-DSPAM-Confidence: 0.8475";
s = text.find(' ')
newText = text[s:].strip()
n = float(newText)
print(n)
| StarcoderdataPython |
3221217 | <reponame>jdswalker/Advent-of-Code-2015<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Advent of Code 2015 from http://adventofcode.com/2015/day/17
Author: <NAME>
Copyright: MIT license
--- Day 17: No Such Thing as Too Much ---
The elves bought too much eggnog again - 150 liters this time. To fit ... | StarcoderdataPython |
1789998 | import functools
import numpy
from pydrake.common.eigen_geometry import AngleAxis, Quaternion
from pydrake.math import ComputeBasisFromAxis
from pydrake.math import RotationMatrix
from pydrake.multibody.tree import Joint_, RevoluteJoint_
from pydrake.systems.framework import BasicVector_, LeafSystem
from visualizatio... | StarcoderdataPython |
3277441 | <filename>Example-Project/src/plots.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.dates import *
import seaborn as sns
import statsmodels.api as sm
sns.set_style("whitegrid", {'axes.edgecolor': '.6',
'axes.facecolor': '0.9',
... | StarcoderdataPython |
106984 | """
Copyright 2017 Platform9 Systems Inc.(http://www.platform9.com)
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... | StarcoderdataPython |
126161 | <filename>pyexlatex/models/format/text/color/deftypes/hex.py<gh_stars>1-10
from typing import Optional
from pyexlatex.models.format.text.color.deftypes.base import ColorDefinition
class Hex(ColorDefinition):
"""
Define a color using a hex code, such as #21ad2a
"""
definition_type = 'HTML'
def __i... | StarcoderdataPython |
1648995 | # user settings, included in settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
# SECURITY WARNING: Make this unique, and don't share it with anybody.
SECRET_KEY = ''
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgre... | StarcoderdataPython |
136834 | <reponame>gldnspud/kafka-influxdb
try:
import ujson as json
except ImportError:
import json
import logging
try:
# Test for mypy support (requires Python 3)
from typing import List, Text
except:
pass
class Encoder(object):
"""
An encoder for the Collectd JSON format
See https://collec... | StarcoderdataPython |
3265048 | import requests
from urllib.parse import quote
import datetime
import json
import pandas as pd
import locale
import time
from IPython.display import clear_output
import numpy as np
from requests.exceptions import ProxyError
from IPython.display import clear_output
class Code():
def __init__(self):
self... | StarcoderdataPython |
1784340 | <gh_stars>0
#!/usr/bin/python3
import yaml
from optparse import OptionParser
import os.path
known_dirs = {}
includes = []
opts = set()
def process(options):
yaml_fname = options.yaml_filename
prefix = os.path.realpath(options.top_directory)
with open(yaml_fname, 'r') as f:
y = yaml.load(f, Loade... | StarcoderdataPython |
3305666 | <filename>partd/buffer.py
from .core import Interface
from threading import Lock
from toolz import merge_with, topk, accumulate, pluck
from operator import add
from bisect import bisect
from collections import defaultdict
from queue import Queue, Empty
def zero():
return 0
class Buffer(Interface):
def __init... | StarcoderdataPython |
1625517 | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Module to define CONSTANTS used across the project
"""
import os
from webargs import fields
from marshmallow import Schema, INCLUDE
from official.utils.logs import logger as official_logger
# identify basedir for the package
BASE_DIR = os.path.dirname(os.path.normpath(os.... | StarcoderdataPython |
1710973 | <filename>Trees/Find_Subtree.py
#Given 2 binary trees t and s, find if s has an equal subtree in t, where the structure and the values are the same.
#Return True if it exists, otherwise return False
class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.r... | StarcoderdataPython |
1700435 | <gh_stars>1-10
from django.dispatch import receiver
from django.db.models.signals import post_save
from .models import Hotels, Room
#signal to send email on successful property register
def property_created(sender, instance, created, *args, **kwargs):
hotel = instance
if created:
#send an email
hote... | StarcoderdataPython |
155486 | ##### file path
# input
path_df_D = "../../data/raw/tianchi_fresh_comp_train_user.csv"
# output
path_df_part_1 = "raw/df_part_1.csv"
path_df_part_2 = "raw/df_part_2.csv"
path_df_part_3 = "raw/df_part_3.csv"
path_df_part_1_tar = "raw/df_part_1_tar.csv"
path_df_part_2_tar = "raw/df_part_2_tar.csv"
path_df_... | StarcoderdataPython |
1601544 | <filename>src/python/builtins.py
from basetype import SimpleTypeFunc, CustomTypeFunc, BuiltinTypeClass, LibClass, LibFunc, makeFuncSpec, makeFuncProto
import operator
import ast
import logging
import parser
class IntegerTimesFunc(LibFunc):
def __init__(self, cls):
argtype = makeFuncSpec(ast.makePrimitiveTy... | StarcoderdataPython |
4691 | <filename>constellation_forms/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-15 00:56
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletio... | StarcoderdataPython |
198569 | #!/usr/bin/python
"""
Helper script to split monthly input geojson files with all detections for example from E13d into separate entries per grouped by AOI and timestamp
Also creates a csv for additional indicator with `suffix` to allow grouped view of these data
Usage:
# update `list_of_dates_to_process` with dates i... | StarcoderdataPython |
4811396 | import csv
from sklearn import datasets
from sklearn import metrics
from sklearn.svm import SVC
from pprint import pprint
import json
import random
import sys
import pickle
import preprocessing
import jpype as jp
import zemberek.normalizer
import length, ner_tagging, pos_tagging
import csv
import words
###############... | StarcoderdataPython |
3208652 | <gh_stars>0
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 3+2
5
>>> 3-2
1
>>> 2-3
-1
>>> 2*3
6
>>> 2/3
0.6666666666666666
>>> 3%2
1
>>> 3**2
9
>>> 2**4
16
>>> dist1 = 15
>>> dist2 = 15
>>> total... | StarcoderdataPython |
4837624 | # import json
import yaml
import sys
import logging
import os
import os.path
from collections import namedtuple
# These can be overridden in the config file.
# They are just here some sensible defaults
# so the module shill functions
BUILT_IN_DEFAULTS = {
'meta':{
"version": "dev_build",
"app" : "unknown"... | StarcoderdataPython |
1624772 | <gh_stars>0
import io
import itertools
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
def plot_to_image(figure, file_name=None):
"""Converts the matplotlib plot specified by 'figure' to a PNG image and
returns it. The supplied figure is closed and inaccessible after this call.
... | StarcoderdataPython |
3239375 | <gh_stars>0
from django.apps import AppConfig
class LocalusersConfig(AppConfig):
name = 'localusers'
| StarcoderdataPython |
107896 | # -*- coding: utf-8 -*-
import json
import os
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
import pandas as pd
from sklearn.model_selection import train_test_split
import csv
import pickle
import src.data.unify_datasets as unify
@click.command()
@click.option('--d... | StarcoderdataPython |
152849 | <gh_stars>0
"""
General utility routines shared by various web related modules.
"""
import Cookie
import urllib
import time
from datetime import datetime
try:
from email.utils import parsedate
except ImportError: # Python < 2.5
from email.Utils import parsedate
from tiddlyweb.serializer import Serializer
fro... | StarcoderdataPython |
1739012 | <reponame>linuxonly801/awesome-DeepLearning
# Copyright (c) 2021 PaddlePaddle Authors. 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.a... | StarcoderdataPython |
4802378 | # coding=utf8
# 라이브러리 가져오기
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import re
from urllib.request import urlretrieve
options = webdriver.ChromeOptions()
options.add_argument('headless')
options.add_argument('window-size=1920x1080')
options.add_argument("disable-gpu")... | StarcoderdataPython |
3359931 | # -*- coding: utf-8 -*-
from PySide6.QtCore import QEvent
class BlameEvent(QEvent):
Type = QEvent.User + 1
def __init__(self, filePath, rev=None, lineNo=0):
super().__init__(QEvent.Type(BlameEvent.Type))
self.filePath = filePath
self.rev = rev
self.lineNo = lineNo
class Sh... | StarcoderdataPython |
1772873 | <reponame>LucasRR94/RPG_Pirates_and_Fishers
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------------
from Item import *
from Defense import *
import random
import string
def testAssignname_Defense(defense,name,numberofsum,num):
if(len(name) >= 5 and len... | StarcoderdataPython |
29629 | <gh_stars>0
from django.dispatch import Signal
badge_awarded = Signal(providing_args=["badge"])
| StarcoderdataPython |
157676 | <reponame>euro-cordex/scheduler
#! /usr/bin/python
# coding: utf-8
"""Scheduler
Classes and methods in :mod:`Scheduler` should create jobscripts
for different schedulers and help submitting and checking them.
"""
import logging
import os
import subprocess
from configobj import ConfigObj
from string import Template
... | StarcoderdataPython |
3238201 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from tkinter import *
import urllib.request
import json
import requests
import datetime
from services.helper import * #this is how to import another file
##print(getDate())
## openweathermap api : https://home.openweathermap.org/api_keys
## key ba6bea63055e16232cde72d76b... | StarcoderdataPython |
3285428 | <reponame>jhmarlow/python-template-repository
#!/usr/bin/env python
from setuptools import setup, find_packages
import pathlib
import pkg_resources
# import versioneer
with pathlib.Path('requirements.txt').open() as requirements_txt:
install_requires = [
str(requirement)
for requirement
in... | StarcoderdataPython |
1715261 | <filename>sockjs_flask/gunicorn/workers.py
from sockjs_flask.handler import Handler
from gunicorn.workers.ggevent import GeventPyWSGIWorker
class GeventWebSocketWorker(GeventPyWSGIWorker):
wsgi_handler = Handler
| StarcoderdataPython |
139317 | <gh_stars>1-10
from torch.utils.tensorboard import SummaryWriter
| StarcoderdataPython |
4842301 | <reponame>shiftgig/petri-dish
from abc import ABC, abstractmethod
import pandas as pd
from petri_dish.stat_tools import chi_squared, ttest
class AbstractBaseDistributor(ABC):
def __init__(self, treatment_group_ids):
self.treatment_group_ids = treatment_group_ids
@abstractmethod
def assign_grou... | StarcoderdataPython |
3231516 | import re
from pathlib import Path
import pytest
from packaging.tags import Tag
from poetry.core.packages.package import Package
from poetry.installation.chooser import Chooser
from poetry.repositories.legacy_repository import LegacyRepository
from poetry.repositories.pool import Pool
from poetry.repositories.pypi_... | StarcoderdataPython |
69014 | #!/usr/bin/python
"""
This module contains an OpenSoundControl implementation (in Pure Python), based
(somewhat) on the good old 'SimpleOSC' implementation by <NAME> & <NAME>.
This implementation is intended to still be 'simple' to the user, but much more
complete (with OSCServer & OSCClient classes) and much more pow... | StarcoderdataPython |
140837 | """
Running operational space control with a PyGame display, and using the pydmps
library to specify a trajectory for the end-effector to follow, in
this case, a bell shaped velocity profile.
To install the pydmps library, clone https://github.com/studywolf/pydmps
and run 'python setup.py develop'
***NOTE*** there are... | StarcoderdataPython |
36667 | <gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2017 Alibaba Group Holding Ltd.
#
# 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/lic... | StarcoderdataPython |
35508 | <filename>languages/python/src/concepts/P104_Decorators_ClassBasedDecorators.py
# Description: Class Based Decorators
"""
### Note
* If you want to maintain some sort of state and/or just make your code more confusing, use class based decorators.
"""
class ClassBasedDecorator(object):
def __init__(self, functio... | StarcoderdataPython |
154009 | # -*- coding: utf-8 -*-
# Author : <NAME>
# e-mail : <EMAIL>
# Powered by Seculayer © 2021 Service Model Team, R&D Center.
class StringUtil(object):
@staticmethod
def get_int(data) -> int:
try:
return int(data)
except ValueError:
return -1
@staticmethod
def ge... | StarcoderdataPython |
1629138 | <reponame>PaulWay/osbuild<filename>osbuild/util/lorax.py
#!/usr/bin/python3
"""
Lorax related utilities: Template parsing and execution
This module contains a re-implementation of the Lorax
template engine, but for osbuild. Not all commands in
the original scripting language are support, but all
needed to run the post... | StarcoderdataPython |
3252401 | <reponame>wilsenmuts/labsecurity
from libsecurity.scanners import *
from libsecurity.main import *
scanner = scanner()
interpreter = interpreter()
scanports = scanner.scanports
scanport = scanner.scanport
scanip = scanner.scanip
scanweb = scanner.scanweb
scanns = scanner.scanns
getwpv = scanner.getwpv
help = interpr... | StarcoderdataPython |
116323 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/11/6 16:45
# @File : leetCode_657.py
'''
思路,
U,D,L,R
分布对应+1, -1操作,最后比较值即可
'''
class Solution(object):
def judgeCircle(self, moves):
"""
:type moves: str
:rtype: bool
"""
steps = {
"U": 1,
... | StarcoderdataPython |
3366333 | <reponame>backtick-se/cowa
# flake8: noqa: 401
from .docker import DockerProvider
from .task import DockerTask
| StarcoderdataPython |
1769110 | <reponame>DeqiTang/pymatflow
import os
def vaspSubparser(subparsers):
# --------------------------------------------------------------------------
# VASP
# --------------------------------------------------------------------------
subparser = subparsers.add_parser("vasp", help="using vasp as calc... | StarcoderdataPython |
1663051 | # usage - $python generate_anagrams.py foo bar
import sys
from random import shuffle
for word in sys.argv[1:]:
word = list(word)
anagrams = []
for i in range(10):
shuffle(word)
anagrams.append(''.join(word))
print ' '.join(anagrams)
| StarcoderdataPython |
154425 | # -*- coding: utf-8 -*-
# Copyright (c) 2020, Sistem Koperasi
import frappe
from frappe.utils import today, flt
@frappe.whitelist()
def dkh_get_permission_query_conditions(user=None):
if not user: user = frappe.session.user
return """(`tabDKH`.parent_sales_executive = '{}')""".format(user)
if user == "Administrat... | StarcoderdataPython |
1654318 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | StarcoderdataPython |
1687693 | from .. import VidStreamer
import cv2
import sys
if __name__ == '__main__':
streamer= VidStreamer.VidStreamer(verbose = True, _diffmin = 0)
streamer.set_partner(("10.50.3.181", 5000))
streamer.initCam()
streamer.cam.set_res(640,480)
if not streamer.connectPartner():
print("connectPartner f... | StarcoderdataPython |
3314226 | # -*- coding: utf-8 -*-
# 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 "Lic... | StarcoderdataPython |
1687458 | import argparse
from utils.config import Config
from trainer.stage2trainer import Trainer as Stage2Trainer
class Solver():
def __init__(self, args):
self.robot_args = [args.obj_mesh_dir, args.num_obj, args.workspace_limits, args.heightmap_resolution]
self.logger_args = {
'continue_logging': args.continue_log... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.