Skip to content

Instantly share code, notes, and snippets.

View priyankajayaswal1's full-sized avatar
👋
yo fellas !!

Priyanka Jayaswal priyankajayaswal1

👋
yo fellas !!
View GitHub Profile
library(sqldf)
x<-read.table("//home//innovator//Documents//Internship//Data//household_power_consumption.txt",header=TRUE,sep=';',dec = '.',stringsAsFactors=FALSE)
x$Date<- as.Date(x$Date,"%d/%m/%Y")
x$Time = format(as.POSIXlt(x$Time, format = "%H:%M:%S"), format="%H:%M:%S")
x$Global_active_power = as.numeric(x$Global_active_power)
x$Global_reactive_power = as.numeric(x$Global_reactive_power)
x$KVA = sqrt(x$Global_active_power*x$Global_active_power+x$Global_reactive_power*x$Global_reactive_power)
x$Day = weekdays(x$Date)
# Creating sample pools for six month data
if not gen:
gen = pagegenerators.ReplacePageGenerator(
source, replacements, exceptions, regex,
textfilename, categoryname, pagenames)
preloadingGen = pagegenerators.PreloadingGenerator(gen, step=20)
➜ pywikibot-core git:(standardize_notes) ✗ python pwb.py scripts/standardize_notes.py -page:'User:Priyanka Jayaswl'
The summary message will default to: Robot: Automated reference processing %s
Press Enter to use this default message, or enter a
description of the changes your bot will make:
Traceback (most recent call last):
File "pwb.py", line 215, in <module>
run_python_file(filename, argv, argvu, file_package)
File "pwb.py", line 84, in run_python_file
main_mod.__dict__)
File "./scripts/standardize_notes.py", line 1140, in <module>
>>> for (page, date, length, loggedIn, username,comment) in site.newpages(step=100):
... print (page,length, loggedIn, username,comment)...
(Page(User:MusikPuppet/monobook.js), 120, u'', u'MusikPuppet', u'Created page with "importScriptURI(\'https://en.wikipedia.org/w/index.php?action=raw&ctype=text/javascript&title=User:Animum/easyblock.js\');"')
(Traceback (most recent call last):
File "<stdin>", line 2, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position 10-11: ordinal not in range(128)
>>>
diff --git a/scripts/replace.py b/scripts/replace.py
index 56fcab5..c8f16d0 100644
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -803,13 +803,15 @@ def main(*args):
if replacement_file:
try:
with codecs.open(replacement_file, 'r', 'utf-8') as f:
- commandline_replacements.extend(
- line.lstrip(u'\uFEFF').rstrip('\r\n') for line in f)
diff --git a/scripts/replace.py b/scripts/replace.py
index 56fcab5..8d2d119 100644
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -804,7 +804,7 @@ def main(*args):
try:
with codecs.open(replacement_file, 'r', 'utf-8') as f:
commandline_replacements.extend(
- line.lstrip(u'\uFEFF').rstrip('\r\n') for line in f)
+ line.rstrip('\r\n') for line in f.readlines())
➜ pywikibot-core git:(follow1) ✗ python pwb.py scripts/followlive.py -lang:'test' -family:'test'
WARNING: /home/innovator/pywikibot-core/pywikibot/family.py:916: FamilyMaintenanceWarning: Family name wikimediachapter does not match family module name wikimedia
[[Wikipédia:Pedidos de administração/!Silent/3]] 2015-04-09T01:16:42Z
Length: 1123 bytes
User : !Silent
Integrity of page doubtful...
---- Start content ----------------
{{Wikipedia:Pedidos de administração/Eleições concluídas/Cabeçalho|em andamento}}
<!-- Terminada a votação, inserir o resumo de fechamento. -->
== [[Usuário:!Silent|!Silent]] ==
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This bot uses external filtering programs for munging text.
For example:
python pwb.py piper.py -filter:'tr A-Z a-z' Wikipedia:Sandbox
Would lower case the article with tr(1).
python3 -m flake8 scripts/copyright/copyright.py
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.4/dist-packages/flake8/__main__.py", line 1, in <module>
from flake8.main import main
File "/usr/local/lib/python3.4/dist-packages/flake8/main.py", line 7, in <module>
from flake8.engine import get_parser, get_style_guide
class Importer(pywikibot.Page):
def __init__(self, site):
self.importsite = site
pywikibot.Page.__init__(self, site, 'Special:Import', None, 0)
def Import(self, target, project='w', crono='1', namespace='', prompt=True):
"""Import the page from the wiki. Requires administrator status.
If prompt is True, asks the user if he wants to delete the page.