id
stringlengths
1
265
text
stringlengths
6
5.19M
dataset_id
stringclasses
7 values
3345189
# # cogs/programming/__init__.py # # mawabot - Maware's selfbot # Copyright (c) 2017 Ma-wa-re, <NAME> # # mawabot is available free of charge under the terms of the MIT # License. You are free to redistribute and/or modify it under those # terms. It is distributed in the hopes that it will be useful, but # WITHOUT ANY ...
StarcoderdataPython
121847
<reponame>joinrpg/joinrpg from django.conf.urls import patterns, url from claims import views urlpatterns = patterns('', url(r'^$', views.index, name='index'), url(r'^about/?$', views.about, name='about'), #project area url(r'^project/discover/?$', views.project_discover, name='project_discover...
StarcoderdataPython
1793834
""" ==== Span ==== A line or a band horizontal to an ternary axis can be plotted by the commands ``axtline``, ``axlline``, ``axrline``, ``axtspan``, ``axlspan``, ``axrspan``. """ import matplotlib.pyplot as plt import mpltern # noqa: F401 ax = plt.subplot(projection='ternary') ax.set_tlabel('Top') ax.set_llabel('L...
StarcoderdataPython
3271030
class Inventory: """ Inventory class - a struct{} like feature to house inventory counts across modules. """ originalQuery = None item = "" unit = "" amount = "" def __init__(self, statement): """ Constructor - only takes in the original query/statement ...
StarcoderdataPython
1775738
from django.apps import AppConfig class ApiCategoryConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'api_category'
StarcoderdataPython
1651065
<reponame>patphongs/wagtail<filename>wagtail/wagtaildocs/apps.py<gh_stars>1-10 from __future__ import absolute_import, unicode_literals from django.apps import AppConfig class WagtailDocsAppConfig(AppConfig): name = 'wagtail.wagtaildocs' label = 'wagtaildocs' verbose_name = "Wagtail documents" def r...
StarcoderdataPython
1709707
from numpy import cos, cosh, sin, sinh import numpy as np import matplotlib.pyplot as plt import time ''' TASK 15 ''' r1 = 1.87527632324985 r2 = 4.69409122046058 r3 = 7.855 q1 = 1.77748462 q2 = -0.84753308 q3 = -0.01671216 #r1 and q1 derived in previous task def phi(x, r): return sin(r*x) + sinh(r*x) + ((cos(r) ...
StarcoderdataPython
1680783
from . import arguments, implementation, subcommands
StarcoderdataPython
3338275
#python code to demonstrate Type conversion #using tuple(),set(),list() #initialising string s='geeks' #printing string converting to tuple c=tuple(s) print("after converting string to tuple:",end=" ") print(c) #printing string converting to set c=set(s) print("after converting string to set:",end=" ") print(c) #pr...
StarcoderdataPython
4815977
# -*- coding: utf-8 -*- from core import CardPainter from reportlab.lib.styles import ParagraphStyle from reportlab.platypus import Paragraph, Frame, KeepInFrame class NormalCardPainter(CardPainter): def paint(self): for story in self.backlog: self.__paint_story_card(story) self.canv...
StarcoderdataPython
3319832
<filename>src/config/urls.py from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url('admin/', admin.site.urls), url('user/', include('api.urls')), url('polygon/', include('polygon.api.urls')), ]
StarcoderdataPython
3216260
# recursion_dictionary.py # suppose i want to do integer multiplicate and all i have available is addition # multiplication - iterative soluntion # check a*b --> 'add a to itself b times' # capture state by """ # start = i # stop at = 0 # condition: i < i-1 # each time it reduces by 1 iteratively until i get down to ...
StarcoderdataPython
3351062
<filename>Python_NumPy/ch3/np_power_sqrt.py import numpy as np a = np.array([0,1,2,3,4]) b = np.array([2,4,6,8,10]) # 求 幂运算 和 求平方根运算 np.power(2,3) 2**3 a = np.arange(1,11,1) a b = np.array([1,2,1,2,1,2,1,2,1,2]) b np.power(a,b) a**b np.sqrt(2) # 求根号 2**0.5 np.sqrt(a)
StarcoderdataPython
171792
<filename>stagpy/_step.py """Implementation of Step objects. Note: This module and the classes it defines are internals of StagPy, they should not be used in an external script. Instead, use the :class:`~stagpy.stagyydata.StagyyData` class. """ from collections.abc import Mapping from collections import ...
StarcoderdataPython
146835
<filename>tests/test_subtitle.py # -*- coding: utf-8 -*- import os import six from babelfish import Language from subliminal.subtitle import Subtitle, fix_line_ending, get_subtitle_path def test_subtitle_text(): subtitle = Subtitle(Language('eng')) subtitle.content = b'Some ascii text' assert subtitle.t...
StarcoderdataPython
3309196
<gh_stars>1-10 import pyglet, sys, random # mulltiple balls attracted towards the mouse class Ball(pyglet.shapes.Circle): def __init__(self, win, *args): super().__init__(x=random.randint(50, 150), y=random.randint(50, 150), radius=20, color=(255, 0, 0)) ...
StarcoderdataPython
4810878
<filename>parse/parser.py from colorama import Fore, Style, Back, init init() states = { ' ': 0, 'x': 1, 'X': 1, '/': 2, '\\': 2, '?': 3, '!': 4 } colors = { 0: Fore.WHITE, 1: Fore.GREEN, 2: Fore.YELLOW, 3: Fore.RED, 4: Fore.RED + Style.DIM } code, tab = None, None end...
StarcoderdataPython
4835484
# pylint: disable=F0401 from eventsourcing_helpers.handler import Handler from eventsourcing_helpers.messagebus import MessageBus class Consumer: """ Helper to consume and handle messages from the bus. """ def __init__(self, messagebus: MessageBus, handler: Handler) -> None: self._messagebus ...
StarcoderdataPython
1669639
# -*- coding: utf-8 -*- import os # BigQuery from google.cloud import bigquery from google.oauth2 import service_account # Data Science and Networks import pandas as pd import networkx as nx import matplotlib matplotlib.use('Agg') # Important because no GUI in vagrant or server import matplotlib.pyplot as plt import c...
StarcoderdataPython
3365410
def dfs(grid, i, j): n, m = len(grid), len(grid[0]) positions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)] grid[i][j] = 0 count = 1 for pos in positions: if i + pos[0] in range(n) and j + pos[1] in range(m): if grid[i + pos[0]][j + po...
StarcoderdataPython
9994
class MyClass: def __repr__(self): return self.__class__.__name__ + '()' print(MyClass().__repr__())
StarcoderdataPython
183152
<filename>sh_coding_challenge/sh_server/itertools_ext_lib.py # Provides itertools-related functions not available in the Python3 intertools library # Requires Python3 import itertools def grouper(items, n): """ Collect data into fixed-length chunks or blocks. @param itr $items - List to be split...
StarcoderdataPython
1764509
begin_unit comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may' nl|'\n' comment|'# not use this file except in compliance with the License. You may obtain' nl|'\n' comment|'# a copy of the License at' nl|'\n' comment|'#' nl|'\n' comment|'# http://www.apache.org/licenses/L...
StarcoderdataPython
1671791
<reponame>mebeim/pyelftools #------------------------------------------------------------------------------- # elftools example: dwarf_pubnames_types.py # # Dump the contents of .debug_pubnames and .debug_pubtypes sections from the # ELF file. # # Note: sample_exe64.elf doesn't have a .debug_pubtypes section. # # <NAME...
StarcoderdataPython
77073
import math r =3 R =4 d =3**0.5 part1 = r*r*math.acos((d*d + r*r - R*R)/(2*d*r)); part2 = R*R*math.acos((d*d + R*R - r*r)/(2*d*R)); part3 = 0.5*math.sqrt((-d+r+R)*(d+r-R)*(d-r+R)*(d+r+R)); intersectionArea = part1 + part2 - part3; print(intersectionArea)
StarcoderdataPython
4807723
<gh_stars>1-10 '''Write view here''' from rest_framework.views import APIView from rest_framework.response import Response from rest_framework.decorators import api_view from main.crawler.infocom_crawler import InfocomCrawler from main.util.regex import find_number_in_string from main.models import Notice from main.uti...
StarcoderdataPython
3352505
<gh_stars>0 from tkinter import * from tkinter import Tk import tkinter as tk from tkinter import ttk from binario import * from isam import * def cargarbotones(nodos): contenedor=Frame(root) canvas=Canvas(contenedor,width=75,height=700) scrollbar=Scrollbar(contenedor, orient="vertical",command=...
StarcoderdataPython
3286873
<filename>dvc/render/vega.py<gh_stars>0 import json import os from copy import deepcopy from typing import Dict, List, Optional from funcy import cached_property from dvc.render.base import REVISION_FIELD, BadTemplateError, Renderer from dvc.render.data import Converter, to_datapoints from dvc.render.utils import get...
StarcoderdataPython
4811516
<gh_stars>0 import rblk.scanner.txt as txtscaner import rblk.tag.txt as tgtg import elist.elist as elel class Parser(): def __init__(self,txt,tag_pairs): self.txt = txt if(isinstance(tag_pairs,dict)): pass else: tag_pairs = tgtg.str2pairs(tag_pairs) self.desc...
StarcoderdataPython
3315673
<filename>__tests__/spot.py import binanceWrapper, os import unittest from dotenv import load_dotenv class Spot(unittest.TestCase): pass def setUp(self) -> None: load_dotenv() binanceWrapper.setKeys(os.getenv('APIKEY'), os.getenv('SECRETKEY')) def newOrder(self): print(binanceWrap...
StarcoderdataPython
129039
from sympy.core.numbers import (Float, pi) from sympy.core.symbol import symbols from sympy.functions.elementary.trigonometric import (cos, sin) from sympy.matrices.immutable import ImmutableDenseMatrix as Matrix from sympy.physics.vector import ReferenceFrame, Vector, dynamicsymbols, outer from sympy.physics.vect...
StarcoderdataPython
3219200
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import fluent_contents.plugins.oembeditem.fields class Migration(migrations.Migration): dependencies = [ ('fluent_contents', '0001_initial'), ] operations = [ migrations.CreateModel(...
StarcoderdataPython
14168
import numpy as np def load_mnist(): # the data, shuffled and split between train and test sets from keras.datasets import mnist (x_train, y_train), (x_test, y_test) = mnist.load_data() x = np.concatenate((x_train, x_test)) y = np.concatenate((y_train, y_test)) x = x.reshape(-1, 28, 28, 1).as...
StarcoderdataPython
3217554
<filename>pricePredict2.py import keras import random import time import datetime import math import thread import os import sys import numpy as np from scipy import stats from pytz import utc,timezone from sklearn.linear_model import LinearRegression from influxdb import InfluxDBClient class PricePredict: def __...
StarcoderdataPython
35710
<reponame>fredrikaverpil/python-rust import re import string import random import mylib # Python ZIP version def count_doubles(val): total = 0 # there is an improved version later on this post for c1, c2 in zip(val, val[1:]): if c1 == c2: total += 1 return total # Python REGEXP v...
StarcoderdataPython
169737
import torch import torch.nn as nn import torch.nn.functional as F class Transformer(nn.Module): def __init__(self, vocab_size: int, max_seq_len: int, embed_dim: int, hidden_dim: int, n_layer: int, n_head: int, ff_dim: int, embed_drop: float, hidden_drop: float): super().__init__() self.tok_embedd...
StarcoderdataPython
1637605
<gh_stars>1-10 import numpy as np import matplotlib.pyplot as plt import h5py import scipy from PIL import Image from scipy import ndimage from lr_utils import load_dataset get_ipython().magic('matplotlib inline') train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes = load_dataset() index = 25 plt.imsho...
StarcoderdataPython
3267649
<gh_stars>0 #!/usr/bin/env python # encoding: utf-8 # ---------------------------------------------------------------------------- from django.contrib import admin from django_mailer import models try: from django.conf.urls import patterns, url except ImportError: from django.conf.urls.defaults import * from m...
StarcoderdataPython
168959
import dash_html_components as html TEXT = html.Div( [ html.P( "We used two kinds of attention maps: saliency maps and Grad-RAM (Gradient-weighted Regression Activation Mapping) to identify which regions and features were driving the prediction for each image." ) ], style={ ...
StarcoderdataPython
3335072
<gh_stars>0 from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer analyser = SentimentIntensityAnalyzer() def sentiment_analyzer_scores(sentence): score = analyser.polarity_scores(sentence) print("{:-<40} {}".format(sentence, str(score))) sentiment_analyzer_scores("The phone is super coo...
StarcoderdataPython
1773562
#! /usr/bin/env python3 import argparse import json import sys def get_arguments(args): parser = argparse.ArgumentParser(description="Expand a field from the given JSON") parser.add_argument("-k", "--key", help="The key to expand", required=True) json_input = parser.add_mutually_exclusive_group(required=T...
StarcoderdataPython
1670099
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Project : FG-NIC # @Author : <NAME> # @File : restoration.py # @Description : This file contains funtions for restoration networks. from torch.nn import Module from torch import Tensor import torch.nn as nn import torch import os import m...
StarcoderdataPython
39532
import io from nose.tools import istest, assert_equal import funk from mammoth import documents, results from mammoth.docx.xmlparser import element as xml_element, text as xml_text from mammoth.docx.document_xml import read_document_xml_element from mammoth.docx.numbering_xml import Numbering from mammoth.docx.relati...
StarcoderdataPython
1733019
import argparse from fit_rdf_gnn import * parser = argparse.ArgumentParser() parser.add_argument("-logdir", type=str) parser.add_argument("-data", type=str, nargs='+') parser.add_argument("-val", type=str, nargs='+') parser.add_argument("-name", type=str) parser.add_argument("-device", type=int, default=0) parser.add...
StarcoderdataPython
3359664
CATEGORY_SPLITTER = '\n'
StarcoderdataPython
4803125
# methods POST_REQUEST = "POST" PUT_REQUEST = "PUT" GET_REQUEST = "GET" DELETE_REQUEST = "DELETE"
StarcoderdataPython
3226366
<filename>boats/forms.py<gh_stars>0 from django import forms from .models import OwnerProfileInfo, RenterProfileInfo, User, Boat, RentContract, BoatCrew, RepairContract, Crew from django.utils import timezone class UserForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput()) class Meta:...
StarcoderdataPython
67761
''' Test to find out if we can determine correctly wether we are in the Transcrypt/JavaScript or the CPython environment ''' from org.transcrypt.stubs.browser import __envir__, __pragma__ if __envir__.executor_name == __envir__.transpiler_name: document.getElementById ('output') .innerHTML = 'Using Transcrypt' ...
StarcoderdataPython
50217
import sox import numpy as np import argparse import os parser = argparse.ArgumentParser() parser.add_argument("--input", help="input file name") args = parser.parse_args() print(args.input) np1 = np.arange(start=-1.0, stop=1.1, step=0.10) np2 = np.arange(start=0.9, stop=1.11, step=0.01) np3 = np.arange(start=0.9...
StarcoderdataPython
3333748
<filename>DRFdemo/BookTest/serializers.py<gh_stars>0 # 针对BookInfo模型类数据,定义一个BookInfoSerializer序列化器 # 来对BooKinfo数据进行序列化操作 ''' from rest_framework import serializers # # 我们自己心里清楚,这个序列化器是针对BookInfo的!!! # class BookInfoSerializer(serializers.Serializer): # # 通过指定同名类属性的形式,来定义转化结果字典中的属性 # # btitle = serializers.Cha...
StarcoderdataPython
3210184
<filename>resx-2-js.py from xml.dom import minidom import sys, os import re class ResourceToJs: """Scrapes .Net .resx (or any file implementing that xml schema) files and writes out the translations as attributes to javascript objects""" # a list of reserved words in javascript reserved_words = ['abst...
StarcoderdataPython
3272794
<gh_stars>10-100 #!/usr/bin/env python # -*- coding: utf- -*- from marking import canvas_api, mongodb_store, marking_actions, marks, file_actions, git_actions, java_actions import requests from marking.mongodb_store import content_decode if __name__ == "__main__": store = mongodb_store.SubmissionStore() capi...
StarcoderdataPython
3279754
<gh_stars>0 import re import os import simplejson as json from .nlp import normalize digitpat = re.compile('\d+') timepat = re.compile("\d{1,2}[:]\d{1,2}") pricepat2 = re.compile("\d{1,3}[.]\d{1,2}") # FORMAT # domain_value # restaurant_postcode # restaurant_address # taxi_car8 # taxi_number # train_id etc.. PATH ...
StarcoderdataPython
1716275
# File: exp.py # Author: raycp # Date: 2019-05-28 # Description: exp for 2ez4u from pwn_debug import * pdbg=pwn_debug("./2ez4u") pdbg.context.terminal=['tmux', 'splitw', '-h'] pdbg.local("./libc.so","/glibc/x64/2.24/lib/ld-2.24.so") pdbg.debug("2.24") pdbg.remote('127.0.0.1', 22) #p=pdbg.run("local") #p=pdbg.run("r...
StarcoderdataPython
3399648
from django.http import HttpResponseRedirect, Http404 from django.shortcuts import render from django.urls import reverse from .models import * def report(request): reports = {'reports': Report.objects.all()} return render(request, 'report.html', reports) def report_post(request): if request.method == "...
StarcoderdataPython
171771
<reponame>mithro/chromium-infra # Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import glob import json import logging import os import sys from infra_libs import ts_mon # Where to look for cipd packages...
StarcoderdataPython
1760329
<gh_stars>0 from telethon import events from telethon.errors.rpcerrorlist import YouBlockedUserError from telethon.tl.functions.account import UpdateNotifySettingsRequest from darkbot import bot, CmdHelp from darkbot.utils import admin_cmd, edit_or_reply as eor, sudo_cmd @darkbot.on(admin_cmd(pattern="history ?(.*)"))...
StarcoderdataPython
1675406
<gh_stars>1-10 #!/usr/bin/python3 BaseGeometry = __import__('7-base_geometry').BaseGeometry class Rectangle(BaseGeometry): """rectangle shape, inheirts from basegeometry """ def __init__(self, width, height): self.integer_validator("width", width) self.integer_validator("height", height)...
StarcoderdataPython
4835449
''' MIT License Copyright (c) 2021 Futurewei Cloud Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
StarcoderdataPython
1728292
<filename>tools/atlas2/vcfPrinter_1.1.py #!/usr/bin/env python import sys, os, commands, string, subprocess, shutil, optparse, tempfile """ version 1.1 """ def stop_err( msg ): sys.stderr.write( "%s\n" % msg ) sys.exit() def __main__(): galaxyhome=os.environ.get('GALAXY_HOME') ''' n = len(sys.ar...
StarcoderdataPython
51737
<gh_stars>10-100 """Support for Ecowitt Weather Stations.""" import logging import homeassistant.util.dt as dt_util from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.components.sensor import SensorEntity from homeassistant.const import DEVICE_CLASS_BATTERY from homeassistant.const ...
StarcoderdataPython
3398122
<filename>tools/pkt_gen/prox/render.py # Copyright 2021 Spirent Communications. # # 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 req...
StarcoderdataPython
147561
#!python3 import numpy as np from magLabUtilities.signalutilities.signals import SignalThread, Signal, SignalBundle from magLabUtilities.signalutilities.hysteresis import HysteresisSignalBundle, XExpGendey101620 from magLabUtilities.uiutilities.plotting.hysteresis import MofHXofMPlotter if __name__=='__main__'...
StarcoderdataPython
3208719
<reponame>Satily/leetcode_python_solution<gh_stars>1-10 from data_structure import TreeNode, build_binary_tree class Solution: def distributeCoins(self, root: TreeNode) -> int: def dfs(node: TreeNode) -> (int, int, int): if node is None: return 0, 0, 0 left_node_num...
StarcoderdataPython
1773780
<reponame>anoronh4/mergeSVvcf<filename>tests/test_pymergevcfs.py import unittest from mergesvvcf.locations import * from mergesvvcf.variantdict import * class TestLocations(unittest.TestCase): def setUp(self): self.l1 = location('X',31,'+') self.l2 = location('Y',131,-1) self.l3 = location...
StarcoderdataPython
1691675
<reponame>Kobzol/haydi from .domain import StepSkip, skip1 class Transformation(object): def init_transformed_domain(self, domain, parent): domain.filtered = parent.filtered domain.step_jumps = parent.step_jumps domain.strict = False def size_of_transformed_domain(self, size): ...
StarcoderdataPython
14946
from narrative2vec.logging_instance.logging_instance import LoggingInstance, _get_first_rdf_query_result from narrative2vec.logging_instance.reasoning_task import ReasoningTask from narrative2vec.ontology.neemNarrativeDefinitions import QUATERNION from narrative2vec.ontology.ontologyHandler import get_knowrob_uri cla...
StarcoderdataPython
1707870
import pathlib from typing import Union PathLike = Union[pathlib.Path, str]
StarcoderdataPython
1775862
from rkn.api.rkn.monitor import Monitor monitor = Monitor() handlers = [ ('get', '/api/3/rkn/status', monitor.status), ('get', '/api/3/rkn/update', monitor.update), ('get', '/api/3/rkn/get_mirrors', monitor.get_mirrors), ]
StarcoderdataPython
1674854
# https://www.hackerrank.com/challenges/save-the-prisoner/problem?h_r=internal-search # no of prisoner n = 3 # no of candies m = 7 # starting index s = 3 # candies / n => remaining candies to distribute from index 0 and s -1 is add to remainder print(m%n+(s-1)) c = m % n k = (c+s-1) %n if k == 0: print(n) else: ...
StarcoderdataPython
1676779
<reponame>crsutton/sp-orchestrator #!/usr/bin/python #******************************************************************************* # # Name: HelloOrchestrator # # Description: Simple application to use REST API calls to the Orchestrator # # Inputs: None # Outputs: 1. Return Value (of a REST GET ...
StarcoderdataPython
53663
from scraper import TwitterScraper, ICanHazDadJokeScraper scrapers = [ TwitterScraper('baddadjokes'), ICanHazDadJokeScraper() ] if __name__ == '__main__': for scraper in scrapers: scraper.scrape()
StarcoderdataPython
4806786
import discord import os from random import randint R = range(1, 11) rolls = [] init = [] roll = ["roll","roll ", "/roll", "/roll ", "Roll", "Roll "] roll10 = ["roll10", "roll 10", "/roll10", "/roll 10", "Roll10", "Roll 10"] init0 = ["init", "init ", "/init", "/init ", "Init", "Init "] #Add people in here pessoa...
StarcoderdataPython
1606117
from io import StringIO from contextlib import redirect_stdout from pathlib import Path import pytest from herethere.there.client import Client @pytest.mark.asyncio async def test_line_executed(there): out = StringIO() with redirect_stdout(out): await there.runcode("print('hello there')") assert...
StarcoderdataPython
72996
<filename>paddlex/ppdet/modeling/reid/fairmot_embedding_head.py # 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://...
StarcoderdataPython
1794725
<gh_stars>1-10 from kivy.properties import NumericProperty from kivy.uix.widget import Widget from kivy.uix.floatlayout import FloatLayout from kivy.uix.scatter import Scatter from kivy.clock import Clock from math import atan2, degrees class Card(Scatter): symm_boundary = NumericProperty(120) angle = Numeri...
StarcoderdataPython
163167
import dateutil from typing import List import numpy as np import pandas as pd from macpie._config import get_option from macpie import lltools, strtools def add_diff_days( df: pd.DataFrame, col_start: str, col_end: str, diff_days_col: str = None, inplace=False ): """Adds a column to DataFrame called ``_dif...
StarcoderdataPython
1685858
import argparse from utils import * from models import * if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--train_sdp_filename",type=str,default="dm.sdp") parser.add_argument("--test_file_name",type=str,default="test_data/esl.input") parser.add_argument("--output_path...
StarcoderdataPython
72541
"""empty message Revision ID: 500978cd99d3 Revises: <KEY> Create Date: 2017-06-16 10:12:25.765499 """ # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '<KEY>0' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql def upgrade(): ### commands auto genera...
StarcoderdataPython
1691440
from wikidataintegrator import wdi_core, wdi_login import copy import bs4 import requests import json import local from datetime import datetime import bibtexparser from IPython.display import Image, HTML class external_data(object): def __init__(self, inaturalist_id): self.now = datetime.now() sel...
StarcoderdataPython
1716893
t = int(input()) N = [int(input()) for _ in range(t)] for n in N: ans = "9" for i in range(n - 1): ans += str((i + 8) % 10) print(ans)
StarcoderdataPython
127450
# -*- coding: utf-8 -*- # @Time : 2021/08/14 16:30 # @Author : srcrs # @Email : <EMAIL> import requests,json,time,re,login,logging,traceback,os,random,notify,datetime from lxml.html import fromstring #游戏任务中心每日打卡领积分,游戏任务自然数递增至7,游戏频道每日1积分 #位置: 首页 --> 游戏 --> 每日打卡 class game_signin: def run(self, client, user): ...
StarcoderdataPython
4834012
<reponame>blbarker/atk<gh_stars>1-10 # vim: set encoding=utf-8 # # Copyright (c) 2015 Intel Corporation  # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # #       http://www.apache.org/l...
StarcoderdataPython
3359037
<gh_stars>1-10 from codecs import open from os import path from setuptools import setup here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, "README.md"), encoding="utf-8") as f: long_description = f.read() setup( name="bestnewmusic", desc...
StarcoderdataPython
1608122
from gtmcore.container.container import SidecarContainerOperations from gtmcore.mitmproxy.mitmproxy import MITMProxyOperations import os from gtmcore.activity.tests.fixtures import mock_redis_client from gtmcore.fixtures import mock_labbook, mock_config_with_repo from gtmcore.fixtures.container import build_lb_image_f...
StarcoderdataPython
143390
<gh_stars>0 from django.contrib import admin from django.urls import re_path from .models import ( ArtProjectContent, ProjectContent, ProjectGrouper, ResearchProjectContent, ) from .views import PreviewView class VersionedContentAdmin(admin.ModelAdmin): def get_urls(self): info = self.mod...
StarcoderdataPython
4812294
#!/usr/bin/env python # -*- encoding: utf-8 -*- import random import pygame import os import os.path import glob import fnmatch, re import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) GPIO.setup(23,GPIO.IN) pygame.mixer.init() #FUNCTIONS def button(play): if play: pygame.mixer.music.pause() ...
StarcoderdataPython
169948
<reponame>averrin/emergent # coding: utf8 from django.conf.urls import patterns, url from views import IndexView urlpatterns = patterns('', url(r'^$', IndexView.as_view(), name='zen-index'), )
StarcoderdataPython
3312021
<filename>example/server/app.py<gh_stars>1-10 import base64 import time import hashlib import json from flask import Flask, request, send_file from werkzeug.utils import secure_filename from pprint import pprint from fantopia import Fantopia # from fantopia_offline import Fantopia import sys sys.path.append('../../ca...
StarcoderdataPython
1645707
import discord from utils.globals import gc from utils.settings import settings import ui.text_manipulation as tm # inherits from discord.py's Client class Client(discord.Client): # NOTE: These are strings! __current_server = "" __current_channel = "" __prompt = "" # discord.Status object __s...
StarcoderdataPython
117778
# Generated by Django 2.0.5 on 2018-06-26 12:21 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('wagtailimages', '0019_delete_filter'), ('home', '0003_standardpage'), ] operations = [ migrations.A...
StarcoderdataPython
1773335
import os import sys import time import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages from shutil import copyfile import psutil import gc def import_from(module, name): """ from 'module' import 'name' :param module: module name :param name: name of function that shall b...
StarcoderdataPython
3335942
<filename>PythonExercicios/ex088.py from random import randint from time import sleep print('-' * 20) print('JOGA NA MEGA SENA') print('-' * 20) jogos = int(input('Quantos jogos você quer que eu sorteie? ')) print() print('-=' * 5, f'SORTEANDO {jogos} JOGOS', '=-' * 5) print() sorteados = [] lista = [] for j in range(...
StarcoderdataPython
3323581
<filename>organize_corpus.py from nltk import sent_tokenize import random def open_corpus(file_name): '''Function opens corpus of comments from the disk. ''' with open(file_name, 'r', encoding='utf-8') as read_obj: corpus = read_obj.read() return corpus def tokenize_corpus(corpus): '''Func...
StarcoderdataPython
72551
<gh_stars>1-10 from ctrlibrary.core.utils import get_observables from ctrlibrary.threatresponse.enrich import enrich_observe_observables from tests.functional.tests.constants import ( CONFIDENCE, SEVERITY, MODULE_NAME, CTR_ENTITIES_LIMIT, SPYCLOUD_URL, SOURCE ) def test_positive_sighting_email...
StarcoderdataPython
1667407
<gh_stars>1-10 import sys import asyncio import ssl import re import moses.defaults as defaults IP_PORT_RE = ''' ^ ( ((([0-9]{1,3}\.){3}[0-9]{1,3})(:([0-9]{1,5}))?) # ipv4[:port] | (([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}) # ipv6 without port no. ...
StarcoderdataPython
3374767
<reponame>tzach/sphinx-scylladb-theme-1 def multiversion_regex_builder(versions): """Generates a regex string from a list of versions. Every documentation project `conf.py` file uses this function to define the different documentation versions supported. :param versions: A list of versions. Versions c...
StarcoderdataPython
131756
<filename>python/8Kyu/Define a card suit.py def define_suit(card): if card.endswith("C"): return "clubs" if card.endswith("D"): return "diamonds" if card.endswith("H"): return "hearts" if card.endswith("S"): return "spades"
StarcoderdataPython
3265052
import json from collections import defaultdict import matplotlib.pyplot as plt import networkx as nx def main(): file_names = [ 'data/office/s01e01_frames.txt', 'data/office/s01e02_frames.txt', 'data/office/s01e03_frames.txt', 'data/office/s01e05_frames.txt', 'data/office...
StarcoderdataPython
1657324
<reponame>MRSD2018/reefbot-1 #!/usr/bin/env python import roslib; roslib.load_manifest('reefbot-controller') import rospy import copy import thread import threading from joy.msg import Joy from reefbot_msgs.msg import RobotStatus from reefbot_msgs.msg import CameraPower from robot_api import * from CommandAdapter impo...
StarcoderdataPython